When I run my php file it outputs:
ERROR: Could not fetch results,
I do not understand why though, I used this exact code in other files and it works fine.
Code:
<?php
$mysql = mysql_connect('localhost','root','password') or die('ERROR: Could not connect, ' . mysql_error($mysql));
mysql_select_db('twp',$mysql) or die('ERROR: Could not connect, ' . mysql_error($mysql));
$q = mysql_query("SELECT * FROM DenCrypt_Users",$mysql) or die('ERROR: Could not lookup users, ' . mysql_error($mysql));
if(!$q)
{
die('ERROR: Could not lookup users, ' . mysql_error($mysql));
}
while($row[] = mysql_fetch_assoc($q))
{
$lp[] = $row['lastPing'];
$usr[] = $row['usr'];
for($i = 0; $i < count($usr);$i++)
{
if($lp[$i] + 180 >= time())
{
$q = mysql_query("UPDATE DenCrypt_Users SET online='Offline' WHERE usr='$usr[$i]'") or die('ERROR: Failed to update user, ' . mysql_error($mysql));
}
}
}
?>
I have ran the same query on phpmyadmin and it works. Why isn't php fetching the data?