Jump to content

[SOLVED] ending a query with the correct syntax problem


glennn.php

Recommended Posts

i'm using several variables in a query:

 

$result = mysql_query("SELECT fice FROM characteristics WHERE offering IN ($offering_sql) AND ".$public_private_sql." AND ".$twofour_sql."");

 

but where the last condition in the query is a variable, i'm getting errors no matter how i close it:

 

AND ".$twofour_sql."");

AND ".$twofour_sql");

etc...

 

can someone kindly show me how to close this?

 

thanks so much.

GN

Link to comment
Share on other sites

You should create your queries as string variables so you can echo them to the page when they fail for debugging purposes! And put an on die() handler on there to see what the error is.

 

$query = "SELECT fice
         FROM characteristics
         WHERE offering IN ($offering_sql)
           AND $public_private_sql
           AND $twofour_sql";
$result = mysql_query($query) or die("Error:<br />".mysql_error()."<br />Query:<br />$query");

Link to comment
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.