Jump to content

Query with variable


Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/1819-query-with-variable/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.