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
https://forums.phpfreaks.com/topic/81550-solved-making-sql-statment-short/
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.