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.

Check your database if the table is there by using some GUI or command line.

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());

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


Matti Ressler
Suomedia

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.

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

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.