MySQL Forums
Forum List  »  Newbie

Re: Will this return a value?
Posted by: Jay Pipes
Date: June 26, 2005 08:23PM

Neither. mysql_query() returns a resource identifier, which you can then use with mysql_fetch_array() or mysql_fetch_row(), or false if there was an error, which there will be with your code.

Try:

$sql = "SELECT prod_title FROM products WHERE prod_id = '" . $array['spec_prod_id'] . "'";
if ($result = mysql_query($sql)) {
$row = mysql_fetch_array($result);
echo 'Title: ' . $row['prod_title'];
}
else {
echo 'Error: ' . mysql_error();
}

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Written By
Posted
June 26, 2005 08:03PM
Re: Will this return a value?
June 26, 2005 08:23PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.