•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 361,940 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,612 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 1365 | Replies: 38 | Solved
![]() |
when i set up the table it looked like this
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?
`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?
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 2,866
Reputation:
Rep Power: 7
Solved Threads: 206
No.. This is fine.. Nothing wrong with the table definition.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
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
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?
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?
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());
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 2,866
Reputation:
Rep Power: 7
Solved Threads: 206
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 ?
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
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.
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.
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 2,866
Reputation:
Rep Power: 7
Solved Threads: 206
Then you can truncate the table instead of dropping it and creating a new one ! mysql_query("Truncate table tablename"); will do the trick !
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 2,866
Reputation:
Rep Power: 7
Solved Threads: 206
I am glad your problem is solved now !
Thanks for that man ! I am in Netherlands at the moment, but my visa doesn't permit me to come to GB! Anyways, Cheers !
•
•
•
•
if you ever in Liverpool, England let me know i will take you out for a drink you deserve one.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
Similar Threads
Other Threads in the MySQL Forum
- Previous Thread: creating tables
- Next Thread: Queries and sub-queries



Linear Mode