Jump to content

syntax error in query


jeff5656

Recommended Posts

I get this error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'lines WHERE pt_id = '30'' at line 1

 

Unfortunately this says the syntax error is in line 1, so I don't know actually where the error is.

 

include "connectdb.php";
  		$id_incr=$row['id_incr'];
  		$query4 = "SELECT * FROM lines WHERE pt_id = '".$id_incr."' ";
	echo $query4;
	$srch = mysql_query ($query4) or die (mysql_error());

  		while ($row2 = mysql_fetch_assoc ($srch)) {

 

But when I comment out the $srch = line, the error goes away. 

When I echo out $query4, it echos out correctly.

Any ideas?  It's gotta be something obvious :-)

Link to comment
https://forums.phpfreaks.com/topic/191789-syntax-error-in-query/
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.