Jump to content

[SOLVED] Simple query won't work


Mutley

Recommended Posts

Is there any reason why this won't work?

 

<?php

$sql_three = "
	INSERT INTO `own` (own_id, user_id, prod_id, damage, loadout, market_id, slot) VALUES ('', '$user_id', '15', '0', '1', '0', '1'); 
	INSERT INTO `own` (own_id, user_id, prod_id, damage, loadout, market_id, slot) VALUES ('', '$user_id', '29', '0', '1', '0', '3'); 
	INSERT INTO `own` (own_id, user_id, prod_id, damage, loadout, market_id, slot) VALUES ('', '$user_id', '34', '0', '1', '0', '5')
";
mysql_query($sql_three);

?>

 

It only puzzles me because when I echo the SQL or copy the code and paste it into phpMyAdmin it works flawlessly.

 

Thanks,

Nick.

Link to comment
https://forums.phpfreaks.com/topic/107332-solved-simple-query-wont-work/
Share on other sites

<?php

$sql_three[]= "INSERT INTO `own` (own_id, user_id, prod_id, damage, loadout, market_id, slot) VALUES ('', '$user_id', '15', '0', '1', '0', '1');";
$sql_three[]= "INSERT INTO `own` (own_id, user_id, prod_id, damage, loadout, market_id, slot) VALUES ('', '$user_id', '29', '0', '1', '0', '3');";
$sql_three[]= "INSERT INTO `own` (own_id, user_id, prod_id, damage, loadout, market_id, slot) VALUES ('', '$user_id', '34', '0', '1', '0', '5');";

foreach ($sql_three as $key=>$value){
mysql_query($value);
}
?>

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.