Jump to content

tablename curious


zgkhoo

Recommended Posts

if you are using gender as an identifier for a table then you have made you database structure to obscure to be useful...

 

something liek gender shuld be a field in a table so you can filter out resutls based on that criteria...

 

obviously I don't know what your tables look like BUT that is the impression I get..

 

the alternative is to use the setting in teh query...

 

$qry = "INSERT INTO `" . $gender . " .....";

Link to comment
https://forums.phpfreaks.com/topic/77936-tablename-curious/#findComment-394481
Share on other sites

Try this

<?php
$sLocalHost="localhost";
$sLocalUser ="root";
$sLocalPassword ='';
$sLocalDatabaseName ="abcdefgh"; //change here
$conn = mysql_connect($sLocalHost,$sLocalUser,$sLocalPassword);
$db=mysql_select_db($sLocalDatabaseName);
if($conn=="")
{
  trigger_error('Unable to connect to database: ' . mysql_error());
}
// show the tables
$sql = "SHOW TABLES";
$result = mysql_query($sql);

if (!$result) {
    echo "DB Error, could not list tables\n";
    echo 'MySQL Error: ' . mysql_error();
    exit;
}

while ($row = mysql_fetch_row($result)) {
    echo "Table: {$row[0]}\n";
}

mysql_free_result($result);

?>

Link to comment
https://forums.phpfreaks.com/topic/77936-tablename-curious/#findComment-394908
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.