McMaster Posted April 24, 2010 Share Posted April 24, 2010 I have a MySQL query that is having problems. I have a variable called $product_id and I am trying to put it in to the query but it's not showing in the database. This is the query: mysql_query("INSERT INTO inbox VALUES('$from','$from_buyer','<a href=\"read_messages.php?id=$product_id \">link</a>' )"); In the database it just shows: <a href=\"read_messages.php?id= Any help appreciated here. Thanks guys! Link to comment https://forums.phpfreaks.com/topic/199624-php-mysql-problem/ Share on other sites More sharing options...
mattal999 Posted April 24, 2010 Share Posted April 24, 2010 You forgot a ' after the product id part. It should be: mysql_query("INSERT INTO inbox VALUES('','".$from."','".$from_buyer."','<a href=\"read_messages.php?id=".$product_id."\"')"); Link to comment https://forums.phpfreaks.com/topic/199624-php-mysql-problem/#findComment-1047777 Share on other sites More sharing options...
McMaster Posted April 24, 2010 Author Share Posted April 24, 2010 Okay, that never worked. I narrowed the query down a bit. Here is the query here: mysql_query("INSERT INTO inbox VALUES('','$from','$from_buyer','<a href=\"read_messages.php?id=".$product_id."\" name=\"&lid=//Message Center//Message List//Message Title\" style=\"text-decoration: none;\">Question Answered</a></span><span class=\"small\" style=\"color: rgb(102, 102, 102);\"><br>$comment</span>','$comment','$date','0','0','$product_id','1','$from_buyer')"); Link to comment https://forums.phpfreaks.com/topic/199624-php-mysql-problem/#findComment-1047783 Share on other sites More sharing options...
Pikachu2000 Posted April 24, 2010 Share Posted April 24, 2010 Separate your query string from the query statement so you can debug it more easily. $query = "QUERY STRING HERE"; echo $query; mysql_query($query) or die( mysql_error() ); Link to comment https://forums.phpfreaks.com/topic/199624-php-mysql-problem/#findComment-1047789 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.