Jump to content

Error in code.


dean7

Recommended Posts

Hi all, I have this piece of code which im using for my website but for a werid reason its saying the table that it selects the information out of doesnt exist when it does.

 

This is my code:

 

$locations = array('England','Japan','Colombia','Usa','South Africa','Mexico');
$i =0;
$count = count($locations);
while ($i < $count){
if ($i == "2"){ echo "<tr>"; }
$airport = mysql_fetch_object(mysql_query("SELECT * FROM airport WHERE location='$locations[$i]'"));
$ammo_hut = mysql_fetch_object(mysql_query("SELECT * FROM bf WHERE location='$locations[$i]'"));
$bank = mysql_fetch_object(mysql_query("SELECT * FROM bank WHERE location='$locations[$i]'"));
$people_in = mysql_num_rows(mysql_query("SELECT * FROM users WHERE location='$locations[$i]'"));
$dealer=mysql_fetch_object(mysql_query("SELECT * FROM dealership WHERE location='$locations[$i]'"));
$rest=mysql_fetch_object(mysql_query("SELECT * FROM rest WHERE location='$locations[$i]'"));
$casino_slots = mysql_fetch_object(mysql_query("SELECT * FROM casino WHERE location='$locations[$i]' AND type='Slots'")) or die (mysql_error()); // Line 168
$rest=mysql_fetch_object(mysql_query("SELECT * FROM rest WHERE location='$locations[$i]'"));
$casino_rps = mysql_fetch_object(mysql_query("SELECT * FROM casino WHERE location='$locations[$i]' AND type='RPS'")) or die (mysql_error());
$casino_race = mysql_fetch_object(mysql_query("SELECT * FROM casino WHERE location='$locations[$i]' AND type='Race'")) or die (mysql_error());
$bar = mysql_fetch_object(mysql_query("SELECT * FROM bar WHERE location='$locations[$i]'"));
$shop = mysql_fetch_object(mysql_query("SELECT * FROM shop WHERE location='$locations[$i]'"))  or die (mysql_error());

 

The error im getting is:

 

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/www/mafia-drift.co.cc/locations.php on line 168

Table 'deabot96_users.casino' doesn't exist

 

 

This isnt the full script, if needing to see it all ask :).

Thanks for your help.

Link to comment
https://forums.phpfreaks.com/topic/201113-error-in-code/
Share on other sites

You need to investigate what your actual table name is v.s. what is in your query and attempt to find what is different between the two.

 

You either have a spelling error, a capitalization difference (assuming you are on an operating system that is case-sensitive), or you have some non-printing or special characters as part of the table name.

Link to comment
https://forums.phpfreaks.com/topic/201113-error-in-code/#findComment-1055117
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.