Hi all,
i had written a query

$sql3="select userid from projectassign where projectassign='$projectassign'";
     mysql_error();
    $result3=mysql_query($sql3);
    $num1=mysql_num_rows($result3);
    $i=0;
    while ($i < $num1)
    {
        $userid=mysql_result($result3,$i,"userid");
        echo $userid;
        $i++; 
    }

so now i am getting some userid's. Now there are some checkboxes present in a table of users.Based on the query, userid's obtained i need to have them checked.
Example:
i got the userid's as 1,2,3 from the query.
Now there is checkbox to each users with userid 1,2,3,4,5. so wat i need is i need users having userid's 1,2,3 as checked in their checkboxes. so can any one please....
Thank u..

Recommended Answers

All 2 Replies

I'd just have one loop for 1..5 then as you output the html add an if() to check for projectassign , if true output the proper html attribute -- value="checked" or whatever it is.

Unchecked checkbox:

<input type="checkbox" />

Checked checkbox:

<input type="checkbox" checked="checked" />
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.