What I want to do is too allow people to check for table of their choice, by way of a form. So basically I just want to substitute $table for $var. How do I do this?
Code: Select all
<?php
$var = $_POST[name];
function table_exists($table, $database) {
mysql_connect('localhost', 'username', 'password') or die(mysql_error());
mysql_select_db(techtac2_rsstats) or die(mysql_error());
if (mysql_query("SELECT 1 FROM `".'$table'."` LIMIT 0")) {
return true;
}
else {
return false;
}
}
if (table_exists('table_name', 'database_name')) {
echo "User $name already exists\n";
}
else {
echo"my bad";
}
?>