Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-10-2005, 03:29 PM   #1
Registered: Oct 2003
Location: D.C USA
Distribution: Redhat 9. Thinking about Slackware
Posts: 166

Rep: Reputation: 30
Change PHP error message.

I have a site that people get emailed registration codes to. When they go to the site there is a box that asks for them to enter there code. If they put in a correct code it pulles there record if they put in no code or mistype there code the get the following error message

You have an error in your SQL syntax near '' at line 1

How do i change the error message? If it could just say some thing like invalid code please use your back button to try agian would be good enoughf.

Old 03-10-2005, 04:21 PM   #2
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
The issue here is that this error is telling you that the code needs to better-error check the data being given by the user, before the SQL statement is called. It is a fallacy to assume that the user knows what they are doing, even if you think that they may. Firstly, if the user doesn't input anything into the entry field, the SQL call should never happen. Second, is the user entry only supposed to be numbers? Or can it be numbers and letters? More to the point, what is the data type in the table to which the user-entered code refers? If it's only a number, then the code needs to make sure that what they entered was only a number before it is passed the SQL. If it's only supposed to be numbers/letters, the code needs to make sure that it doesn't include any other symbols. You get what I'm saying? Error check the ever loving crap out of their input, and your code will be the better for it.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Forbidden message helpme0904 Linux - Newbie 1 11-16-2005 12:57 PM
Change Welcome Message Zebe SUSE / openSUSE 1 03-25-2005 10:21 PM
PHP error message when uploading files obj63 Programming 4 08-26-2004 12:15 PM
Executing PHP script- error message vfulco Linux - Newbie 3 07-13-2004 10:55 PM
change welcome message syphon00 Linux - Networking 14 09-06-2002 11:55 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:43 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration