MadnessRed Posted June 25, 2008 Share Posted June 25, 2008 Here is my code <?php // DB info $servername = "~"; $database = "~"; $username = "~"; $password = "~"; $prefix = "~"; // Rate info $id = $_POST["id"]; // Lets connect $con = mysql_connect($servername,$username,$password); if (!$con) { die('Could not connect: ' . mysql_error()); } // Lets select the database mysql_select_db("$database", $con); // Add the count $query1 = "UPDATE `madnessred_sites` SET `Visits` = `Visits` + 1 WHERE `ID` = '$id'"; mysql_query($query1, $con); // We need redirect the user. // First get the page to redirect to $result = mysql_query("SELECT `url` FROM `madnessred_sites` WHERE `ID` = '$id'"); //Now make the page while($row = mysql_fetch_array($result)) { echo '<html><head><title>Redirecting...</title><meta http-equiv="REFRESH" content="0;url='.$row['url'].'"></HEAD>'; echo '<body><center><a href="'.$row['url'].'"><h2>You will be redirected, if not, click here</h2></a></center></body></html>'; } // Now lets leave the database mysql_close($con); // DONE :-) ?> I don't see why its doesn't work, nothing gets added to the Visits in the database and if I press view source, the page shows as blank when i view it on the internet. Quote Link to comment Share on other sites More sharing options...
fenway Posted June 26, 2008 Share Posted June 26, 2008 Echo the sql statement... you sure you're getting the right $id? Quote Link to comment Share on other sites More sharing options...
MadnessRed Posted June 26, 2008 Author Share Posted June 26, 2008 The link is http://madnessred.co.cc/gotosite.sql.php?id=1 That should take me to the url which that refers to and add 1 to the count but it doesnt? Quote Link to comment Share on other sites More sharing options...
fenway Posted June 26, 2008 Share Posted June 26, 2008 Like I said, echo the $sql, make sure it's correct, and check for any mysql errors. Quote Link to comment Share on other sites More sharing options...
MadnessRed Posted June 26, 2008 Author Share Posted June 26, 2008 //Now make the page echo $query1; what should I be expecting? Quote Link to comment Share on other sites More sharing options...
PrettyHotProgrammer Posted June 26, 2008 Share Posted June 26, 2008 I have found that if there is an error anywhere in the page the page will come up blank it sounds like that is what is happening... i've found that this could be ANY error. Quote Link to comment Share on other sites More sharing options...
fenway Posted June 26, 2008 Share Posted June 26, 2008 //Now make the page echo $query1; what should I be expecting? You should be expecting an sql statement... I have found that if there is an error anywhere in the page the page will come up blank it sounds like that is what is happening... i've found that this could be ANY error. Then you don't have error reporting turned on. Quote Link to comment Share on other sites More sharing options...
br0ken Posted June 28, 2008 Share Posted June 28, 2008 When ever something goes wrong your first instinct should be to turn on errors! error_reporting(E_ALL ^ E_NOTICE); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.