sebthib55 Posted June 20, 2008 Share Posted June 20, 2008 Hello, I want to create script for my site that makes a user go through a checklist of things. This checklist would have its own page and would list everything they must do and what they havn't yet done. The user must do the entire list. If he/she doesn't, there is a banner that would display on all the pages until the new member would complete it. Once completed, the banner would disappear. This is so they get familiar with most features of the site. Anyways, my question is, how can I organise my tables in my sql database? I don't want multiple entries per user, but I also want the script to run and check what they have and what they havn't done all together but no use too many queries. I did think of making it complete a row for every task a user does, but when you go to check what tasks have been done, it may have to check through many entries, and make multiple searches. Any ideas? Thanks! Seb Quote Link to comment Share on other sites More sharing options...
fenway Posted June 20, 2008 Share Posted June 20, 2008 I did think of making it complete a row for every task a user does, but when you go to check what tasks have been done, it may have to check through many entries, and make multiple searches. Sounds like a good idea to me. Quote Link to comment Share on other sites More sharing options...
sebthib55 Posted June 20, 2008 Author Share Posted June 20, 2008 I did think of making it complete a row for every task a user does, but when you go to check what tasks have been done, it may have to check through many entries, and make multiple searches. Sounds like a good idea to me. If I do this, would I have a SELECT * FROM ______ WHERE user='user' AND task='2' SELECT * FROM ______ WHERE user='user' AND task='3' SELECT * FROM ______ WHERE user='user' AND task='4' There could be 20 tasks. Then for the script that checks the banners, it would have to check all those entries to see if it must display or not. How would I combine all my SELECT queries into 1? Quote Link to comment Share on other sites More sharing options...
fenway Posted June 20, 2008 Share Posted June 20, 2008 Why not just SELECT task FROM ______ WHERE user='user' And figure out what tasks they completed? Quote Link to comment Share on other sites More sharing options...
sebthib55 Posted June 20, 2008 Author Share Posted June 20, 2008 Yea, I think it will be easier that way. Thanks for your help! Quote Link to comment Share on other sites More sharing options...
sebthib55 Posted June 20, 2008 Author Share Posted June 20, 2008 Here is my script (template) It doesn't seem to work. What can I do to fix it? $taskcheck=@mysql_fetch_array(mysql_query("SELECT taskid FROM newbie_checklist WHERE user='$exist[1]'")); echo"<p><table width='50%' cellpadding='3' cellspacing='1' class='tableborder'> <tr> <td class='arcade1' colspan='6'><center><b>Task</b></td><td class='arcade1' colspan='6'><center><b>Completed</b></td> </tr>"; echo"<tr><td class='arcade1' colspan='6'> <center><b>Play 10 Games</b></td><td class='arcade1' colspan='6'><center>"; if($taskcheck[taskid]=="1"){echo"YES";}else{echo"NO";}echo"</td></tr>"; echo"<tr><td class='arcade1' colspan='6'> <center><b>Post 10 Times</b></td><td class='arcade1' colspan='6'><center>"; if($taskcheck[taskid]=="2"){echo"YES";}else{echo"NO";}echo"</td></tr>"; echo"<tr><td class='arcade1' colspan='6'> <center><b>Get 3 trophies</b></td><td class='arcade1' colspan='6'><center>"; if($taskcheck[taskid]=="3"){echo"YES";}else{echo"NO";}echo"</td></tr>"; echo"</table>"; Only the first task shows that it has been completed while I made the database take note of me completing 1 and 2. Quote Link to comment Share on other sites More sharing options...
fenway Posted June 22, 2008 Share Posted June 22, 2008 You need a while() loop to iterate through the rows. 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.