Jump to content
xisto Community
Sign in to follow this  
Hamtaro

Php Help: Mysql Warning Please help (again...sorry)

Recommended Posts

I've just made a PHP script that allows people to chat. It's similar to a tag-board (But not exactly). I'm getting the following warning with MySQL:
Warning: Unexpected character in input: '' (ASCII=31) state=1 in /home/hamtaro/public_html/add_message.php on line 12

I looked in the file, and didn't find anything...So I thought I'd ask for help (again).

Here's the code:

<?php$UserName = $_POST['UserName'];$EMail = $_POST['EMail'];$Message = $_POST['Message'];$IP = $REMOTE_ADDR;$Query = "INSERT INTO chatboard (UserName, IP, EMail, Message) values('$UserName', '$IP', '$EMail', '$Message')";include "db_chat.php"; //Database connection filemysql_query($Query);mysql_close();include "chat.php";?>

The weird thing is...this works the way it should...it adds to the database, and also reads it (chat.php), yet I still get that warning. Does anyone know why it's showing that?

Share this post


Link to post
Share on other sites

I can't find it. I know what it's talking about, and the line is: mysql_query($Query); but the single quotes around the variables to write to the database are required. Or is something wrong with this, since it is referenced within mysql_query(): $Query = "INSERT INTO chatboard (UserName, IP, EMail, Message) values('$UserName', '$IP', '$EMail', '$Message')";

Share this post


Link to post
Share on other sites

TRY

<?php$UserName = $_POST['UserName'];$EMail = $_POST['EMail'];$Message = $_POST['Message'];$IP = $REMOTE_ADDR;$Query = "INSERT INTO chatboard (UserName, IP, EMail, Message) values(".$UserName.", ".$IP.", ".$EMail.", ".$Message.")";include "db_chat.php"; //Database connection filemysql_query($Query);mysql_close();include "chat.php";?>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.