Jump to content

Need data from one row in DB


CincoPistolero

Recommended Posts

I need to just pull data from one row in a table. Below is the code I use for the SQL.

 

$query_au = "SELECT * FROM about WHERE active=1 ORDER BY aboutID";
$result_au = mysql_query($query_au) or die ("Error in query: $query_au. " . mysql_error());
$row = mysql_fetch_row($result_au);

 

And here is how I try to display it. Unfortunately, it is not displaying anything. Any help is appreciated.

 

<?php echo "$body"; ?>

Link to comment
Share on other sites

Here is my code, you can try it, it works on my site.  I just put a while statement in there and if no results, it says there is none.

 

while($row = mysql_fetch_row($result)) {
?>

<?php echo $row[0];?>


<?php

}

}
else {
// no
// print status message
echo "<b class=red>";
echo "No rows found!";
echo "</b>";
}

Link to comment
Share on other sites

Forgot single quotes, and DESC or ASC for the Order By

 

try

 

<?php

$query_au = "SELECT * FROM about WHERE `active` = '1' ORDER BY `aboutID` DESC";
$result_au = mysql_query($query_au) or die (mysql_error());
$row = mysql_fetch_assoc($result_au);

echo $row['row_1'];

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.