First, let's break everything down. I have, thus far, bus, taxi, car -- Must have ONE of these to travel from city to city. Each one have their own table in the database:
Bus:
Code: Select all
$sql = "SELECT * from bususerbdlg WHERE playerid ='$_SESSION[userid]' LIMIT 1";
Code: Select all
$sql = "SELECT * from taxiuserbdlg WHERE playerid ='$_SESSION[userid]' LIMIT 1";
Code: Select all
$sql = "SELECT * from caruserbdlg WHERE playerid ='$_SESSION[userid]' LIMIT 1";
Problem is, is I need to be able to verify that each user has at least ONE of the above in order for them to travel to the next location. Now, if the user has already click on one of the above and started the countdown timer to build each one, then there is no problem, as the row is inserted into the table, so the error messages work just fine. It's BEFORE they click on one to build them, is where the problem is.
If I put this, and the rows are there, it works:
Code: Select all
if ($owned_bus != 1) {
$error_mess = "<span id='errormess'><big><left><font color='red'><b>You must first have transportation to travel here!</b></center></span></big></font>";
}
if ($owned_taxi != 1) {
$error_mess = "<span id='errormess'><big><left><font color='red'><b>You must first have transportation to travel here!</b></center></span></big></font>";
}
What I need is either a way to rewrite these to combine them into one table, or a snippet of code that will check each table to check and notice a row is not yet in the table with their user id.... It needs to check if they have one of the above AND check that a row does exist or not, or they can't travel.
Thanks!