kristiankeith Posted March 30, 2012 Share Posted March 30, 2012 Below is my code... it writes to the SQL database but does not show on the HTML page. Any advice? <?php $query = mysql_query("SELECT * FROM `entries`"); $query = mysql_query("SELECT *, UNIX_TIMESTAMP(`date`) as date FROM `entries` ORDER BY `date` DESC LIMIT"); ?> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td valign="top"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td valign="top" class="entrysmall" align="right">Posted on: <?php echo date("d/m/y g:i a", $row['date']); ?></td> </tr> <tr> <td valign="top"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td valign="top" style="padding-right: 10px;"><span class="entrytitle">Name:</span></td> <td valign="bottom" width="100%"><?php echo htmlspecialchars(stripslashes($row['name'])); ?></td> </tr> <tr> <td valign="top" style="padding-right: 10px;" nowrap="nowrap"><span class="entrytitle">E-Mail:</span></td> <td valign="bottom" width="100%"><?php $email = explode('@',stripslashes($row['email'])); echo $email[0].' *at* '.$email[1]; ?></td> </tr> <td valign="top" style="padding-right: 10px;"><span class="entrytitle">Hometown:</span></td> <td valign="bottom" width="100%"><?php echo htmlspecialchars(stripslashes($row['hometown'])); ?></td> <tr> <td valign="top" style="padding: 5px 10px 0px 0px;" colspan="2"><span class="entrytitle">Message:</span></td> </tr> <tr> <td valign="top" style="padding-right: 10px;" colspan="2"><?php echo smilies(htmlspecialchars(stripslashes($row['message']))); ?></td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td valign="top" height="10"></td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/260030-can-not-get-entry-to-appear-on-page-writes-to-sql/ Share on other sites More sharing options...
litebearer Posted March 30, 2012 Share Posted March 30, 2012 you execute the query BUT you aren't retrieving the row ie mysql_fetch_array Quote Link to comment https://forums.phpfreaks.com/topic/260030-can-not-get-entry-to-appear-on-page-writes-to-sql/#findComment-1332828 Share on other sites More sharing options...
batwimp Posted March 30, 2012 Share Posted March 30, 2012 And how is it writing to the database when you're doing a SELECT and not INSERT, UPDATE, etc. ? Quote Link to comment https://forums.phpfreaks.com/topic/260030-can-not-get-entry-to-appear-on-page-writes-to-sql/#findComment-1332829 Share on other sites More sharing options...
trq Posted March 31, 2012 Share Posted March 31, 2012 And why are you using stripslashes all over the place? If your data has slashes in it, something went wrong on the way into the database. Quote Link to comment https://forums.phpfreaks.com/topic/260030-can-not-get-entry-to-appear-on-page-writes-to-sql/#findComment-1332902 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.