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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.