Help with the PHP and MSQL

Status
Not open for further replies.

dharmil

New Member
Messages
1,656
Reaction score
0
Points
0
It only works when i check boxes i cant uncheck them.


PHP:
    $result = mysql_query("SELECT * FROM `users` WHERE username = '".$_SESSION['clientusername']."'");
    while($row = mysql_fetch_array($result))
          {
            echo "<div id=\"note\"><h4>Files: These are all the photos that where taken by Janoo, select what you want to be listed on the web-site! for you to view at any time.  This list can be edited at any time.</h4><blockquote>
            <form action=\"user.php?do=browse&send=true\" method=\"post\" name=\"edit\">";
            $result2 = mysql_query("SELECT * FROM `albums` WHERE id = '".$row['album']."'");
            while($row2 = mysql_fetch_array($result2))
            {
                $result3 = mysql_query("SELECT * FROM `files` WHERE album = '".$row2['name']."'");
                $count=mysql_num_rows($result3);
                while($row3 = mysql_fetch_array($result3))
                {
                    echo "<input ";
                    if($row3['accept'] == "yes"){
                        echo "checked=\"checked\"";
                    }
                    echo " name=\"checkbox[]\" type=\"checkbox\" id=\"checkbox[]\" value=\"".$row3['id']."\">";
                    echo "<a href=\"uploads/".$row2['name']."/".$row3['name']."\">".$row3['name']."</a> (Accepted: ".$row3['accept'].")<br />";
                }
                if($_GET['do'] == "browse" && $_GET['send'] == "true"){    
                    for($i=0;$i<$count;$i++){
                        $del_id = $checkbox[$i];
                        $sql = "UPDATE files SET accept = 'yes' WHERE id = $del_id";
                        mysql_query($sql);
                    }
                }
            }
            echo "<input name=\"edit\" type=\"submit\" value=\"Edit\">";
            echo "</form></blockquote></div>";
          }

if u dont understand here is what i mean
http://www.emazinghosting.com/janoo/login.php
CLIENT SIDE not admin side
username: test1
password: test1
the after login in click browse..
 
Last edited:

kajasweb

New Member
Messages
1,723
Reaction score
0
Points
0
You have to get all the files from album and loop around it. When the file id is in the array you received from checkboxes, you have to set them TRUE else FALSE.

Hope, this can help you.
 
Status
Not open for further replies.
Top