Jul 26, 2008

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

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

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

Hamtaro
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:
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 file

mysql_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?

 

 

 


Reply

OpaQue
Reemove the Special character on line 12

Reply

Hamtaro
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')";

Reply

LuciferStar
TRY
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 file
mysql_query($Query);
mysql_close();
include "chat.php";
?>

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : php, mysql, warning

  1. How Do I Find My Mysql Password? [resolved]
    Cannot access my MySQL (5)
  2. Please Explain Me Mysql
    How do i insert information into this config: (4)
    Hi, I wanted to try just to test how can i connect my website to another mysql server, but i have no
    idea how to insert the other mysql information such as port and host etc.... so here is the config
    file please give me an example CODE <?php // mySQL information $server =
    'FRESHSQL.COM:3306';                   // MySql server $username =
    'vasilevich';                      // MySql Username $password =
    '*******';                         // MySql Password $database =
    'vasilevich';                  // MySql Da....
  3. Remote Access Mysql
    (8)
    Is it possible to directly access my local database from my website? For example, if somebody
    submits info on my website, the info they submitted would be transferred to my local database
    directly. Is that possible? And if so, how do I set that up? The reason I don't want to upload
    my database to my subdomain is because it would be difficult to keep the website database and my
    local database in sync . . . or is there a way to do that? Thanks for any replies.....
  4. Create Table - Mysql Code - Help
    (1)
    I need your feedback about setting the database issues. Please, review them and correct some entries
    in the code if they got some mistakes. This is the code itself: SQL CREATE TABLE
    `news` ( `id` int(250) NOT NULL auto_increment, `title` varchar(255)
    NOT NULL default '', `text` text NOT NULL, `author` varchar(255) NOT
    NULL default '', `valid` varchar(255) NOT NULL default '',
    `date` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE = ....
  5. Mysql Error
    (3)
    ok i need some more help from the wonderful coders here at Trap. I'm almost done with my CMS
    script, but i'm having a problem with the installer.php file, when it trys to inseret the user
    data into the database i keep getting the following error: CODE mySQL Error: You have an
    error in your SQL syntax; check the manual that corresponds to your MySQL server version for the
    right syntax to use near ';INSERT INTO `members` (`id`, `name`,
    `username`, `password`, `email`, `title`) ' at lin....
  6. Mysql
    Several files in one field. (2)
    Hi guys. I want t know if it is posible to have so many entries for one object in a field in MySQL.
    I know my question may not be clear because I lack in terminology but pliz try and help. What I want
    to do is for axample have a database of my clients with the following fields for every client:
    fname, lname, more than one photos, contrubutions(comments, jokes, testimonials posted) etc. I want
    to have the things like the photos in the same field but they have to be unique so that my php code
    can deal with them individually llike they are coming from different fields.....
  7. The Scarlet Letter: My View
    Warning! Long Essay with spoilers (0)
    The Scarlet Letter is most definitely a novel to remember. This novel brings so much to the table,
    there is a little bit of mystery, deceit, evil, and so much more. The Scarlet Letter is full of
    symbols, themes and motifs. To fully comprehend the novel, an individual must read it more than
    once. Nathaniel Hawthorne uses very vivid imagery, yet the story unfolds quite slowly. One should
    have much patience while reading this classic, though in the end one will get rewarded. The Scarlet
    Letter has feeling, strength and love. What more can one ask for? There are no action sc....
  8. Html Form!
    Using MySQL?! (4)
    Hey, I need your help again! I need some good working tutorial how I can update my SQL through
    HTML form. I did use some tutorials online found with the help of google; but they do not work
    properly; I mean there are still small mistakes. I need to have a good tutorial to follow. It
    should be based on security and more things. It has to be done in proper way.......
  9. The Great Gatsby And The American Dream
    Warning, Long Read and Essay (4)
    F. Scott Fitzgerald’s The Great Gatsby is much like an onion. On the surface there is the hard outer
    layer, but to really understand it, one has to dig into the fresh insides. On the surface of The
    Great Gatsby Fitzgerald portrays a romantic love between a man and a woman, but inside the real
    meaning is much deeper. Fitzgerald depicts the 1920’s as a time of decay social and moral values,
    evidence of this is the greed and the pursuit of pleasure. Jay Gatsby’s constant parties epitomized
    the corruption of the American Dream as the desire for money and worldly pleasures ov....
  10. All Quiet On The Western Front: The Effects Of War
    Warning, Long Read Essay and has spoilers (0)
    In All Quiet on the Western Front, Erich Maria Remarque progressively shows the brutality of war
    through the eyes of soldiers claiming their innocence. Remarque describes the war as a beastly
    adversary to these soldiers; furthermore he depicts the killing of enemy soldiers as a game for the
    Germans. Throughout the duration of the book, Paul Baumer, the main character, is portrayed as a
    once innocent adult that becomes emotionally desensitized by the war. The goal of All Quiet on the
    Western Front is to show how unromantic war truly is. War novels are known for emphasizin....
  11. Warning--indian Pedo!--serious Read
    (3)
    STORY: My friend just yesterday on msn told me that a random guy added her, my friend a 14 year old
    girl said this 25 year old random added him( and as usually people normally add randoms in the case
    they think its a friend whos added him/her) and on the note of this, she doesnt post her email on
    the net. And due to this i decided to investigate and hunt him down( pretty scary a 25 year old
    talking to a 14 year old high school girl) and i got some screenshots of the what happened when i
    found out.. which is below.. So after this i felt concern and decide to pos....
  12. Best Php And Mysql Editor For Noobs
    anyone any php or mysql editor that is good for noob (6)
    hi there guys, from my previous posting, i am a noob in php and mysql programming. I want to know
    if there are any php and mysql editors which are best for me as a noob. i appreciate your kindness
    ....
  13. Php And Mysql Programming
    anyone knows a code for mysql and php (2)
    hi everyone! I am making a program using php and mysql...I am a noob on this so i need your
    help guys...I want to make a simple program that will some values and then store them on a database
    and then retrieve them...uhmm let me give an example out put of what i need. This is the example
    say..: Enter First Name: Enter Last Name:
    Enter Age: Enter Address: ..those
    are the data needed for input values...my question now is how can I make a database....
  14. Mysql-essential-5.0.51 Installion Problem
    please help me.(urgent) (2)
    Dear friend, please help me. Iam working on php project (matchmaking site). I have downloaded mysql
    essensial 5.0.51. When i was installing mysql 5.0.51, i got following error - Error 1901: Error
    attempting to read from the source installation database:
    c:\windows\installer\527ec6.msi What is solution of this problem ? Iam using
    windows xp professional version 2002 (service pack 2). Please post your reply. Iam waiting for your
    answer. ....
  15. Database With Mysql++
    getting mySQL++ to work with trap17 (7)
    Hi, I'm trying to build an online game and figured the easiest way to do the server list would
    be to make a mySQL database for it; however, I use the con() command on the IP i get from pinging my
    website and I always get an abnormal program termination; however, it will work with the mySQL on my
    own machine. The code is below: CODE #include <iostream> #include <iomanip>
    #include <mysql++> #include "pass.h"//holds my password (i program at
    school) int main(void) {     Connection con("t3jem3_test","....
  16. Tools Needed!
    PHP & MySQL (9)
    Hello, everyone! I need some tools for those two things to test PHP scripts coming together with
    database on my laptop, instead checking them on a web-server which takes time.....
  17. Mysql + Php Question
    (5)
    Hi, I am creating a website in php and using a mysql database to store the data. I want to store
    time data in the database. My question is what is the best datatype I should use and how do I read
    the time from the database and format(display) it using php ?....
  18. Mysql Won't Update
    (4)
    Ok, so I'm making some arcade administration software so I don't have to add games the hard
    way, well anyway, one of the features I have is that on the homepage is a featured author and as
    such I just have it so it updates one line in the mySQL. Well, the page with the form passes on the
    varibles fine and the updating page recieves them because I echoed everything, then I build the
    query and I even echo the query and it comes out exactly how I want it to, but for some reason, the
    database itself won't update even though all the varibles are there. Here's....
  19. Qupis : Free Hosting With Php, Mysql, Cpanel. (one Line Text Ad At Bottom)
    a member of Xisto (41)
    Hello Members, We are proud to introduce a new member to Xisto group of sites.
    Qupis : Free Web Hosting 150 MB space, 5000 MB Bandwidth, php,
    mysql, CPanel (Latest). Emails, FTP, Addon domains, Parked Domains etc.
    http://www.Qupis.com
    Feel free to add your reviews and comments about it. -Trap17
    Management ....
  20. Is It Possible To Access The Mysql Remotely?
    (10)
    I like to experiment with a lot of things and I was thinking of making a sort of instant messenger
    in Python, but I want to let people have actual accounts so I need to be able to access the mySQL
    remotely. If that's not possible, are we allowed to run Python scripts on the server?....
  21. Check Referrer To Prevent Linking Yours From Other Sites
    Check referrer with Php and Mysql (8)
    Check Referrer Using Php To Prevent People Linking To Your Downloads From Other Sites Ever
    find that found some people are listing items, images and tuts and linking directly to the download
    url (those that are like my photoshop tutorial.php?id=0), which is a .php to count the number of
    downloads. To prevent this, you can add a piece of code to the download pages that checks which page
    referred them to the download page: if it's my domain, it downloads the file normally, if
    it's not, it will redirect to my home page instead. Important : Not all browser....
  22. Can You Add Images Into A Mysql Database?
    Using Php? (20)
    I'm learning php in class right now, but I'm still not that good at it, what I'm
    wondering is when I write the php so that it can connect with a database, can I at the same time
    have it that it is able to display back images that I choose. Like, I want a search feature, where
    you can search for a keyword, and it will bring back a list of all the possible entries with that
    keyword, but each of these entries will have a photo associated with it. Now, do I put these image
    files directly into the database, or do I write the code to link them from my files to th....
  23. Installing Apache, Mysql, Phpmyadmin Locally
    Solving the "php_mbstring.dll missing" (5)
    Since Trap17's CP provide the individual site's owner with goodies like MySql and
    PhpMyAdmin, chances are some will want to make use of them. Well, it's fine enough to get that
    on one's host (Gee! Thanks a lot, Trap17...) Knowing how the usual geek react, it might be
    expected that most people considering to make use of a database on their site will want to do most
    of the tedious job of developing and testing on their own local system before sending the wrapped-up
    result on their domain/subdomain. This involves four basic steps (sorry for the compuwi....
  24. How Fast Can You Type The Alphabet?
    Warning: addictive. (63)
    http://www.morpheme.co.uk/frenzy/ - This game is very addictive for me, but it is good practice
    for knowing where all the letters are if you are not that great at typing. Also if you have a chance
    check out the video section they have, there are 3 videos I think but the people are really fast at
    typing the alphabet. - My record was 4.207 I could probaly get faster but I put alot of time doing
    this nd dont want to get too addicted to it. - Post your times heres.....
  25. Mysql Database Size
    related to the free database space (6)
    hi all! this is my first post /biggrin.gif' border='0' style='vertical-align:middle'
    alt='biggrin.gif' /> and i have a doubt, how much mysql space i am allowed to use... i mean how
    much is available for my free account....
  26. Import From Excel File Into Mysql Database
    (7)
    Has anyone tried using the excel import function that comes with phpmyadmin
    http://www.phpmyadmin.net/home_page/ - it does not require any additional plug-ins or scripts and
    is fairly straightforward to use. In phpmyadmin, if you click on the database table which you wish
    to import the data to , there is a link on the bottom left corner which says "insert data from a
    text file into the table" - although it says text file it still can be used to import an excel file.
    When you click on this link you will be taken to a page where you will be asked for the file name
    (the....
  27. Paypal Scam Warning!
    New email attempt to hack your account (21)
    I've been getting those stupid scam emails for years, where they tell you to update your
    security info. I hope EVERYBODY knows those are a scam and NEVER click through. The proper response
    is to forward them to SPOOF@PAYPAL.COM, then delete the message without going to the site. Now
    there's a new one--at least this is the first time I've gotten one. This time they tell you
    that you've added a new email address and they want you to confirm. Again, the answer is to
    forward to SPOOF@PAYPAL.COM without clicking through or going to that site, then delete the ....
  28. Warning: Virus Spreading Through Msn Messenger
    any info? (12)
    I was online, and then a friend sent me that file, and I accepted it because he's been wanting
    to send me a program that improves the resolution of the screen. But then my email address was in
    the file name, so I asked him what that was. To my horror, he said 'virus', but it was too
    late, I already opened it and then several chat screens popped-up, and it was auto-sent to some of
    the friends on the contact list. Luckily i was quick enough to ask them not to click on it. And my
    norton internet security and microsoft anti spyware program detected it and asked ....
  29. Learning Mysql
    pls guide (3)
    hello out there, i have already looked through on this tutorial forum.. and still can find any
    topics which related to MySql basic.. i wanna learn about how to create MySql table and its
    concept!! just basic.. i've no knowledge on MySql before nor any other database server
    software.. but i do have littol konwledge on programming,scripting,html basic in concept.. pls dun
    gave me so many links so as i can be blur for none about how to get start!! /laugh.gif'
    border='0' style='vertical-align:middle' alt='laugh.gif' /> i can thou find from Googles sear....
  30. Complete Login System
    With PHP + MYSQL (56)
    Its an complete login sistem made and tested by me and I think itwill be very usefull for people who
    are tryn to learn PHP. First, let's make register.php: CODE <?
    include("conn.php"); // create a file with all the database connections
    if($do_register){ // if the submit button were clicked if((!$name)
    || (!$email) || (!$age) || (!$login) ||
    (!$password) || (!$password2)){ print "You can't let
    any fields in blank....

    1. Looking for php, mysql, warning

Searching Video's for php, mysql, warning
Similar
How Do I
Find My
Mysql
Password?
[resolved] -
Cannot
access my
MySQL
Please
Explain Me
Mysql - How
do i insert
information
into this
config:
Remote
Access Mysql
Create Table
- Mysql Code
- Help
Mysql Error
Mysql -
Several
files in one
field.
The Scarlet
Letter: My
View -
Warning!
Long Essay
with
spoilers
Html
Form! -
Using
MySQL?!
The Great
Gatsby And
The American
Dream -
Warning,
Long Read
and Essay
All Quiet On
The Western
Front: The
Effects Of
War -
Warning,
Long Read
Essay and
has spoilers
Warning--ind
ian
Pedo!--s
erious Read
Best Php And
Mysql Editor
For Noobs -
anyone any
php or mysql
editor that
is good for
noob
Php And
Mysql
Programming
- anyone
knows a code
for mysql
and php
Mysql-essent
ial-5.0.51
Installion
Problem -
please help
me.(urgent)
Database
With Mysql++
- getting
mySQL++ to
work with
trap17
Tools
Needed!
- PHP &
MySQL
Mysql + Php
Question
Mysql
Won't
Update
Qupis : Free
Hosting With
Php, Mysql,
Cpanel. (one
Line Text Ad
At Bottom) -
a member of
Xisto
Is It
Possible To
Access The
Mysql
Remotely?
Check
Referrer To
Prevent
Linking
Yours From
Other Sites
- Check
referrer
with Php and
Mysql
Can You Add
Images Into
A Mysql
Database? -
Using Php?
Installing
Apache,
Mysql,
Phpmyadmin
Locally -
Solving the
"php_mb
string.dll
missing"
;
How Fast Can
You Type The
Alphabet? -
Warning:
addictive.
Mysql
Database
Size -
related to
the free
database
space
Import From
Excel File
Into Mysql
Database
Paypal Scam
Warning!
- New email
attempt to
hack your
account
Warning:
Virus
Spreading
Through Msn
Messenger -
any info?
Learning
Mysql - pls
guide
Complete
Login System
- With PHP +
MYSQL
advertisement



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



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE