Page 1 of 1

More arrays

Posted: Sun Jan 18, 2004 7:15 pm
by pinehead18
Ok well here i go again. In my quest to expand my knowledge in arrays (and write this script) i've come accross a question.


First off. Let me explain what is going on. I'm write a photo album type system for my family. Each user can upload 5 pictures. So when they login to their page. I have a script which pulls the 5 image names from an array. And creates a link to them.




That is what that script does.

Code: Select all

<?php
$sql = "SELECT * FROM users where user='$name'";
$result = mysql_query($sql) or die(mysql_error());

while($arr = mysql_fetch_array($result))
{
    $pics[] = $arr["add_picts"];
}
foreach($pics as $picid)
{
    $array = explode(',', $picid);

    foreach ($array as $pic)
    {
print $pic[0];
echo "</p>";
print $pic[1];
echo "</p>";
print $pic[2];
        
        
        $table .= "<tr><td><a
href=http://l.com/images/$pic>$pic</p></tr></td>";
        $table_one .= "<td><p align=center><a href=http://c.com/edit_pics.php?picid=$array><img
src=http://c.com/images/$pic height=80 width=80 border=0><br>$pic</a></td><td>&nbsp</td>";
    }
}
?>
This code works great. It even links correctly. However, i face the problem of when the person clicks on the link it is suppose to take you to the upload script page. My problem is i dont' know how to tell the upload script page which $pics[] var in the array to update.

Any suggestions on how to go about this?

Posted: Fri Aug 27, 2004 1:14 am
by Lord Sauron
When should a picture be updated and when not?