Forum Moderators: coopster

Message Too Old, No Replies

Need data from 1 row of the selected column

         

outdoorxtreme1

6:20 pm on Aug 4, 2006 (gmt 0)

10+ Year Member



I would like to be able to get info from 1 row on the selected column. How do I do this? Here is the code I have been working with but I can't seem to get it right. Can someone please help me? Thanks.

<?php
$host = "localhost";
$user = "user";
$pass = "pass";
$dbname = "dbname";

$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
mysql_select_db($dbname);

$sql= 'SELECT content FROM cms_content_props where content_id=213';
$result = mysql_query($sql) or die ('<p>select died: ' . mysql_error());
$row = mysql_fetch_row($result);

echo $row['content'];

?>

dreamcatcher

6:39 pm on Aug 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi outdoorxtreme1,

mysql_fetch_row returns the array as a numerical indice only. Try using mysql_fetch_assoc or mysql_fetch_array. Alternatively you can do:

echo $row[0];

dc