Thursday 15 July 2010

php - my guestbook will not display the posts i enter -


I want to thank you in advance for helping me with your related issue The thing is that my guestbook received the data in the database Is doing this, so it is connecting, but when I submit the data, goes to the database, but I do not know that I am not sure because this is probably a version conflict. I was watching YouTube to make this guestbook but was not sure which guy made a guestbook. Everything works except the post's performance. I was thinking if you guys can help me with this and I will post the code below

 . & Lt ;? Php error_reporting (E_ALL ^ ​​E_NOTICE ^ E_DEPRECATED); ? & Gt; & Lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Title & gt; Document title & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt ;? Connect to php // database mysql_connect ('localhost', 'root', ''); Mysql_select_db ('tutorial'); / * * ************************************************************************************************* **************************************************************************************************** ** * / // Resume the form and luggage area "<3> Enter the post in the guestbook "; If ($ _POST ['postbtn']) {$ name = strip_tags ($ _ POST ['name']); $ Email = strip_tags ($ _ POST ['email']); $ Message = tab_tag ($ _ POST ['message']); If ($ name & amp; email & amp; amp; amp; messages;) {$ time = date ("h: ia"); $ Date = date ("FD, Y"); $ Ip = $ _SERVER ['REMOTE_ADDR']; // database mysql_query (include in the Guest values ​​("',' $ name ',' $ email ',' $ message ',' $ time ',' $ date ',' ip '); Echo "Your post has been added."; } Else {echo "you did not enter all the necessary information"; }} Echo "& lt; form action = './guestbook.php' method = 'post' & gt; & lt; table & gt; & lt; tr & gt; & lt; td & gt; name: & Lt; / td> gt; & lt; td & gt; & lt; input type = 'text' name = 'name' style = 'width: 300 pixels;' / & Gt; & lt; / td> gt; & lt; / tr & gt; & lt; tr & gt; & lt; td & gt; Email: & lt; / td & gt; & lt; td & gt; ;  gt; & lt; / tr & gt; & lt; tr & gt; & Lt; td & gt; Message: & lt; / td>   gt; & lt; / tr & gt; & lt; & gt; & lt; TD & gt; & lt; / td & gt; & lt; td & Lt; input type = '' name = 'postbtn' value presented = 'post' /> & lt; / td> & lt; / tr & gt; & lt; / t Able & gt; & lt; / form & gt; "; / * * ************************************************************************************************* **************************************************************************************************** * * / / // display content field echo " current mail "; $ Query = mysql_query ("SELECT * Guest Book ORDER ID DESC"); $ Numrows = mysql_num_rows ($ query); If ($ numrows> 0) {echo "; // Highest horizontal line resonant time ($ rows = mysql_fetch_assoc ($ query)) {$ id = $ row ['id']; $ Name = $ line ['name']; $ Email = $ line ['email']; $ Message = $ line ['message']; $ Time = $ line ['time']; $ Date = $ line ['date']; $ Ip = $ line ['ip']; // nl2br New line to break the function $ message = nl2br ("message"); By & lt echo; div & gt; by & lt; p & gt; $ name & lt; / p & gt; & lt; p & gt; $ timings & lt; / p & gt; on & lt ; P & gt; $ date & lt; / p & gt; & lt; br / & gt; $ message & lt; / div & gt; & lt; hour / & gt; "; }} And {echo "no posts were found."; } Mysql_close (); ? & Gt; & Lt; / Body & gt; & Lt; / Html & gt;    

You have plotted rows in your While loop:

  while ($ line = mysql_fetch_assoc ($ query)) {^ - plural $ id = $ row ['id']; ^ Not "s" - singular  

while ($ rows where you are using $ row for everyone, This is why it does not display any of your lines.

While using ($ line in singular form.


Indicate that your current code is open for use, or they are more secure .


No comments:

Post a Comment