Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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