fwapah Posted January 30, 2008 Share Posted January 30, 2008 The account I created yesterday is not valid for some reason, so I created this new one. I cannot get this code to work in my browser to save my life, though it looks good in Dreamweaver (not written in DW though). Can someone please tell me why it won't display? I'm afraid it has something to do with my server, which is very limiting. Thanks so much for your help. the tables are grant and reviewer. Fields are REVIEWER rid (primary, unique) rfirst rlast rpass grant1 grant2 GRANT gnum gfirst glast rid gscore1 gscore2 gcomm1 gcomm2 Here is the code another phpfreak helped me write, but I have messed with it: <html><?php $rid = $_GET["rid"]; mysql_connect("xxx.com", "xxx", "xxx") or die(mysql_error()); mysql_select_db("nsac") or die(mysql_error()); $query="SELECT * FROM grants JOIN reviewers as r1 ON grants.reviewer1id = r1.id JOIN reviewers as r2 ON grants.reviewer2id = r2.id WHERE r1.reviewer1id = '".$_GET['rid']."' OR r2.reviewer2id = '".$_GET['rid']."'"; $rt=mysql_query($query); ?> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td> <table width="400" border="1" cellspacing="0" cellpadding="3"> <tr> <td colspan="4">Grants for your review</td> </tr> <tr> <td align="center"><strong>First</strong></td> <td align="center"><strong>Last</strong></td> <td align="center"><strong>Grant #</strong></td> <td align="center"><strong>Update</strong></td> </tr> <tr> <td><? echo $rt['gfirst']; ?></td> <td><? echo $rt['glast']; ?></td> <td><? echo $rt['gnum']; ?></td> <td align="center"><a href="update.php?id=<? echo $rt['gnum']; ?>">update</a></td> </tr> </table> </td> </tr> </table> <?php mysql_close(); ?> </html> Thanks again!! Quote Link to comment https://forums.phpfreaks.com/topic/88586-connect-to-mysql-and-display-data-not-working/ Share on other sites More sharing options...
shocker-z Posted January 30, 2008 Share Posted January 30, 2008 what actually happens? try changing $rt=mysql_query($query); to $rt=mysql_query($query) or die(mysql_error()); this will return a mysql error if your statement is failing. regards Liam Quote Link to comment https://forums.phpfreaks.com/topic/88586-connect-to-mysql-and-display-data-not-working/#findComment-453533 Share on other sites More sharing options...
revraz Posted January 30, 2008 Share Posted January 30, 2008 Explain what "doesn't work" means. Quote Link to comment https://forums.phpfreaks.com/topic/88586-connect-to-mysql-and-display-data-not-working/#findComment-453537 Share on other sites More sharing options...
fwapah Posted January 30, 2008 Author Share Posted January 30, 2008 sorry.. nothing will display when i go to www.url.com/score.php?rid=1 Quote Link to comment https://forums.phpfreaks.com/topic/88586-connect-to-mysql-and-display-data-not-working/#findComment-453574 Share on other sites More sharing options...
fwapah Posted January 30, 2008 Author Share Posted January 30, 2008 Thanks for the error reporting tip.. duh! can't believe i forgot that.. but here's what i get: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'grant JOIN reviewers as r1 ON grant.reviewer1id = r1.id JOIN reviewers as r2 O' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/88586-connect-to-mysql-and-display-data-not-working/#findComment-453582 Share on other sites More sharing options...
revraz Posted January 30, 2008 Share Posted January 30, 2008 GRANT is a mysql reserved word, you shouldn't use it as a DB, Table or Fieldname. Quote Link to comment https://forums.phpfreaks.com/topic/88586-connect-to-mysql-and-display-data-not-working/#findComment-453620 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.