0

when i set up the table it looked like this

`id` INT NOT NULL AUTO_INCREMENT,
`broad1` varchar (250) not null,
`broad2` varchar(250) not null,
primary key (id)

so when i set the where clause to id=1 then this should be correct should? or have i set the table up wrong?

do i need to set id as the primary key?

0

the problem i am having with the tables is that the data inside them is getting duplicated each the user enters a new image and it is then displaying the images more than once on the screen. could i get round this with the following code

IF EXISTS(SELECT TABLE_NAME)
   DROP TABLE_NAME
GO
CREATE TABLE_NAME ( column_1 int, column_2 varchar(30))
INSERT T1 (column_2, column_1) VALUES ('Row #1',1)

each time the user will access the pages that interact with the table they will first delete the table and create the table again thus creating a empty table each time data needs to be entered into it?

0

would this be the correct code to use t drop the table and then create the table after it has been dropped.

IF EXISTS DROP TABLE images_tad;
			
$sql="CREATE TABLE IF NOT EXISTS `images_tad` (
`id` INT NOT NULL AUTO_INCREMENT,
`tad1` varchar (250) not null,
`tad2` varchar(250) not null,
`tad3` varchar(250) not null,
`tad4` varchar(250) not null,
`tad5` varchar(250) not null,
primary key (id)
)";	
mysql_query($sql) or die (mysql_error());
0

Do you want only 1 image to be inserted at a time for all the users ? That is, if user A uploads an image, then delete the table, create the table again, insert the values to the table. Then if user B uploads an image, again, delete the table, create the table again and insert the values to the table ? If thats the case, why not truncate the table instead of dropping it ?

0

i was looking at the truncate table command but it is just as easy to do either i think and it would have the same outcome would it not.

if i create a page which deletes the tables and only include this once at the top of the first upload page this should in theory give the user a new tanble each time they want to start uploading the new images.

the data does not need to be kept in the tables as each time the user will be using it it will be sending out a new e-mail with new images attached to it.

1

Then you can truncate the table instead of dropping it and creating a new one ! mysql_query("Truncate table tablename"); will do the trick !

Votes + Comments
if you need help with php/mysql he is your man
0

that is working like a dream now thanks for all your help with this it would have been very hard without your help.

if you ever in Liverpool, England let me know i will take you out for a drink you deserve one.

0

I am glad your problem is solved now !

if you ever in Liverpool, England let me know i will take you out for a drink you deserve one.

Thanks for that man ! I am in Netherlands at the moment, but my visa doesn't permit me to come to GB! Anyways, Cheers !

This question has already been answered. 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.