Hi, I have this script below. I echo in there the date, time, and the message. The message matches what is showin my database. However, the echo that I put on this page doesn't match what it should
EDIT-http://ryanreese.us/checkInfo.php
That page actually has the echoing. The recall.php is taking from the database and is showing a whole bunch of 0's in place of date/time. The checkInfo.php when you go there shows what the actual date() and time() is, and what SHOULD be entered into the database.
This is my recall.php
I have this code for checkInfo.phpCode:<?phpsession_start(); include "config.php"; $link = mysql_connect($host, $username, $password); if(!$link){echo "link";die(mysql_error());} $db_selected = mysql_select_db($DbName, $link); if(!$db_selected){echo "dbselect";die(mysql_error());} $i=0; $query="SELECT * FROM userSubmitted"; $result=mysql_query($query) or die(mysql_error()); $num=mysql_num_rows($result); while ($i <= $num) { $fieldOne=mysql_result($result,$i,"PostNumber"); $fieldTwo=mysql_result($result,$i,"Date"); $fieldThree=mysql_result($result,$i,"Time"); $fieldFour=mysql_result($result,$i,"Content"); echo $fieldOne; echo "<br>"; echo $fieldTwo; echo "<br>"; echo $fieldThree; echo "<br>"; echo $fieldFour; echo "<br><br>"; $i++; } echo "end of script"; mysql_close(); ?>
I can describe my database if you wish. Just 4 columns. PostNumber (auto increment), Date, Time, and Content. Time in the database is a Timestamp, the date is set as a Date.Code:<?phpinclude ("config.php"); ?> <!doctype html> <html> <head> <title>check</title> </head> <body> <?php $contentOfPost=$_POST['contentOfPost']; $date = date("Y/m/d"); $time = time(); $link = mysql_connect($host, $username, $password); if(!$link){echo "link";die(mysql_error());} $db_selected = mysql_select_db($DbName, $link); if(!$db_selected){echo "dbselect";die(mysql_error());} $insertionToDatabase="INSERT INTO $tableName (PostNumber, Date, Time, Content) VALUES (NULL, $date, $time, '$contentOfPost')"; $result = mysql_query($insertionToDatabase); if (!$result) { die('Invalid query: ' . mysql_error()); } echo $contentOfPost; echo "<br>"; echo $date; echo "<br>"; echo $time; echo"<br>"; echo $result; mysql_close($link); ?> </body> </html>
Oh, just went to my page, apparently someone is having fun with my blog.php, because there are somehow 12 blog posts, and ther eis only supposed to be like 2-3 in there (that were my own)...![]()




Reply With Quote





Bookmarks