I experienced this problem when im retrieving data in mysql database. It is my 1st time to use select statement in php. I've read in some tutorial in the net that, mysql_fetch_array() can retrieve your data from database. But now i used this --> @mysql_fetch_array(); and it worked. I am using php 5 and the newest mysql version. This is my code:
if the code below gives you some error, try my 2nd code
$result = mysql_query("SELECT * FROM customer WHERE c_id = '$id'");
if(!$result)
{
die(mysql_error());
}
while($row = mysql_fetch_array($result))
{
echo $row['c_id'];
echo $row['c_comment'];
echo $row['c_name'];
}
At the end, this is my 2nd code:
$result = mysql_query("SELECT * FROM customer WHERE c_id = '$id'");
if(!$result)
{
die(mysql_error());
}
while($row = @mysql_fetch_array($result))
{
echo $row['c_id'];
echo $row['c_comment'];
echo $row['c_name'];
}
Friday, February 13, 2009
Retrieving fields in mysql using php
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment