Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




String Error - Quotes Changed To Question Marks


I recently converted an asp/access site to an asp/mysql site. Now all my strings are displaying funky. For example if I have the text - Why don't we say "Yipee" - it displays on my site as - Why don?t we say ?Yipee?. The same change is being made when I use a sentence with "..." in it. I like ... baseball is changed to - I like?baseball.

Any thoughts as to why this is happening? Sometimes it is actually being changed somehow in the database, and sometimes it is correct in the database, but then changed when it displays on the web.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Use Quotation Marks In Insert Into Command String?
how to make SQL command with cuotation marks for example
INSERT INTO some_table (name, pet) VALUES ( ' Petar's ' , ' dog ')
is there any way to put quotation marks inside the string, or should I make some statements for chechking if the string has quotes and replace them????

Single Quotes Error In Mysql 4.1.12
My host recently upgraded from 3.23.53 to 4.1.12 of Mysql. Ever since then, any text fields that have an apostrophe or single quote causes this error. If we remove it, the sql processes correctly.

Example: Typing didn't will give the foll. error but typing didnt will not.

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
't show much interest for this idea.

I post the text into the script like this .

$discussions = $_POST["discussions"];
$disc1=stripslashes($discussions); //strip /
$disc2 = nl2br ($disc1); //convert CR to BR

and the relevant sql is

UPDATE `Report` SET `Discussions` = '$disc2' and the rest of the fields.

I even changed the above to

UPDATE `Report` SET `Discussions` = '$discussions'
but the syntax error persists.

Error When Using Single Quotes In Form Fields
When I input information which contains a single quote, for example, "There wasn't a soul around", I get a MYSQL error stating:

Error updating certificate information: 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 't

I can input other non alpha-numeric characters and even double quotes, but unless I preceed the single quote with a , then I get that error. I would prefer not to have to use the because other people will be updating information in the database.

I get the error regardless of whether I use the data type of varchar or mediumtext.

Is there a way I can configure MYSQL to allow input of single quotes without preceeding it with?

I Changed Root Password But I Can Not Login With Changed Password
I changed the password of root with
update user set password=password('newpassword')

Then I exited. But when I want to login again , it cannot authenticate the root
I should tell you that a hacker had changed my root password before. Because it was not encrypted before.

Removing Quotation Marks
Say you had a column with character data that contained quotation marks. How would you update this column to remove the quotation marks? update table set description = replace(description, 'xx', 'xx') but instead of the x's replace quotations " with nothing since you cant put the quotes directly into the first parameter of the replace function?

Apostrophes Turning Into Question Marks?
This may be easily resolved but I haven't ever encountered it before. I am entering text into my mysql database that contains apostrophes. This field is generally around 500-800 characters. When I add the information, there are apostrophes but when I go back to use the information, all of the apostrophes have been changed into question marks.
Any ideas how to keep the apostrophes? or why they are being changed?
Also, if I go through and change all the question marks back to apostrophes, they will stay apostrophes!


Double Quote Marks In SQL Backup File
when I do a backup of a table on my mySQL Administrator I get CREATE TABLE "product" (double quotes), I want product` (single quote marks) where do I specify this I tried all I can imagine already to do with character set..and backup options
(this messes up on restore with double quotes on DB I need to add this to..

Error In String
I'd like to use placeholders but it looks difficult to use with $dbh->do() as I am not particularly familiar with this.

CODE  $dbh->do("INSERT INTO storage (url, altavista, yahoo, msn, teoma, google, alltheweb,Total, lastsearch, totalsearch) values($url, $altavista_results, $yahoo_results, $msn_results, $teoma_results, $google_results, $alltheweb_results, $total,$time, $total)") unless $dbh->do(UPDATE storage SET (url = "$url", altavista = "$altavista_results", yahoo = "$yahoo_results", msn = "$msn_results", teoma = "$teoma_results", google = "$google_results", alltheweb = "$alltheweb_results", total = total +1, time="$time") > 0;

Ado Connection String Error Through Vb
I'm using mysql-5.0.1-alpha-snapshot-win & VB 6.0

  I'm having trouble connecting to the database server over a lan.

  When I use the following connection string from the server it works fine. -

adoCon.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=MyDatabase;uid=root;"

  When I use the the following connection string from another computer I get this error -

adoCon.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};SERVER=192.168.0.2;DATABASE=MyDatabase;uid=Tom;pwd=X12;"

Run-time error '-2147467259(80004005)'

[MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on '192.168.0.2' (10060)

Also when I try the last connection from the database server and in vb (not compiled) I get the following error -

Run-time error '-2147467259(80004005)'

[MySQL][ODBC 3.51 Driver]Client does not support authentication protocol requested by server; consider upgrading MySQL client

In MySQL CC under users -
Username = Tom
Host = %
Password=X12

Global privileges and MyDatabase are checked with All Privileges

MySQL Is Adding Quotation Marks When Uploading Tab-delin. .txt File
In the Excel sheet, the data looks like:

Data that is going into a page.

and is coming out

"Data that is going into a page."

It doesn't seem to be causing errors, but the formatting looks like crap.

Syntax Error In String In Query Expression '''
The following is my jsp codings:

{//start of readline while
//sb.append(nextLine);
//note: BufferedReader strips the EOL character.
//sb.append(lineSep);

StringTokenizer SToken=new StringTokenizer(br.readLine(),",");
while(SToken.hasMoreTokens())
{
String ADM_NO = SToken.nextToken();
st.executeUpdate ("insert into try (Adm_No) values ('"+ADM_NO+"')");
}

}//end of readline while

There is an error Syntax error in string in query expression ''', is it b'cos of the single or double quotes? What can I do?

MySQL Error: Unterminated String Constant
I have an error "Unterminated string constant" in my SQL request. I guess my syntax is not correct:

mySQL1 = "SELECT * FROM viewTicket where ((TelRes = '" & NoTel & "') OR (TeleTra = '" & NoTel & "')
 OR (TeleCel = '" & NoTel & "') OR (NoClient = '" & NoTel & "')) AND ((ServiceName = 'MODEM')
 OR (ServiceName = 'UBR') OR (ServiceName LIKE '%BASE%')) "

In other words, I fill a form where the variable NoTel is grabbing what was entered in the form. Then, it search for that value in the database in the fields TelRes, TeleTra, Telecel or NoClient. 

And, there is a second criteria that search in the field ServiceName for the value MODEM, UBR or *BASE* (whatever is in the field, as long as it find the word BASE).

Format Function In SQL String To Return From Numeric Field In Table To String
How would i form a format function in SQL string to return from numeric field in table to string:

1 --> '001'
5 --> '005'
57 --> '057'
125 --> '125'

Changed Characters
While using mysqldump to backup the databases on my server i noticed that all the the portuguese accented characters from my databases get screwed up and changed to wierd characters.
What's up?

Localhost Be Changed To Something Else
i have been wondering is it possable to change the host setting
example
basic install is set to root@localhost
is it possible to set it to like root@buddybear It is a unfortunate thing that as a consumer you are treated as well lets be polite cattle. Companies need to change there attitudes on how they deal with there clients more honesty and transparency from there tech departments to there executives

Quotes
Im trying to display text from a varchar that contains a (') colon. Whenever i try to call it to print it to screen mysql spits out an 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 ' ". Is there anyway to bypass this.. i know why it does it... but i want it to print it anyway
the varchar has text "El'inar" a persons name... when i try and use the name to search the database it gets the error..

Date Field Gets Changed ...
Through my php script user x uploading files to mysql table.
then user y login and correct that file & put grade for that file up to that the grade
field is empty. now i am getting problem here.
my table having date_time field, it is indicating the uploaded date & time of user
x.
when user y update that grade the date_time field also gets updated by the current
time, but i didn't change that field through my query.
here i want to keep the previous date_time .
How it is? Thanks in advance.
shyami

All Swedish Characters Is Changed
I'm doing Kevin Yanks tutorial about how to manage users with session (with some small modifications).

But when the data is inserted into the table all Swedish characters is changed to some strange "¥" and "¶". Why is it so and how to fix it?

According to PHPAdmin the collation is either UTF-8 (db) or Latin1_swedish (table)?

Changed Root Password, Now I Can't Do Anything
I am following the MySQL by Michael Kofler and looking at securing root access as currently it has no password.

I've logged into the MySQL consol and changed password using :

mysqladmin -u root -h localhost password XXX

However, i now can't do anything in in mysql terminal it comes back "access denied for user 'root'@'localhost' (using password :NO)

Date Field Gets Changed ...
Through my php script user x uploading files to mysql table.

then user y login and correct that file & put grade for that file up to that the grade
field is empty. now i am getting problem here.

my table having date_time field, it is indicating the uploaded date & time of user
x.

when user y update that grade the date_time field also gets updated by the current
time, but i didn't change that field through my query.

here i want to keep the previous date_time .

User Information Changed
The other day someone changed every user's password on my site. Then they changed every user's email address to theirs - I assume the reason was that when the user used the password reset function, they would never see the information.

I'm trying to research what/where the vulnerability is in the script that I'm suing, but I don't really know where to start - not being a hacker, I don't even know the terms to search for here or on google.

Is this what is meant by mysql injection?

Float(m,n) Changed Between Mysql 4.0 And 5.0?
I have a float(11,10) field (default NULL) in one of my MyISAM tables. With MySQL 4.0.16, I can call an Update/Insert query with a value of , say 33.166668 to this field, and it updates correctly. When I retrieve that value again with a select statement, I get something like 33.1666668392 (10 digits after decimal). Which is correct. (The sql_mode server variable is set to 0)

With the same field in MySQL 5.0, my experience is different. With the server sql_mode set to one of the strict values( SQL_TRANS_STRICT), i get an error about out of range value for the float field. when I change the sql_mode to not have the SQL_TRANS_STRICT, I get the same error as a warning, 1264 "Out of range...". When I retrieve this value, it is set to 10.0000000000, which is wrong. But , when I change the field description to float(11,5) and do an update, the value is updated right, but I get an intermittent "No rows updated" error.

Could anybody please explain if the float definitions changed between versions? Does float(m,n) now mean that I can have only (m-n) digits before decimal point?

Changed User Privileges And Now I Can't Log In
I read several web sites and O'Reilly's book on MySQL about securing the
system tables.

I removed several users and, as advised inthe book and web sites, changed
the user "root" to another name with another password.

I removed the site name as a host but kept the IP address.

Now when I use phpMySdmin to get back in, it let's me past the login popup
BUT it gives me the message:

Error
MySQL said: Access denied for user: 'root@localhost' (Using password: YES)

The data in the database is not important but the database
structure/definition is. I'd like to find a way to back up or dump that.
Then I can reload MySQL and start over.

Any ideas?

Changed User Privileges And Now I Can't Log In
I removed several users and, as advised inthe book and web sites, changed
the user "root" to another name with another password.

I removed the site name as a host but kept the IP address.

Now when I use phpMySdmin to get back in, it let's me past the login popup
BUT it gives me the message:

Error
MySQL said: Access denied for user: 'root@localhost' (Using password: YES)


The data in the database is not important but the database
structure/definition is. I'd like to find a way to back up or dump that.
Then I can reload MySQL and start over. Any ideas?

Shoudl I be able to get to it using shell login?

Changed User Privileges And Now I Can't Log In
I read several web sites and O'Reilly's book on MySQL about securing the
system tables.

I removed several users and, as advised inthe book and web sites, changed
the user "root" to another name with another password.

I removed the site name as a host but kept the IP address.

Now when I use phpMySdmin to get back in, it let's me past the login popup
BUT it gives me the message:

Error
MySQL said: Access denied for user: 'root@localhost' (Using password: YES)

The data in the database is not important but the database
structure/definition is. I'd like to find a way to back up or dump that.
Then I can reload MySQL and start over.

Changed Datadir Now Mysql Won't Run
I changed the datadir using mysql administrator (so I could "see it") (I'm using version 5.0.x under OS X 10.4.5 and now mysql won't run and I don't know how to reset the datadir. I've reinstalled mysql and when I try to run it this is what I get:

iBook-G4:/usr/local/mysql michael$ sudo ./bin/mysqld_safe &
[16] 12878
iBook-G4:/usr/local/mysql michael$ Starting mysqld daemon with databases from /Users/michael/Sites
STOPPING server from pid file /Users/michael/Sites/iBook-G4.pid
060329 12:38:24 mysqld ended

Rows Changed In Update SQL
Is there a way to find out how many rows got updated when i execute a update stmt.

I would like to get the updated rows count in SQL.

Let me know and Thanks in advance.

update stmt where clause;

now how can i get the count of rows that got updated.

Get The Latest Changed Records
I hava a table with the following information

CREATE TABLE TEMP1 (REFID INT, REVISION INT, FIELDNAM VARCHAR(10), VALUE VARCHAR(10));
INSERT INTO TEMP1 VALUES(1001, 0, A, A2);
INSERT INTO TEMP1 VALUES(1001, 0, C, C2);
INSERT INTO TEMP1 VALUES(1001, 0, E, E2);
INSERT INTO TEMP1 VALUES(1002, 0, A, A3);
INSERT INTO TEMP1 VALUES(1002, 0, B, B2);
INSERT INTO TEMP1 VALUES(1002, 0, E, E3);
INSERT INTO TEMP1 VALUES(1001, 1, A, A4);
INSERT INTO TEMP1 VALUES(1001, 1, E, E4);

Here based on latest revision and refid I should get the fieldnam and value.
Expected output:
REFID FIELDNAM VALUE REVISION
1001 A A4 1
1001 E E4 1
1002 B B2 0
1001 C C2 0

Using Single Quotes
I'm used to running queries on Transact-SQL.  I'm sure there's something wrong with the Where clause in the following statement:

CODEselect e_search from tbl_memory where show = 'Y'

Quotes In The Query
I have recently found that different types of quotes work for me...

Basicly when should quotes be used, like ` or ', and how?

Strip The Quotes
do u know an easy way for stripping some quotes from my database??.

For example "INSPEC IEE"
This is a problem because this kind of entries are entered in my db as
INSERT INTO Publishers VALUES (96,'"INSPEC/IEE"','"INSPEC/IEE"',' .......

The same problem appears when i also use the php to retrieve them.
How i should remove the quotes from my db?

Quotes And Queries
I'm wondering about the proper formatting of queries with repect to quotes. For example:

SELECT something WHERE something_else = 'this' AND 'that'

or

SELECT something WHERE something_else = this AND that

Sql Inserting Quotes
I upgraded phpmyadmin to phpMyAdmin 2.6.3-pl1. When I try and upload a file using the LOAD DATA LOCAL INFILE 'text.txt' INTO TABLE data.parts FIELDS TERMINATED BY ','

Either sql, or something set in phpMyAdmin, is giving my chars and strings the " " treatments around them. Needless to say that this doesn't help with the scripts I've developed with fields without the quotes.

Can someone help me figure out how to remove them(the quotes), either through a SQL statement, or a setting somewhere to change this back?

Convert Quotes
I have a simple HTML Form that post text values to a mySQL insert script. sometimes I might have quotes in the title of an entry. As we all know mySQL doesn't like that how can I get around that. I see all these CONVERT()and String functions but I don't know if this applies. I don't run PHP, JAVA or any of these other technolgies so I'd appreciate a straight forward response without including these type of methods.

Copy Changed Records Into Same Table
Is there any way to select several records from one Table, and copy them back to same Table but with changed values of one field (for instance: values of Foreign key field)?
((records with original values needs to remain in Table))

Date And Time Stamp A Changed Row
I am about to declare a table with 20 columns.

How do I create 4 more columns:
1. current Time
2. current Day of the month
3. current Month
4. current Year

Such that:

a. These 4 columns are not editable by the user.

b. Whenever a row is updated/inserted/replace/etc. then
these 4 columns in that row are automatically updated
by the system accordingly.

Phone Numbers Changed On Import
I have imported a cvs data file every way I can think of and I always get this weird problem. About 75% of my 4,000 files end up with the phone number 2147483647. I searched the cvs file and this number does not exist there.
Is there an explaination for this?

Ignore Single-Quotes
I've searched for hours and I thought that REPLACE() might be the solution, but it doesn't seem to work the way I thought it might. In any case, if anyone could tell me if this is possible, and if so, how to accomplish it--please let me know! Thanks in advance!

Igonore single quotes in column value when comparing against a string. So,

daisys crazy (passed value) = daisy's crazy (database value)

Importance Of Quotes In A Query
I'm trying to figure out why these two queries differ so much (The first one works, the second is invalid syntax):

SELECT
s01_Products.id
, s01_Products.name
, s01_Products.image
, s01_Products.price
, s01_Products.descrip
, s01_Products.designer_id
, s01_Products.sizingchart_id
, s01_Products.reg_price
, s01_Products.auto_photos
, s01_MUS_PhotoLookup.`order`
FROM
s01_Products
LEFT OUTER JOIN
s01_MUS_PhotoLookup
ON s01_Products.id = s01_MUS_PhotoLookup.product_id
WHERE
s01_Products.code LIKE 'GO-10%'
and

SELECT
s01_Products.id
, s01_Products.name
, s01_Products.image
, s01_Products.price
, s01_Products.descrip
, s01_Products.designer_id
, s01_Products.sizingchart_id
, s01_Products.reg_price
, s01_Products.auto_photos
, s01_MUS_PhotoLookup.order
FROM
s01_Products
LEFT OUTER JOIN
s01_MUS_PhotoLookup
ON s01_Products.id = s01_MUS_PhotoLookup.product_id
WHERE
s01_Products.code LIKE 'GO-10%'
The only difference is the quote around the "order" in s01_MUS_PhotoLookup.order. I understand that order is a keyword, does this play a role?

Single Quotes In MySql 3
Im using MySQL 3.23.53 (upgrading is out of my hands) and every time a user enters a single quote ie: ' into field that gets stored in a text column, my .Net program crashes (ASP.net 2 to be specific)

Is there any solution, other then not allowing this character to be ented or having to check if it was entered and escape it ?

Double Quotes Appear As ? On Website
I have an Excel file (which is converted to csv by a tool and then
uploaded to a MySQL database) and then php is used to display the
data on the website.

In the Excel file i have text fields which has data containing double
quotes. They end up appearing at ? question mark on the website. Any
idea how to dispaly the quotes

Should i be carefull of any other invisible characters in Excel which
can mess up the data.

How To Insert Quotes As Text?
I want to create a variable that is set as a text string, but I want to have a quote character within the text. I can't figure out how to do this without ending the variable thing. Can anyone help me?

Example:
Dim var1
var1 = "I want my quote in " here."

Where I want the quote in between 'in' and 'here' to be part of the sentence, but instead it sets the variable to 'I want my qoute in '.

Escaping Double Quotes
I'm trying to insert some dimensions into a table with this:

update paintings
set painting_dimensions = '24" x 30"'
where painting_id = '1';

but this doesn't work. how do I properly escape the double quotes?

Quotes Around Numeric Data
I've been jumping from databases to databases, and I was wondering for MySQL, which of these is recommended:
WHERE col = '4'
OR
WHERE col = 4
Do quotes around the numeric integer matter?

Removing Double Quotes
I have a text file of the following format
CODE1211|d|"http:www.abc.com"
1211|d|"http:www.abc.com"
1211|d|"http:www.abc.com"
1211|d|"http:www.abc.com"

Row Cannot Be Located For Updating. Some Values Might Have Changed Since It Was Last Updated
I've recently migrated from access to mysql with vb6). Unfortunately, i get the following error whenever the .update is executed on the recordset.

"Row Cannot be located for updating. Some values might have changed since it was last updated"

The select statement is:
Select * from tablename, connection,3,3 (have also modified the 3,3, to be adOpenDynamic, adLockOptimistic)

I have tried checking the flag To Return Matching Rows, I've added the option = 2 in the connection string, i have a primary key field in the table, and I've also tried re-assigning it to itself.

HostName Changed - Now MySql Server Wont Run
I've changed the hostname of my sever at long last, now what had been a very stable Mysql server won't run, can anyone point me in the right direction?

Changed MyISAM To InnoDB - Getting Really Slow UPDATES
I've recently got all inspired and purchased "High Performance SQL" - an O'Reilly's book. Using a slow query log I'd already identified two tables that were causing problems. Both had an equal number of SELECT and UPDATE/DELETE statements being run against them.

This was leading to table-locking problems and after reading about the advantages (and disadvantages) of InnoDB tables versus MyISAM tables I thought that it would be good to convert both tables to InnoDB.

The conversion was carried out using:
ALTER TABLE `table_name` TYPE = INNODB

The IMPORTANCE Of Using QUOTES Around NON-NUMERICAL FIELDS
The following are 2 SQL queries, nearly identical, except one can use indexes and one can't. "field" is of the type varchar. It is indexed in the table.

SELECT * FROM table WHERE field=23409;
SELECT * FROM table WHERE field=?'

Guess which one can't use the index. That's right, the first one.

This is a HUGE optimization problem! If you can't even utilize your indexes, they're worthless! So make sure you have quotes around fields when they are non-numeric!


Copyright © 2005-08 www.BigResource.com, All rights reserved