Jump to content

[SOLVED] Making sql statment short


Distant_storm

Recommended Posts

I have never been that good at making sql statments i only know a limited amount of query language.

 

I have a database table which i need to update several items via their ID. so

 

I have a set off image which can be any amount with checkboxes... if the image is checked then that image in the database table should be updated.

 

it would look like

"SELECT * FROM the_photo_album WHERE id={$_POST['checked_image']}";

 

now instead of putting it OR this or that would it be best to loop through each one updating each one everytime it loops ?

 

hmm :( any help would be apreciated, also if anyone has any links to good querys e.t.c that be good

Link to comment
Share on other sites

ok a form sends back X amount of ID's which corrispond to fields in a table which identifies records

 

eg

 

ID Data

1  a

2  b

3  c

4  d

 

 

Now say the form sends the id's 1 3 and 4

 

I want the script to change the data of 1 3 and 4 to the word Blah

 

how would i do this using an update query such as

 

"UPDATE table_name SET data='blah' WHERE ID='$id'";

 

ok thats the type of thing i want to do, but as their could be any amount of Id's so how would i go about it

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.