$putitemin = "INSERT INTO catitem (catitemid,catitemname,catitemdesc,catitemimg,catitemimg_tn,catitemactive,catcategoryid) VALUES ('".$itemid."','".$itemname."','".$desc."','".$fullimage."','".$fullthumb."','".$itemstatus."',".$category.")";
mysql_db_query($database, $putitemin);
I have three questions.
- Does a varibable have to all be defined on one line? For example, could I also define $putitemin to be more readable:
$putitemin = "INSERT INTO catitem (
catitemid,
catitemname,
catitemdesc,
catitemimg,
catitemimg_tn,
catitemactive,
catcategoryid)
VALUES (
'".$itemid."',
'".$itemname."',
'".$desc."',
'".$fullimage."',
'".$fullthumb."',
'".$itemstatus."',
".$category.")";
- When inputing data, if there is an apostraphe in the data, the insert does not work. For example, if I enter
"It's a wonderful life" for $desc, the insert does not occur.
How do I remedy this problem?
- Currently, I have no way of knowing if an insert fails. Is there a way that I can be notified if the insert fails?