Hi,
I’m new to PHP and trying to do a simple INSERT query. So far I have:
[php]
$sql=“INSERT INTO quest_template
VALUES (’$id’, ‘2’, ‘$lvl’, ‘$lvl_min’, ‘0’, ‘0’, ‘0’, ‘0’, ‘$time’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘$prev’, ‘0’, ‘0’, ‘0’, ‘7’, ‘$rewgold’, ‘$rewgold’, ‘0’, ‘0’, ‘$rewhonor’, ‘1’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘$rewtitle’, ‘0’, ‘0’, ‘$rewarena’, ‘$rewitem1’, ‘$rewitem2’, ‘0’, ‘0’, ‘$rewitem1amt’, ‘$rewitem2amt’, ‘0’, ‘0’, ‘$rewchoice1’, ‘$rewchoice2’, ‘$rewchoice3’, ‘$rewchoice4’, ‘$rewchoice5’, ‘$rewchoice6’, ‘$rewchoice1amt’, ‘$rewchoice2amt’, ‘$rewchoice3amt’, ‘$rewchoice4amt’, ‘$rewchoice5amt’, ‘$rewchoice6amt’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘$title’, ‘$objectives’, ‘$details’, null, ‘$complete’, ‘$incomplete’, null, ‘$reqkill1’, ‘0’, ‘0’, ‘0’, ‘$reqkill1amt’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘$reqitem1’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘$reqitem1amt’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘’, ‘’, ‘’, ‘’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘12340’);”;
$result = mysql_query($sql);
if($result){
header(“Location: success_quest.php”);
}
else {
echo “ERROR”;
}
[/php]
So that query runs without any problems. However I need to run three insert queries at the same time. I believe there’s a function like “multi_query”. However then I would have a problem with giving a success page if all 3 queries ran ok?
When I add the following code I only get errors:
[php]INSERT INTO creature_questrelation
VALUES (’$start’, ‘$id’); INSERT INTO creature_involvedrelation
VALUES (’$end’, ‘$id’); [/php]
Just to be clear the final query looks like this:
[php]
$sql="INSERT INTO quest_template
VALUES (’$id’, ‘2’, ‘$lvl’, ‘$lvl_min’, ‘0’, ‘0’, ‘0’, ‘0’, ‘$time’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘$prev’, ‘0’, ‘0’, ‘0’, ‘7’, ‘$rewgold’, ‘$rewgold’, ‘0’, ‘0’, ‘$rewhonor’, ‘1’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘$rewtitle’, ‘0’, ‘0’, ‘$rewarena’, ‘$rewitem1’, ‘$rewitem2’, ‘0’, ‘0’, ‘$rewitem1amt’, ‘$rewitem2amt’, ‘0’, ‘0’, ‘$rewchoice1’, ‘$rewchoice2’, ‘$rewchoice3’, ‘$rewchoice4’, ‘$rewchoice5’, ‘$rewchoice6’, ‘$rewchoice1amt’, ‘$rewchoice2amt’, ‘$rewchoice3amt’, ‘$rewchoice4amt’, ‘$rewchoice5amt’, ‘$rewchoice6amt’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘$title’, ‘$objectives’, ‘$details’, null, ‘$complete’, ‘$incomplete’, null, ‘$reqkill1’, ‘0’, ‘0’, ‘0’, ‘$reqkill1amt’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘$reqitem1’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘$reqitem1amt’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘’, ‘’, ‘’, ‘’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘12340’); INSERT INTO creature_questrelation
VALUES (’$start’, ‘$id’); INSERT INTO creature_involvedrelation
VALUES (’$end’, ‘$id’); ";
$result = mysql_query($sql);
if($result){
header(“Location: success_quest.php”);
}
else {
echo “ERROR”;
}
[/php]
Thank you for you time!
/Cuana