too long

This question already has an answer here:

i am creating a admin panel of a site.when admin enter a category , a table of same category name is create in database, fields are all table are same.. in starting admin enter a lot of category..then how can i check that a table is already created in database..because all tables are empty. for that

i am trying this code

     <?php $con = mysql_connect("localhost","root","");
     if (!$con)
     {die('Could not connect: ' . mysql_error());}
   $sql="SELECT * FROM admin";//(for trial im a changing the name manuaaly)

    $result=@mysql_query($sql);

  if (!$result)

      {
        echo "No table exists";
     }
      else
      {
     echo "yes";
     }
    ?>

but in this its always show "no table exists", if table is in the db.. how can i solve this..

</div>

Do not create a separate table for each category!
Make it one, with all the set of fields and one with category name (or a category id, depends on the database schema).

That's the very basics of how databases works.

Thus you will have to just run a regular query to check if such category name already exists:

SELECT id FROM categories WHERE name = 'name to check';

Take a look at the INFORMATION_SCHEMA schema, specifically the TABLES table.

IE:

SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = `admin_table_name`;