Jump to content

[SOLVED] What's wrong with this query?


jim.davidson

Recommended Posts

OOps forgot,

I'm running mySql ver 4.1.21

I'm running this through dreamweaver

 

I get this error but don't see the problem

 

Parse error: parse error, unexpected T_STRING

 

If I remove this section of code, I have no problem

 

mysql_select_db($database_imcrecycle, $imcrecycle);

$query_getCustomerId = "SELECT customers.customer_id FROM customers WHERE customers.state_id="ZZ"";

$getCustomerId = mysql_query($query_getCustomerId, $imcrecycle) or die(mysql_error());

$row_getCustomerId = mysql_fetch_assoc($getCustomerId);

$totalRows_getCustomerId = mysql_num_rows($getCustomerId);

 

Another thing, why can't I see an earlier post of mine. I posted a question about an hour and a half ago and I can't find it?

Link to comment
Share on other sites

 

You need to escape the double quotes within the double quotes.

 

$query_getCustomerId = "SELECT customers.customer_id FROM customers WHERE customers.state_id="ZZ"";

...should be either...

$query_getCustomerId = "SELECT customers.customer_id FROM customers WHERE customers.state_id=\"ZZ\"";  // escaped double quotes

...or...

$query_getCustomerId = "SELECT customers.customer_id FROM customers WHERE customers.state_id='ZZ'";  // single quotes

...or even...

$query_getCustomerId = 'SELECT customers.customer_id FROM customers WHERE customers.state_id="ZZ"';

 

(Your other post is in PHP Help.)

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.