Jump to content

I Can't See It


george
 Share

Recommended Posts

if ($num_rows == 0) {	 $query = "INSERT INTO VistngIPs (addy_id, count_em, site, referingURL, Name) VALUES  ('".$ip."','1','".$site."','".$referingURL."','".$Name."')";	 $result = mysql_query($query) or die('Query failed: ' . mysql_error());	}

Can you see my error?

Link to comment
Share on other sites

if ($num_rows == 0) {	 $query = ("INSERT INTO VistngIPs (addy_id, count_em, site, referingURL, Name) VALUES  ('$ip','1','$site','$referingURL.','$Name'");	 $result = mysql_query($query) or die('Query failed: ' . mysql_error());	}

You code different so I am not sure if this will work.

Edited by kirbyweb
Link to comment
Share on other sites

Have you checked every variable is written with the correct cases? $Name for example stands out, as your tendency seems to be to start with a lower case letter. Are you sure the problem isn't in the preceding or subsequent section?

Link to comment
Share on other sites

The error I get with what you gave me is[18-Nov-2009 01:36:51] PHP Parse error: syntax error, unexpected ')' in /home2/getfit/public_html/countmein.php on line 28

$query = ("INSERT INTO VistngIPs (addy_id, count_em, site, referingURL, Name) VALUES  ('$ip','1','$site','$referingURL.','$Name'");

I thought I needed another ) at the end of my string.

$query = ("INSERT INTO VistngIPs (addy_id, count_em, site, referingURL, Name) VALUES  ('$ip','1','$site','$referingURL.','$Name')");

But now I get an [18-Nov-2009 01:36:51] PHP Parse error: syntax error, unexpected ')' in /home2/getfit/public_html/countmein.php on line 28

Link to comment
Share on other sites

Opps, wrong error message. Now I get no error message, neither does it work. Previous variable code which could have an effect,

	if (isset($_POST['Name'])) { $Name = $_POST['Name']; } else { $Name = ''; }	if (isset($_POST['referingURL'])) { $referingURL=$_POST['referingURL']; } else { $referingURL='';}

I was hoping this would fix for the non existant referingURL, maybe not though?

Link to comment
Share on other sites

	$ip = $_SERVER['REMOTE_ADDR'];		$site = gethostbyaddr($_SERVER['REMOTE_ADDR']);	$Name = $_POST['Name'];	$referingURL = $_POST['referingURL'];	if ($referingURL==NULL) {$referingURL = '';}	$link = mysql_connect($db_server, $db_user, $db_passwd);	if (!$link) {		die('Could not connect: ' . mysql_error());	}	mysql_select_db($db_name, $link) or die('Could not select database');	$query = "SELECT * FROM VistngIPs WHERE addy_id = '".$ip."'";	$result = mysql_query($query) or die('Query failed: ' . mysql_error());	$num_rows = mysql_num_rows($result);	if ($num_rows == 0) {//		$query = "INSERT INTO VistngIPs (addy_id, count_em, site, referingURL, Name) VALUES ('".$ip."','1','".$site."','".$referingURL."','".$Name."')";// $query = "(INSERT INTO VistngIPs (addy_id, count_em, site, referingURL, Name) VALUES  ('$ip','1','$site','$referingURL.','$Name')");//$query = ("INSERT INTO VistngIPs (addy_id, count_em, site, referingURL, Name) VALUES  ('$ip','1','$site','$referingURL.','$Name'");$query = ("INSERT INTO VistngIPs (addy_id, count_em, site, referingURL, Name) VALUES  ('$ip','1','$site','$referingURL.','$Name')");		$result = mysql_query($query) or die('Query failed: ' . mysql_error());	} 		if ($num_rows >= 1) { 		$query = "UPDATE VistngIPs SET count_em = count_em + 1 WHERE addy_id = '".$ip."'";		$result = mysql_query($query) or die('Query failed: ' . mysql_error());	} 	mysql_free_result($result);	mysql_close($link);// }	?>

Edited by george
Link to comment
Share on other sites

It looks like you're using single line comments: // to try to comment out code with a line break in it. That'll cause unexpected T_ whatever.

Link to comment
Share on other sites

If I remove referringURL and Name from the query, it works fine. referringURL and Name are passed (or should be) using AJAX to the code provided, and the referringURL value is NULL. I removed all comments. When I add back referringURL and Name, the error reappears

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...