getting this error submitting a form
Posted: Sun Jan 11, 2009 3:48 pm
im getting this error
Warning: Invalid argument supplied for foreach() in /mounted-storage/home74b/sub009/sc42562-IQUU/www/truthdare/Game/functions.php on line 4
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
please help
christine xxx
Warning: Invalid argument supplied for foreach() in /mounted-storage/home74b/sub009/sc42562-IQUU/www/truthdare/Game/functions.php on line 4
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Code: Select all
<?php
function create_game($playername, $sex) {
if($_POST) {
foreach($_POST['player'] as $post_key) {
$query_string .= " ('".$post_key['sex']."', '".$post_key['playername']."'),";
}
$query_string = substr_replace($query_string,"",-1);
// store the information in the database
$query = "INSERT INTO `game` (`playername`, `sex`) values $query_string";
$result = mysql_query($query) or die(mysql_error());
// if suceesfully inserted data into database, send confirmation link to email
if($result) {
header('Location: http://www.pinkangel4u.com/truthdare/Ga ... board.php');
}
}}
?> christine xxx