Forum Moderators: coopster

Message Too Old, No Replies

how do i insert info into a mysql table

using php?

         

verb

7:00 pm on Jun 14, 2005 (gmt 0)

10+ Year Member



when trying to insert to a table info for a picture with a html link to another site on it i get the following error message:

counter INSERT error: 1064, You have an error in your SQL syntax near 'href=""www.mysite.com" target="_blank"><img src="/uploa' at line 1

the mysql code in my php script is below

$damn = '"<a href="www.mysite.com" target="_blnk"><img src="/uploads/mho.jpg" alt="We're here" /></a>"';
$c_insert = "INSERT INTO `timmy_config` VALUES ('pic4', $damn, 0)" or die('counter INSERT error: '.mysql_errno().', '.mysql_error());;

can someone tell me how i can get the image source and link sent to my table please?

Thanks in advance

maccas

7:18 pm on Jun 14, 2005 (gmt 0)

10+ Year Member



I can see one error, We're should be We\'re

mcibor

9:42 pm on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Moreover timmy shouldn't be in quotes and $damn should. And one colon on the end:

$c_insert = "INSERT INTO timmy_config VALUES ('pic4', '$damn', 0)" or die("counter INSERT error: ".mysql_errno().", ".mysql_error());

best with $damn use mysql_escape($damn); and then everything will be fine

Michal CIbor