Mysql Problems

They have: 15 posts

Joined: Jun 2002

Hello, I am working on a news script and I'm having a little trouble displaying the "Read More" section. This is what I have.

<?php
If (($op == \"news\") && (isset($nid))) {
  readmore(
$nid);
}

function readmore(
$nidnum) {
require (\"config.php\");
require (\"mysql.php\");
include (\"sources/head.php\");

$PRENEWS = $prefix . \"news\";

   
$result = mysql_query(\"SELECT * FROM $PRENEWS WHERE nid='$nidnum' ORDER by nid\");
   
$row = mysql_fetch_array($result);
   
       
$ncontent = $row[\"news\"];
       
$nscontent = $row[\"details\"];
       
$nheadline = $row[\"headline\"];
       
$nauthor = $row[\"author\"];
       
$nemail = $row[\"email\"];
       
$nidnum = $row[\"id\"];
       
$nmore = $row[\"details\"];

Echo (\"
$nheadline <font size=2>Posted by <a href=mailto:$nemail>$nauthor</a></font><br>\");
Echo (\"
$ncontent<p>$nmore<p>\");
?>

The script can be found over here. Can anyone help me? I had a friend try but it still doesn't work.

Dream until your dreams come true. For those with wings fly to your dreams.

Era Creations: What games were meant to be

He has: 1,016 posts

Joined: May 2002

First of all, you need to use mysql_fetch_assoc($result) and not mysql_fetch_array($result) to do what you want. But that should not be the problem. Try putting echo mysql_error(); after the mysql_query() line to see what exactly the problem is.

They have: 15 posts

Joined: Jun 2002

Thank you very much, it works now. Laughing out loud

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.