Computing.Net > Forums > Web Development > While loop in myswl

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

While loop in myswl

Reply to Message Icon

Name: BigShow
Date: October 10, 2008 at 22:31:06 Pacific
OS: xp
CPU/Ram: pentium 4
Product: dell
Comment:

Hey Guys, I need some help with the database i am building. I have a table where I store the path to pictures. Each user can have 5 pictures. On their edit page they have 5 forms each of which you can upload a picture from. Each for hs a hidden field with a unique number 1-5. When the upload happens, I need to check to see if that number exists in the pic_count field, if it does I update it with the new path, if is doesnt i insert the new path. I can not figure how to get this while loop to work.

Basically, I select all rows that match the 'type' and 'id' of the user, then i want to compare the pic_count in there to do teh above.

Any help would be appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: shutat
Date: October 10, 2008 at 22:50:24 Pacific
Reply:

$res = mysql_query("select * from pics_table where pics_id='form_pic_val' limit 1;")

if(mysql_num_rows($res) == 1) {
update
} else {
insert
}

It's just a guess; how are the tables set up?


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: While loop in myswl

Embedded sound loops in Firefox www.computing.net/answers/webdevel/embedded-sound-loops-in-firefox/1279.html

Java hidden & visible form elements www.computing.net/answers/webdevel/java-hidden-amp-visible-form-elements/2778.html

syntax error, unexpected $end www.computing.net/answers/webdevel/syntax-error-unexpected-end/2236.html