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

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");

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.