0

If you read an earlier thread i started i was having completely the opposite problem that i am having now. Before it kept telling me that the table already existed and now it tells me the table does not exist.

I have created the table in the db.php page where all the connections and database is set up the code i have used for creating the table looks like this

mysql_select_db("$database_name", $connection);
		$sql="CREATE TABLE `broad_images` (
			`ID` int NOT NULL auto_increment,
			`broad1` varchar(100),
			`broad2` varchar(100)
		)";

and when i try to get some data out of the table it tells me the table has not been created where is it wrong. the code i have used is no different than before i dont think the computer likes me.

3
Contributors
7
Replies
8
Views
9 Years
Discussion Span
Last Post by kevin wood
0

my code now looks like this and i am back where i started as it is telling me the table already exists.

mysql_select_db($database_name, $connection);
		$sql="CREATE TABLE `broad_images` (
			
			`broad1` varchar(100),
			`broad2` varchar(100)
		)";	
		mysql_query($sql) or die (mysql_error());
0

The table already exists. Your latest code is correct (the other you had "$database_name" in quotes, which is incorrect).


Matti Ressler
Suomedia

0

i thought the code was correct the " " were in by mistake i was trying it with them in to see if that made a difference which it did not. i am still getting the error table already exists.

0

Are you using the same mysql username with PHP and with GUI to confirm the table existance? May be they have rights issue.

0

i am a bit unsure of what you mean sorry if i sound a bit thick. the username is the same throught and the connection to the database is a permanent connection. the table am i trying to create is being set up on the same page the initial connection is made with the server so the user name could not be any different if that is what you meant.

0

i am gone for the weekend now but if anyone knows how to fix this problem please feel free to help i will be looking back here on monday morning.

I have tried changing the name of the table and no matter what the name is changed to it brings back the same result that the table already exists.

could it be a problem with as the table is being created at the same time another page is trying to access the table, or the table is being created when the db.php page is access the first time and when i come to place data into it, it tries to create the table again.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.