473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

PHP Error Character (HELP!)

werks
220 100+
Hello PHP experts how can you detect ' character in your search field?
Because every time I input the word hilgard's it returns an error I think because of the character '. This is the error

Expand|Select|Wrap|Line Numbers
  1. Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Title LIKE '%hilgard's%';'., SQL state 37000 in SQLExecDirect in D:\wamp\www\Online Library\opac.php on line 76
  2. [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Title LIKE '%hilgard's%';'.
  3.  
tnx in advance.

--
Kenneth
"Better Than Yesterday"
Feb 14 '08 #1
2 1917
dlite922
1,584 Expert 1GB
Hello PHP experts how can you detect ' character in your search field?
Because every time I input the word hilgard's it returns an error I think because of the character '. This is the error

Expand|Select|Wrap|Line Numbers
  1. Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Title LIKE '%hilgard's%';'., SQL state 37000 in SQLExecDirect in D:\wamp\www\Online Library\opac.php on line 76
  2. [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Title LIKE '%hilgard's%';'.
  3.  
tnx in advance.

--
Kenneth
"Better Than Yesterday"
Its about time you know about a little some'n some'n called


After you studied it, then do learn how to prevent it:

http://us3.php.net/manual/en/functio...ape-string.php

Only you have MS SQL and not MySQL, but you get the point.

If you're still not satisfied.

Just use string replace

http://us3.php.net/manual/en/function.str-replace.php

[PHP]
str_replace("'", "\'", $sqlString);



[/PHP]

Get it?, got it?, gooOOood!
Feb 14 '08 #2
werks
220 100+
Thanks dlite922 I learned a lot! All the links you post is very useful. Than you very much..

--
Kenneth
"Better Than Yesterday"
Feb 14 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: sachin bond | last post by:
The following code(in c++) is supposed to divide a file into 'n' different files. suppose i'm having a file called "input.zip". The execution of the following code should divide "input.zip"...
14
by: tasheeta | last post by:
In my simple program I am getting this error..please help I am trying to find integers where 65537i + 3551j = 1 error: cannot convert `__complex__ int' to `long int' in assignment ...
2
by: Andrew Ayers | last post by:
All, I am having a problem with an INSERT onto a table I have created. First off, here is the table: --- CREATE TABLE reg ("customer number" SERIAL PRIMARY KEY, "company name" ...
3
by: Ekempd | last post by:
I'm trying to read the following XML file: <mail> <from>Rae</from> <subject>Informacion de su Proceso de Titulacion</subject> <body_mail> <!]> </body_mail> </mail>
4
by: Chua Wen Ching | last post by:
Thanks Derek... Okay i had another question.. my program runs smoothly for the first minute, after 1 minute... suddenly it breaks and display this error: do you know what is the cause of...
1
by: Franko | last post by:
I get the following error. Please help c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,38): error CS1001: Identifier expected c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,52): error...
2
by: pbmanikandan | last post by:
Horrible error. I use a function called cleanse company name that "removes" some strings if present from a string that is passed to it. In a procedure, I do the following. INSERT into table1...
0
by: smtwtfs007 | last post by:
Any body has any idea about his error please? I got this error at the time of creating crystal report. I tried everything to resolve this error. But I could not. Please help. Exception has...
1
TheMan1
by: TheMan1 | last post by:
Hi, I'm making a simple program in C++. I have an object named TextReader, with a function GetString(), and I also have another object, TextWriter. Now when *TextWriter is called, it needs to...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.