DiscoTrio Posted October 21, 2009 Share Posted October 21, 2009 Ok everything works but the output become 0 on chat. It makes message become a 0. I know its in this part of code becuase thats what goes into the database. Here is the input code: <?php include "connect.php"; if(isset($_POST['submit'])) //if submit button push has been detected { $message=$_POST['message']; $name=$_POST['name']; if(strlen($message)<1) { print "You did not input a message"; } else if(strlen($name)<1) { print "You did not enter a name, please try again."; } else { $message=strip_tags($message); $IP=$_SERVER["REMOTE_ADDR"]; //grabs poster's IP $checkforbanned="SELECT IP from ipbans where IP='$IP'"; $checkforbanned2=mysql_query($checkforbanned) or die("Could not check for banned IPS"); if(mysql_num_rows($checkforbanned2)>0) //IP is in the banned list { print "You IP is banned from posting."; } else { $thedate = date("U"); //grab date and time of the post $insertmessage="INSERT into chatmessages (name,IP,postime,message) values('$name','$IP','$thedate','$message')"; mysql_query($insertmessage) or die("Could not insert message"); } } } print "<form action='submit.php' method='post' name='form'>"; print "Your name:<br>"; print "<input type='text' name='name' size='20'><br>"; print "Your message:<br>"; print "<textarea name='message' cols='40' rows='2'></textarea><br>"; print "<a onClick=\"addSmiley('')\"><img src='images/smile.gif'></a> "; //replace images/smile.gif with the relative path of your smiley print "<a onClick=\"addSmiley('')\"><img src='images/sad.gif'></a> "; print "<a onClick=\"addSmiley('')\"><img src='images/wink.gif'></a> "; print "<input type='submit' name='submit' value='submit'></form>"; print "<script language=\"Java Script\" type=\"text/javascript\">\n"; print "function addSmiley(textToAdd)\n"; print "{\n"; print "document.form.message.value += textToAdd;"; print "document.form.message.focus();\n"; print "}\n"; print "</script>\n"; print "<br><br>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/178456-solved-need-help-finding-siple-error-in-script/ Share on other sites More sharing options...
MadTechie Posted October 21, 2009 Share Posted October 21, 2009 1. use code tags 2. have you checked the values and the field types in database ? Quote Link to comment https://forums.phpfreaks.com/topic/178456-solved-need-help-finding-siple-error-in-script/#findComment-941075 Share on other sites More sharing options...
Baronen Posted October 21, 2009 Share Posted October 21, 2009 2. have you checked the values and the field types in database ? As MadTechie writes: My guess is that the message column in the database is of type Int. Quote Link to comment https://forums.phpfreaks.com/topic/178456-solved-need-help-finding-siple-error-in-script/#findComment-941089 Share on other sites More sharing options...
DiscoTrio Posted October 21, 2009 Author Share Posted October 21, 2009 It is set to tinyint Quote Link to comment https://forums.phpfreaks.com/topic/178456-solved-need-help-finding-siple-error-in-script/#findComment-941482 Share on other sites More sharing options...
DiscoTrio Posted October 21, 2009 Author Share Posted October 21, 2009 Fixed it Quote Link to comment https://forums.phpfreaks.com/topic/178456-solved-need-help-finding-siple-error-in-script/#findComment-941503 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.