Jump to content

Recommended Posts

I keep getting a mySql error, but I have no idea why, can someone help me look for the error?

 

This is the Error:

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 '1, 2, 3, 4, 5, 6, 7, 8) VALUES ('Lamez', 'a', 'Louisville', 'Ohio St.', 'Utah', ' at line 1

 

 

<?php
mysql_query("INSERT INTO `basket_rnd1` (user, region, 1, 2, 3, 4, 5, 6, 7,  VALUES ('".$user_."', '".$x."', '".$a."', '".$b."', '".$c."', '".$d."', '".$e."', '".$f."', '".$g."', '".$h."')") or die(mysql_error());
?>

 

Whole Code:

<?php
ob_start();
$path = "../../";
$title = "Basketball Bracket";
$rank = "yes";
$u_login = "yes";
include ($path."main/include/cons/head.php"); 
$y = $_SESSION['xz'];
$end = "endRnd_on";
$end2 = "endRnd_on2";
$end3 = "endRnd_on3";
$end4 = "endRnd_on4";

if($y == $end || $y == $end2 || $y == $end3 || $y == $end4){

	if($y == $end){ 
		$region = 1; $x = "a"; $re = "b";

	} else if($y == $end2){ 
		$region = 2; $x = "b"; $re = "c";

	}else if($y == $end3){
		$region = 3; $x = "c"; $re = "d";

	}else if($y == $end4){ 
		$region = 4; $x = "d"; $re = "e";
	}else{ 
		header("Location: ?yyz=r112d"); 
	}
	$a = $_POST['1'];
	$b = $_POST['2'];
	$c = $_POST['3'];
	$d = $_POST['4'];
	$e = $_POST['5'];
	$f = $_POST['6'];
	$g = $_POST['7'];
	$h = $_POST['8'];

	$i = $_POST['9'];
	$j = $_POST['10'];
	$k = $_POST['11'];
	$l = $_POST['12'];

	$m = $_POST['13'];
	$n = $_POST['14'];

	$o = $_POST['15'];
	mysql_query("INSERT INTO `basket_reg` (id, name) VALUES ('1','A')")or die(mysql_error());


	mysql_query("INSERT INTO `basket_rnd1` (user, region, 1, 2, 3, 4, 5, 6, 7,  VALUES ('".$user_."', '".$x."', '".$a."', '".$b."', '".$c."', '".$d."', '".$e."', '".$f."', '".$g."', '".$h."')") or die(mysql_error());
	mysql_query("INSERT INTO `basket_rnd2` (user, region, 9, 10, 11, 12) VALUES ('".$user_."', '".$x."', '".$i."', '".$j."', '".$k."', '".$l."')") or die(mysql_error());
	mysql_query("INSERT INTO `basket_rnd3` (user, region, 13, 14) VALUES ('".$user_."', '".$x."', '".$m."', '".$n."')") or die(mysql_error());
	mysql_query("INSERT INTO `basket_rnd4` (user, region, 15) VALUES ('".$user_."', '".$x."', '".$o."')") or die(mysql_error());
	header("Location index.php?region=".$re); 
}else{
echo "ERROR!";
}
?>
<?php
include ($path."main/include/cons/foot.php");
?>

 

Any Ideas?

 

Thanks Guys

Link to comment
https://forums.phpfreaks.com/topic/149712-solved-need-fresh-eyes-error/
Share on other sites

I think it's a a problem with the value of $d, are there any special character or anything?

 

You don't have to break in and out of PHP it will interpolate with just:

 

('$user_', '$x', etc...

 

You should also be using mysq_real_escape_string() on all your values.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.