Jump to content


Photo

Query with variable


  • Please log in to reply
No replies to this topic

#1 ongsoowee

ongsoowee
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 29 April 2004 - 06:16 PM

I try to write a query inside Dreamweaver but it kept returning me empty results. However I am sure this query should return me a result (It was successful when I replace the two variable '$result_1' and '$pattern_id' with the actual value.) Is it possible to use query with variables? Where did I go wrong?


$sql_2= mysql_query("SELECT body_id FROM body WHERE pattern_id = '$pattern_id' AND bodyColorset_id = '$result_1'");
$num_rows = mysql_num_rows($sql_2);
if($num_rows == 0){
echo "error in body set......";
}
else{
while($row=mysql_fetch_array($sql_2)){
$result_2 = $row["body_id"];
}#END OF WHILE LOOP
}#END OF IF_ELSE LOOP

Thank you for your attention.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users