whats wrong with this insert code?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
303tech
Forum Commoner
Posts: 31
Joined: Sun Mar 11, 2007 3:25 pm

whats wrong with this insert code?

Post by 303tech »

Code: Select all

[php]$id=$_GET['id'];

$insert="INSERT INTO customer (unitname, sec1, sec2, sec3, sec4, sec5, sec6, ip) SELECT ('$replace', '$sec1', '$sec2', '$sec3', '$sec4', '$sec5', '$sec6', '$ip') WHERE id=$id";
mysql_query($insert);[/php]
i cant seem to figure this one out
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

try

Code: Select all

$id=$_GET['id'];

$insert="INSERT INTO customer (unitname, sec1, sec2, sec3, sec4, sec5, sec6, ip) SELECT ('$replace', '$sec1', '$sec2', '$sec3', '$sec4', '$sec5', '$sec6', '$ip') WHERE id=$id";
echo '<div>Debug: ', htmlentities($insert), "</div>\n";
mysql_query($insert) or die(mysql_query());
Post Reply