ibda12u Posted April 13, 2006 Share Posted April 13, 2006 I have a phone list, that has all the contact details stored in 1 database.My form retrieves all this data and displays it in a page.What I would like to do is add a image that say in or out. (if the person has clocked in, or clocked out)I wanted to do this by pulling data from my time clock database.So when the page gets displayed it would look something like thisInOffice | Name | Phone Number | OfficeIn person1 111-1111 2bOut person2 111-1112 2cetc.......My query for pulling the contacts works great, but added or tried to add the query to pull the time clock info in, and now my list doesn't display my contacts anymore. no errors.Any idea's here is my code[code]<?# List the contacts.$qtable = "users";$qfields = "userid, dept, location, name, phone, cell, email, initials, active";# Sort by user (contact).$qresult = mysql_query("select $qfields from $qtable where (phone != '' or cell != '') and (active = '1') order by name") or die ("Invalid Query: Possibly database server down.");while(list($userid, $dept, $location, $name, $phone, $cell, $email, $initials)=mysql_fetch_row($qresult)){$dept=stripslashes($dept);$location=stripslashes($location);$name=stripslashes($name);$phone=stripslashes($phone);$cell=stripslashes($cell);$email=stripslashes($email);# Get inoffice/outofficemysql_select_db (nuke,$db);$qresult2 = mysql_query("select inoffice, username from nuke_users where username='$email'") or die ("Invalid Query: Possibly database server down.");while(list($inoffice)=mysql_fetch_row($qresult2)){?> <tr bgcolor="#FFFFFF"> <td align=center bgcolor=white><? if ($inoffice==0) { echo "<img src='images/out.jpg'>"; } elseif ($inoffice==1) { echo "<img src='images/in.jpg'>"; } else { echo "<img src='images/na.jpg'>"; } ?> </td> <? if ($email == "NA") { ?> <td><? echo $name; ?></td> <? } else { ?> <td><? echo '<a href=mailto:' . $email . '>' . $name . '</a>'; ?></td> <? } ?> <td><? echo $email; ?></td> <!-- --> <td><? echo $dept; ?></td> <td><? echo $location; ?></td> <td><? echo $phone; ?></td> <td><? echo $cell; ?></td> </tr><? } } ?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.