Jump to content

[SOLVED] Does mySQL automatically know the tables in a database?


Recommended Posts

Hi everyone,

 

Just a quick question if I may, I have a db 'DATA' and 6 or so tables named 'DATA' 'cat' 'images' 'user_id' .

 

Now ive made a form which inserts information fine in 'DATA' when I use

 

 include("../connect.php");
   mysql_connect("localhost","root","password");
   mysql_select_db("DATA");

 

Now im trying to insert data on other tables 'cat' for example and use the same query but does mySQL go through all the tables looking for that field in a db, or because I have a table called the same as the db 'DATA'

it finds that but not 'cat'

 

My other question is in my above code do I need to select_db and a table, if so any ideas as how I could?

 

Many thanks  ::)

 

 

edit: the main error I get is Unknown column 'location' in 'field list', which is clearly located in a table...

::)  Found the issue

 

my code connected to the database, but selecting the table is done when inserting the data using the query

 

 $query = "INSERT INTO DATA 

 

to

 

 $query = "INSERT INTO cat 

 

Maybe I was too quick to jump to the forum  :P

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.