![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello I have a htm with a URL new-links.php?id=4 The new-links.php code is as follows - but I get a syntax error reported "near out=out+1 WHERE ID=4". Any idea why?! Cheers Geoff ?php // Connects to your Database @require(dirname(__FILE__) . '/cgi-bin/config.php'); $id = $_GET['id']; mysql_connect($conf['sql']['host'], $conf['sql']['user'], $conf['sql']['pass']) or die(mysql_error()); mysql_select_db($conf['sql']['db']) or die(mysql_error()); //Adds to the click count for a particular link mysql_query("UPDATE links SET out=out+1 WHERE ID = $id")or die(mysql_error()); //Retrieves information $data = mysql_query("SELECT * FROM links WHERE ID = $id") or die(mysql_error()); $info = mysql_fetch_array($data); //redirects them to the link they clicked header( "Location:" .$info['URL'] ); ? |
#3
| |||
| |||
|
|
On 1/15/2011 2:15 PM, Geoff wrote: Hello I have a htm with a URL new-links.php?id=4 The new-links.php code is as follows - but I get a syntax error reported "near out=out+1 WHERE ID=4". Any idea why?! Cheers Geoff ?php // Connects to your Database @require(dirname(__FILE__) . '/cgi-bin/config.php'); $id = $_GET['id']; mysql_connect($conf['sql']['host'], $conf['sql']['user'], $conf['sql']['pass']) or die(mysql_error()); mysql_select_db($conf['sql']['db']) or die(mysql_error()); //Adds to the click count for a particular link mysql_query("UPDATE links SET out=out+1 WHERE ID = $id")or die(mysql_error()); //Retrieves information $data = mysql_query("SELECT * FROM links WHERE ID = $id") or die(mysql_error()); $info = mysql_fetch_array($data); //redirects them to the link they clicked header( "Location:" .$info['URL'] ); ? Out is a reserved word. |
![]() |
| Thread Tools | |
| Display Modes | |
| |