I have a little problem. I have some code that works great, but when the user deletes a certain item from another part of my site he automatically deletes the table used in this script until he assigns a new table to it.
So, basically I want the script to run only when the table it asks for is present and if it is not present I just want it to ignore this part of the script and carry on with the rest of the page.
PHP Code:
$connection = mysql_connect($host,$usr,$pwd);
$getcontent = mysql_db_query($db, "SELECT * from table_home where id='1'", $connection);
$row = mysql_fetch_array($getcontent);
$gigid = $row["gigid"];
if ($gigid >=1 ){
$todaysdate = date("Y-m-d");
$connection = mysql_connect($host,$usr,$pwd);
$getcontent = mysql_db_query($db, "SELECT * from table_$gigid WHERE date >= '$todaysdate' ORDER BY date asc", $connection)or die(mysql_error());
$row = mysql_fetch_array($getcontent);
$date = $row["date"];
$date1 = date("l dS F Y", strtotime($date) );
$venue = $row["venue"];
$address = $row["address"];
$time = $row["time"];
$tickets = $row["tickets"];
if ($date >= $todaysdate ){
$query = "EXPLAIN table_$gigid";
$result = @mysql_query($query);
if ($result){
echo "table exists code here";
} else {
echo "table does not exist code here";
}
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???