473,468 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Apostrophe problem

110 New Member
Error: missing ; before statement
Source File: http://localhost/test.php?Line: 948, Column: 49
Source Code: select_opt[1] = 'abcd-50's{a101}';


i have created rows dynamically and trying to fill one of the select box with this value and i get this error



Thanks in advance
Apr 5 '08 #1
7 1825
acoder
16,027 Recognized Expert Moderator MVP
You either need to escape the single apostrophe or you need to use double quotes instead of single ones.
Apr 5 '08 #2
SSG001
110 New Member
You either need to escape the single apostrophe or you need to use double quotes instead of single ones.

but how do i do that?


Thanks in advance
Apr 11 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
Expand|Select|Wrap|Line Numbers
  1. //Either use double quotes:
  2. select_opt[1] = "abcd-50's{a101}";
  3. // or escape single quotes:
  4. select_opt[1] = 'abcd-50\'s{a101}';
Apr 11 '08 #4
SSG001
110 New Member
Expand|Select|Wrap|Line Numbers
  1. //Either use double quotes:
  2. select_opt[1] = "abcd-50's{a101}";
  3. // or escape single quotes:
  4. select_opt[1] = 'abcd-50\'s{a101}';
but i'm fetching data from table so at the time of fetching i want know if any of the value has single quotes or not
Apr 11 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
Show the code that causes the error.
Apr 11 '08 #6
SSG001
110 New Member
can i remove the symbols like \ ,* $ % ' " after posting the data
and before inserting it in the query so such problem would not arise
Jun 19 '08 #7
acoder
16,027 Recognized Expert Moderator MVP
Yes, you can, but there's no need to. If you escape it when displaying, then there won't be a problem.
Jun 19 '08 #8

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

Similar topics

2
by: Michael Sterling | last post by:
i'm using delphi 7 and have a query in which i'm trying to find names that have an apostrophe in them, i.e. "o'mally". my problem is that when i write my select statement i can't get the quotes...
2
by: InvisibleMan | last post by:
Thank in advance for your help... I have the following javascript: document.write(' <a class="whitenav" href="javascript:window.external.AddFavorite ('http://www.mydomain.com','Welcome to...
1
by: Joel | last post by:
I realize there are many ways to handle Apostrophes in sql statements. The problem I'm having is comparing a string with an Apostrophe entered by the operator against the field in the DB (ie Field:...
2
by: CSDunn | last post by:
Hello, I have a combo box designed to look up records in a subform based on the selection made in the combo box. The Record Source for the combo box is a SQL Server 2000 View. There is one bound...
13
by: Richard Hollenbeck | last post by:
To prevent future apostrophe bugs and errors, isn't it just simpler to forbid an apostrophe from being entered into a text field? For example, couldn't "Alice's Restaurant" be changed to "Alices...
1
by: congngo | last post by:
Hi all Every time I export a table into an excel spreadsheet. It has a leading apostrophe on every cells. This drive me nut. I have to do a work around by export table into a txt file than...
11
by: Trevor | last post by:
Hi, I currently have the following code in a subform. If Not rstPDAddresses.EOF And Not rstPDAddresses.BOF Then With rstPDAddresses txtautoAddressID.ControlSource = "='" & Nz(!autoAddressID,...
1
by: karen987 | last post by:
I have an ASP news page to which you can add comments. The comments open up in a new window, and users can click reply to reply to them after which they are taken to the parent page which has a...
5
by: =?Utf-8?B?TEtOZXdzR3JvdXBz?= | last post by:
Hi I have a list which pulls out items from a stored procedure. Unfortunately some of the items it pulls out have apostrophes. This info need to be placed in a URL but it keeps truncating at the...
9
by: Thomas 'PointedEars' Lahn | last post by:
Jukka K. Korpela wrote: IBTD. For example, in English it is customary (and AIUI expected) to use the character that ’ represents should be used to delimit a quotation within direct speech...
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.