Loop Question
Posted: Sat Oct 31, 2009 5:04 pm
Hi all,
bit of a newb at all this but having a lot of fun learning PHP and MySQL !
Need a bit of help with a loop issue.
I have a DB with a table called "pictures".
The table has a row "IID" (image ID) and a row "UID (user ID).
When users upload images the IID increments and the UID records which user upload the image.
Users are recorded by their member number.
So it looks like this:

I'm trying to build galleries which display all the images uploaded by a certain user.
A logged in user is identified by "$id" and after some bits and bobs for sessions etc., my php says
and now I need to loop through and build a table of the images that user "$id" has uploaded.
And that's where I'm stuck.
My experience is with Flash and as such I would naturally use a 'for' loop but the syntax I know in Flash
is different and I just can't make that work.
All and any advice / code / tutorials on how to extract the info and build a table of images in the html
very much appreciated !
Best wishes
Monty
bit of a newb at all this but having a lot of fun learning PHP and MySQL !
Need a bit of help with a loop issue.
I have a DB with a table called "pictures".
The table has a row "IID" (image ID) and a row "UID (user ID).
When users upload images the IID increments and the UID records which user upload the image.
Users are recorded by their member number.
So it looks like this:

I'm trying to build galleries which display all the images uploaded by a certain user.
A logged in user is identified by "$id" and after some bits and bobs for sessions etc., my php says
Code: Select all
$sql = mysql_query("SELECT * FROM pictures WHERE UID='$id'");
And that's where I'm stuck.
My experience is with Flash and as such I would naturally use a 'for' loop but the syntax I know in Flash
is different and I just can't make that work.
All and any advice / code / tutorials on how to extract the info and build a table of images in the html
very much appreciated !
Best wishes
Monty