Jump to content

kristiankeith

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kristiankeith's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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>
  2. If anyone can assist me I would appreciate it. I have been trying to make this work for the past 3 days. I am doing a simple guestbook with PHP into MySQl and it connects, the ID and Date stamps work and appear in the guestbook but the name, email, hometown and comments do not. Here is the code. Again thank you in advance for any assistance. <body bgcolor="#000000"> <?php $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name=""; // Database name $tbl_name="guestbook"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect server"); mysql_select_db("$db_name")or die("cannot select DB"); $date=date("y-m-d"); //date $sql="INSERT INTO $tbl_name(name, email, hometown, comments, date)VALUES('$name','$email','$hometown','$comments','$date')"; $result=mysql_query($sql); //check if query successful if($result){ echo "Successful"; echo "<BR>"; echo "<a href='viewguestbook.php'>View guestbook</a>"; // link to view guestbook page } else { echo "ERROR"; } mysql_close(); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.