HI
could someone please have a look at my php code please
i will explain what i want the code to do
$query = sprintf("SELECT * FROM thegame ",
mysql_real_escape_string($start));
$result = mysql_query($query);
// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "
";
$message .= 'Whole query: ' . $query;
die($message);
}
while ($row = mysql_fetch_assoc($result)) {
$start= $row['start'];
}
// Perform Query
$result = mysql_query($query);
$returnVars = array();
$returnVars['start'] = "$start";
$returnString = http_build_query($returnVars);
if ($start == 0) {
$num = $_POST['num'];
$num = 0;
$res = mysql_query('SELECT num FROM randnumber WHERE called = 1 ORDER BY RAND() LIMIT 1');
if(1 === mysql_num_rows($res)){
$row = mysql_fetch_assoc($res);
mysql_query(sprintf('UPDATE randnumber SET called = 0 WHERE num = %d LIMIT 1',
$row['num']));
$num = $row['num'];
}
mysql_query("UPDATE thegame SET start= 1 ");
if (@mysql_query($sql1)) {
}
$sql = mysql_query("INSERT INTO tempnum (num,called)
VALUES('$num',1)")
or die (mysql_error());
exit();
}
if ($start == 1) {
$res = mysql_query('SELECT num FROM tempnum WHERE called = 1 LIMIT 1');
if(1 === mysql_num_rows($res)){
$row = mysql_fetch_assoc($res);
mysql_query(sprintf('UPDATE tempnum SET called = 0',
$row['num']));
$num = $row['num'];
}
printf('num=%d', $num);
exit();
}
the problem is with this bit of code
mysql_query("UPDATE thegame SET start= 1 ");
if (@mysql_query($sql1)) {
if i put this bit of code at the bottom of the main code above my code doesent work like it should.
mysql_query("UPDATE thegame SET start= 0 ");
if (@mysql_query($sql1)) {
but if i go into my database and open thegame table and manually change the 1 to 0 it works great but as soon as i put my update query in my code it doesn’t work, it is updating the table ok, so it is updating, its just my game wont work unless i keep updating the database manually.
could someone help me here been on this a long time. i will post more info if required.
thankyou,