Master Summoner
- Joined
- Oct 9, 2008
- Messages
- 572
- Reaction score
- 14
- And I can't see anything that goes wrong. Well, I've been trying for the past 10 minutes to figgure the error out, but I'm not getting anything. Heres my script:
Any help is very appreciated!
*Updates script, but still not working.
PHP:
<?php
session_start();
$my_host = 'localhost';
$my_user = 'root';
$my_pass = 'root';
$my_scheme = 'user_settings';
$my_table = 'settings';
$ip = $_SERVER['REMOTE_ADDR'];
if (!$_GET['width'] && !$_GET['heigth']){
Header('Location:./settings.php');
}
if ($_GET['width'] && $_GET['heigth']){
$_SESSION['w'] = mysql_real_escape_string($_GET['width']);
$_SESSION['h'] = mysql_real_escape_string($_GET['heigth']);
$screen_width = $_SESSION['w'];
$screen_heigth = $_SESSION['h'];
$con = mysql_connect($my_host,$my_user,$my_pass) or die(mysql_error());
mysql_select_db($my_scheme) or die(mysql_error());
$sql = array("SELECT * FROM $my_scheme
WHERE ip = '$ip'",
"INSERT INTO $my_table
VALUES ('','$ip','$screen_width','$screen_heigth');",
"UPDATE $my_table
SET screen_width = '$screen_width', screen_heigth = '$screen_heigth'
WHERE ip = '$ip'");
$result[0] = mysql_query($sql[0]);
$rowcount = mysql_num_rows($result[0]);
if($rowcount == 1) {
$result[1] = mysql_query($sql[2]) or die(mysql_error());
}
else if ($rowcount = 0) {
$result[2] = mysql_query($sql[1]) or die(mysql_error());
}
mysql_close($con);
}
?>
Any help is very appreciated!
*Updates script, but still not working.