RSS Forums RSS
Please support our MySQL advertiser: Programming Forums
Views: 2172 | Replies: 38 | Solved
Reply
Join Date: Feb 2008
Posts: 312
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

Re: display image from databse

  #31  
Apr 2nd, 2008
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?
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 240
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: display image from databse

  #32  
Apr 2nd, 2008
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*
Reply With Quote  
Join Date: Feb 2008
Posts: 312
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

Re: display image from databse

  #33  
Apr 3rd, 2008
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?
Reply With Quote  
Join Date: Feb 2008
Posts: 312
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

Re: display image from databse

  #34  
Apr 3rd, 2008
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());
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 240
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: display image from databse

  #35  
Apr 3rd, 2008
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*
Reply With Quote  
Join Date: Feb 2008
Posts: 312
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

Re: display image from databse

  #36  
Apr 3rd, 2008
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.
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 240
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: display image from databse

  #37  
Apr 3rd, 2008
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*
Reply With Quote  
Join Date: Feb 2008
Posts: 312
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

Re: display image from databse

  #38  
Apr 3rd, 2008
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.
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 240
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: display image from databse

  #39  
Apr 3rd, 2008
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 !
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*
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 6:31 am.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC