Invalid Characters With PHP And MySQL
I am writing about a situation that our client is currently experiencing with Linux Mandrake, Apache, MySQL and PHP. We successfully deployed a website running on this type of system for a period close to two years. It has a HTML GUI component that the client can type or paste content into and it serves-up dynamic pages in PHP from a MySQL database. Recently the web site was hacked by the Travel Bug virus and it forced the client to restore the web site and server software mentioned below.
Original Install
Mandrake 8, MySQL 3.23.32, PHP 4.0.06 and Apache 1.3.26-x.x
Current Install
Mandrake 9.0, MySQL 3.23.52-1, PHP 4.2.3-1.1 and Apache 1.3.26-6.1
The current install has lead to new problems. Content with double and single quotes are showing up as squares or question marks. For example, I have a page that is showing the square symbol in place of double quotes. If I do a view source on that specific page I can see the double quotes but if I telnet into the server and query the MySQL record belonging to that page the square or double quote character is nowhere to found. The following items are the steps we tried to understand why this is happening.
First, we did the following to test the integrity of the MySQL backup file. We Restored the MySQL database on our test environment which has the original software specs mentioned above but on a window server running IIS not apache. I did a restore of the MySQL database file and did not get any invalid characters. Even though the environment isn’t completely identical to the clients we can make the assumption that the dump file wasn’t corrupted.
Second, possibly content editors were copying and pasting from word into the HTML GUI component thus creating these invalid characters. In most cases yes but I personally noticed the invalid character issue with a page that doesn’t use the HTML GUI component.
Third, Possibly the configuration especially the character set from the original version to the current version of MySQL is not configured correctly. We believe this to be the primary issue. The resolution is to configure or reinstall MySQL and restore from backup.
Fourth, has anyone tried the PHP functions to convert the invalid characters. A request was to look into the iconv() function. The iconv library functions convert strings between various character sets encodings. This involves compiling the PHP interpreter which is why I haven’t tested it.
Fifth, Can some other process running on the server be causing this?
Altogether, we soon will begin creating a test server identical to the original settings and step through the install and try to recreate the invalid character issue. But, if anyone has experienced this invalid character issue or has more information that would benefit us your help would greatly be appreciated.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Invalid MySQL-Link Resource
I'm getting the error message 'Supplied argument is not a valid MySQL-Link resource' (applies to the 3rd line of code) when the code below executes: $delete_part_no_query = "DELETE FROM prices WHERE part_no == '$part_no_to_delete'"; $delete_part_no_result = mysql_query($delete_part_no_query); $num_delete_part_no_result = mysql_affected_rows($delete_part_no_result); The query works fine and I'm under the impression that 'mysql_affected_rows' should be used to return the number of rows affected by DELETE. However, I keep getting the above error message.
Warning: Mysql_data_seek(): Offset 0 Is Invalid For MySQL Result Index 2
I only posted this on the MySQL forums becouse i believed it had to do with the query. I get the following error: Warning: mysql_data_seek(): Offset 0 is invalid for MySQL result index 2 (or the query data is unbuffered) mysql_data_seek is used in a function (made not by me) which i know 500% that it works for other queries. The query in PHP is this:
Invalid Use
I am having a problem with group. Following is my query but it gives an error of "Invalid use of group". SELECT refMember.MemberAcroName, refMember.MemberName, Count(DistrictLevelInformation.FormID) AS Spread FROM (refMember LEFT JOIN MainInformation ON refMember.MemberID = MainInformation.MemberID) LEFT JOIN DistrictLevelInformation ON MainInformation.ID = DistrictLevelInformation.FormID GROUP BY refMember.MemberAcroName, refMember.MemberName, MainInformation.qYear, MainInformation.Quarter ORDER BY MainInformation.qYear DESC , MainInformation.Quarter DESC , Count(DistrictLevelInformation.FormID) DESC
Invalid Use
I have tested my query on MySQL 5 and it works, sadly the server it is to be run on only has 3. I was just wondering what I need to update in the following query to get it working on 3 or if it is even possible to get it running on 3. Code: ..... and keyword IN ('keywords') group by people having count(*) >= 1 ORDER BY people ASC
Invalid Index
I try to used the MyPhpAdmin 2.8.2.4 with PHP 4.4.4, MySQL5.0.2.4 and Apcache2 and I got this error, 'invalid Index'
Invalid Use Of Group By
I have the following query: SELECT CLAIMPOLICYNUMBER AS Plan, PROVIDERSPECIALTY AS Specialty, TINNUM AS Tin, SUBTINSEQNUM AS SibTin, CHARGETYPECATEGORY AS ChargeCategory, SUM(BILLEDCHARGE) AS Billed, SUM(PAID) AS Paid, " + _ COUNT(DOCUMENTNUM) AS ChgCount FROM BAT WHERE CASENUM='0000911' AND CHARGETYPE <> 'DENTAL' AND CHARGETYPE <> 'VISION' AND CHARGETYPE <> 'ADMIN' AND PMTDATE >= '2005-06-01' AND PMTDATE <= '2005-06-30' GROUP BY CLAIMPOLICYNUMBER, PROVIDERSPECIALTY, TINNUM, SUBTINSEQNUM, CHARGETYPECATEGORY ORDER BY SUM(BILLEDCHARGE) It works great without the ORDER BY clause, but with it, I get the aforementioned error.
Directory Name Invalid
For testing purposes I have PHP installed and I have MySQL installed on my local laptop. Windows XP Pro I am just learning both of them. I have read quite a few chapters in the MySQL Manual. Enough to allow me to get around in MySQL and directly create tables an view information in them, upload .txt files into the tables, etc etc. I am receiving an error when I try to connect to MySQL via a PHP script. I have no problem connecting to MySQL via Command Line. The error I receive is "The directory name is invalid." Here is my code... I am not sure where to put the directory name or where to put the directory path in order to make it valid. I am not sure what directory it is talking about. <html> <head><title>Connect to MySQL</title></head> <body> <?php //connecting to the mysql server uses a mysql_connect command. $link = mysql_connect("locoalhost",$_POST['username'],$_POST['password']) or die("Connect Error: ", . mysql_error()); echo 'Successfully Connected. '; mysql_close($link); ?> </body> </html> Where exactly would I put the path to the directory or where would I name the directory?
Invalid Syntax
I am having trouble changing my password back to OLD_PASSWORD by the following : mysql> SET PASSWORD FOR -> 'some_user'@'some_host' = OLD_PASSWORD('newpwd'); When I do it, it says ERROR 1064: 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 'OLD_PASSWORD ('newpwd')' at line 2
Invalid Use Of Group Function
I have the following Sql Statement... I'd like to find the sum of hrs worked by an employee in the month, the required number of hrs, and the sum of the difference between the two, the worked hrs are calculated by subtracting the max vtranstime - min vtranstime and the required hrs are calculated by subtracting max to1 - max from1.... I tried to do the following: select sum(timediff(max(vTransTime),min(vTransTime))) as worked, sum(timediff(max(translog.to1),min(translog.from1))) as required, sum(timediff(sum(timediff(max(vTransTime),min(vTransTime))), sum(timediff(max(translog.to1),min(translog.from1))))) as overtime, empid,deptname, firstname,lastname from employee,translog,department where employee.emp_magnetic_num=translog.vId group by employee.empid I am getting the following error : Invalid use of group function
Invalid Backup File
I am tring to restore a .pmb backup file and getting the message "Invalid backup file". I am very new to myssql so I don't have a clue what that means. Wrong version of mysql? Corrupted file?
Invalid Use Of Group Function
Using mysql 4.0 I get the following error message "Invalid Use of group function" with the following code: update custRP c, tbl_acctbal a set c.rpBal = sum(a.currRPBAL) where c.custid = a.custid
Invalid Argument While Using BCP (Script)
This will be a 50/50 question. It's either something that the SQL experts can answer or a scripting forum. I'm new to SQL and just coming to grips with getting familiar with scripts. I've developed a small script for my workplace that will connect to a remote server and extract the specified table that I want, zip it up and then copy it back to my local machine. This works fine until it tries to run the bcp command. If I tivoli to the remote machine and type the bcp command in command prompt it works fine. However when executed from the script it throws an invalid argument and seems to refer to the "-" minus I place in front of the U (user) or P(pwd). The script echos the users table request to a file which is then copied to the remote server (SQLtable.cmd) and then PSEXEC is called to connect to the server and run the script. e.g. psexec \%Server% -u %user% -p %password% "C: empSQLtable.cmd" PSEXEC then returns the following error. C:WINNTSYSTEM32>Bcp FrontOff..SHIFT_TER_DATA out C: empdmpnlSHIFT_TER_DATA.dat ûUsa ûPpwd (chopped off the -n) Unknown argument '¹Usa' on command line. Sorry about all the data, just hope someone can help. Must be an easy way. The small script which psexec is executing contains two simple lines. Bcp FrontOff..SHIFT_TER_DATA out C: empdmpnlSHIFT_TER_DATA.dat -Usa -Ppwd -n wwzip -9 C: emp\%username%SQLtables.zip C: emp\%username%*.*
Invalid Use Of Group Function - Max(`mainid`)+1
I am trying to insert a incremented number into the menu table. I will have an autoincremented number as well as the mainid number. When I tested the code that is below, the above error happened. Can someone please tell me the correct way of doing this? I am getting really frustrated with this. Nothing wants to work for me. require "config.php"; $insert06 = "INSERT INTO `menu` (`mainid`) VALUES (max(`mainid`)+1)"; // error line if (mysql_query ($insert06)) { print "Mainid added."; $query2 = mysql_query("SELECT mainid FROM menu") or die ("Could not query because: ".mysql_error()); while($row2 = mysql_fetch_array($query2)) { echo $row2['mainid']." = Mainid"; } } else { print "<p>Could not add the entry because: <b>" . mysql_error() . "</b>. The query was $insert06.</p>"; } mysql_close();
Group By Returns Invalid Dates
Hi i have one table: ID, User, Score, Date 1, mac, 1234, 2007-12-09 09:01:07 2,kurca, 3232, 2007-12-05 09:43:57 3, mac, 999999, 2007-11-07 09:44:14 I wan to create a high score list which will represent the best scores but not repeating anyone for example: 1, mac, 999999, 2007-11-07 09:44:14 2,kurca, 3232, 2007-12-05 09:43:57 Now i use: SELECT ID, User,MAX(Score) as maxScore,Date FROM `table` GROUP BY User ORDER BY maxScore DESC with this query the score is right but the date is invalid example: 1, mac, 999999,2007-12-09 09:01:07 2,kurca, 3232, 2007-12-05 09:43:57
Table Join Invalid Query
I have this table join below and I am getting an invalid query. How can I put the 15th line ($sql .= " group.id = master.id "; and the 17th line ($sql .= " where ".$currentrow_sql ; together. Is it even possible to do that?
Error:invalid Use Of Group Function
version:mysql 4.0.18 for win hi,all dear:) when execute sql-statement, error raise: update customer,cu_order set customer_point=0 where customer_keyid=order_customerid and DATE_SUB(now(),INTERVAL 1 YEAR)=DATE_FORMAT(max(order_time),"%Y-%m-%d 23:59:59") error:invalid use of group function i beg someone tells me why?how resolve? thx
Valid/Invalid Column Names
I'd like to present tabular data in HTML with the first row being the names of the columns in my database. However, I'd like them to be more presentable; for example 'I.P. Address' instead of 'ip_address'. I was wondering if a name like 'I.P. Address' could ever somehow be a valid column name or not.
Invalid Distinct Recordset Returned On An Indexed Column
I have a table with about 1.2 million records. I have an index set on a column. For close to two years, this query has worked perfectly fine: SELECT DISTINCT `Mgmt_Area` as thevalue, `Mgmt_Area` as valueid from qcdata ORDER BY thevalue Note, this is a programmatically generated query based on some user selections. This query actually is used to create a listbox. The index has 62 separate values. This query would usually return: Code:
PHP / MySQL Characters
(This is a multi-dicipline problem... I hope nobody is upset because I posted this in PHP, MySQL and XML areas)
Omitting Characters Between Characters?
This is what I wrote: select f.faqdesk_id , c.categories_id , f.faqdesk_question , c.categories_name , f.faqdesk_answer_short from faqdesk_description as f join faqdesk_to_categories as f2c on f.faqdesk_id = f2c.faqdesk_id join faqdesk_categories_description as c on f2c.categories_id = c.categories_id It works just fine, but the column: f.faqdesk_answer_short has characters I want to omit. For example, the results have html formatting. <H1>Hello World</H1><br><b>How is your day?</b> I want to perform the search without viewing the html. Is there a way to omit the brackets & anything between them?
French Characters In MySql
The problem i have is that i cannot enter correctly french characters (éà....) into MySql. My page is in UTF-8, my table was latin1_swedish_ci. So i try to change the table encoding into UTF-8. But no success, it doesn't change anything. When i use php_myadmin to enter french characters, they enter right, in latin1_swedish_ci table or in UTF-8 table. The characters seam to be encoded before they enter the DB when they are entered from one of my page. Anyone have any idea how to fix characters problems?
Spanish Characters In MySQL
If I insert data that contains spanish characters to my database (MySQL 3.23.56 on Slackware 9), it doesn't get stored correctly. For example, if I insert "maricón", MySQL stores it as "maric??n".
MySQL Japanese Characters
I use a MySQL Database where I store Japanese characters in SJIS. I tested if they are in SJIS and they are. I am using mysql 4.1.3b-beta, mysql-connector-java-3.0.14, JBuilderX (jdk 1.4.2), and OS XP. I change the default encoding latin1 to sjis when I start MySQL. I use mysqld-opt --default-character-set=sjis mysql --default-character-set=sjis. After starting mysql with the sjis character set I used: create database japanese; use japanese; create table jp (jp1 varchar(100)); I use a file with sjis characters as input. And to see if the output is in sjis I write the values to an output file. The values I get are in sjis. (I can't set the character set of the table to sjis. When I do that I only get garbage into the database and in the output file, maybe that's becuase I already changed the default character set at start-up?). So I have no problem with inputting a file that contains sjis characters and I can also output data to a file in sjis when using only MySQL, but I can't do it with Java. When I try to retrieve the data I only get a square, then a some character, then a square, then another character,... but not the actual kanji/kana. I have some latin characters in the same column as the kanji/kana and they are displayed correctly. I already tried only using kanji/kana in a column but it didn't work either. I can display Japanese characters correctly in Java when I retrieve them from a file, so I don't think it's a problem with the font. I also tried outputting the data I retrieve through Java to a file but there I get the same symbols as in my JTable. Have I done something wrong with creating the Database? Is there something I need to consider when using the MySQL Connector? On a side note as I am new to MySql after installing version mysql4.1.3b. I no longer have the mysqld.exe but only mysqld-opt.exe. So I am using this instead. But I don't think that can be responsible for my problem.
MySQL - Special Characters
This query (run in a bash shell script): SELECT * INTO OUTFILE '$EL_out' FROM `HelixDump_EL`; gives me a file with the special Icelandic characters corrupted. However, when I skip the INTO OUTFILE bit, it prints everything correctly. What is even stranger is that this used to work, and the structure of the database hasn't changed, so I am quite puzzled by this.
MySql 3.23 & Chines Characters
I am using mySql 3.23 and want to insert chines characters into the database. When I am doing this the chines characters are converted into "?????" marks.
Strange Characters In Mysql Database
I'm currently updating a site and in one of the fields is the content, but in the content I'm noticing strange characters such as: Quote: “This is a quote� These are Mr Plum’s ideas... The thing is, I need to get rid of them, or replace them (on mass) with the proper character. Is there a way to do this without finding every record that has one of these special characters and then replacing it?
Weird Characters In Mysql Database
I'm having some problems with one of my mysql databases. In my data there's some weird characters that's looking terrible when viewed in firefox. IE seems to ignore this character so it doesn't show up. Now to the question, does anyone know how to remove these "characters" from my data? I've attached an image which shows my problem since it's quite hard to explain with words.
MySQL Outfile Escaping Characters
SELECT people_id, people_fname, people_sname FROM people WHERE people_id IN (1, 2, 3) INTO OUTFILE '/home/test.csv' FIELDS ESCAPED BY '' OPTIONALLY ENCLOSED BY '"' FIELDS TERMINATED BY ',' LINES TERMINATED BY ' ' When executing this statement in SQL Yog i get this error... Error Code : 1064 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 'FIELDS TERMINATED BY ',' LINES TERMINATED BY ' '' at line 1 This is being used for a java service to export results to a csv file. I honestly can't see what is wrong with this. I want to use a backslash to escape chars that need escaping and a double quote to enclose fields. Both of those characters for the query need to be escaped i would think.
MYSQL REGEXP (Special Characters)
I am currently using PHP and MYSQL, and I would like to know all of the characters I have to denote with a backslash . I know perl and php are ". + * ? [ ^ ] $ ( ) { } = ! < > | :" What would MySQL be?
Null Characters In Mysql Log File
we have noticed that our log files are enormous in size prior to compression (most recent is 2.5 gigs) and that these log files seem to contain a great deal of null () characters in set locations throughout. We are running Debian stable with a locally compiled and installed mysql 4.0.16-2. The nulls appear in the following manner in the logs:
Mass Replace Characters With MySql
I want to mass replace three htlm character sets in one field in all records in my db. The field name is Subtopic and the db name is ViewTest. I want to replace <br><br><br> with <br><br> in all records. Is there a way to to this?
Mysql 4.1.11 Unicode Problems With Some Characters
I've had a long battle with displaying unicode from mysql 4.1. I've had it working locally to test but many characters (some japanese and russian) dont display correctly. I've narrowed the problem down to the database itself. If i connect from my hosting provider to my home computer database, it works fine: http://www.spainexchange.com/test.php but when conecting from my hosting provider to the database on my hosting provider - you can see the character display has problems: http://www.spainexchange.com/test_remote.php We are using the same version of mysql, except they are on freebsd linux and i am on windows. Can anyone see where the problem may be?
MYSQL MATCH AGAINST Search, ASCII Characters, Etc.
Well, I am trying to make an internal site search for sometime now, and now I'm having this problem. I have non english characters, like é, è, ç, à, etc. These characters are stored in the database in ascii format. Now let's take a name Ségolène, this is stored in the database as Ségolène Now to search that out, I need to make the word as "Ségolène" (double quoted). Problem is, if I double quote, I get exact non english words, but I can't get nearby words, like I can't get Ségolène just by typing Ségo. As, to get Ségolène by typing Ségo, I need to make ségo* and this * and " " are not matching together.
Japanese Characters In MySQL 4.0 - Character Sets?
How do I insert Japanese and other foreign characters into a MySQL 4.0 table? (4.0.27 to be specific) In other words, how do I specify a UTF-8 set for a database or table or column. MySQL 4.0 doesn't seem to support character set definitions the same way that 4.1 does, and I'm having trouble locating how to do it in 4.0. Right now if I insert Japanese characters they show up as character codes like '& #25658; & #24111;' (without the spaces) in the table. While this displays properly if used to make content on a page, I'm not sure if a search engine will pick it up right.
Inserting Special Characters Into MySQL Database
I am trying to add products to one of my clients' online shops and in the past it's all gone fine. I have a PHP script which handles a CSV file upload, digests the rows and inserts the data into a number of tables. The upload I did today seemed fine until I realised that certain products have appeared with a ? in the name or description where there shouldn't be. Checking in the CSV, I find that the client has added a few hundred new products whose names include 'Hahnemühle Albrecht Dürer' (the product supplier) and other products whose names &/or descriptions include the micron symbol 'µ'. As you've probably guessed, the characters which are being replaced are ü and µ. FYI, the site is still using MySQL 3.23.58 - I know it's old but we've just persuaded the client into a new .NET and MSSQL site re-design starting in a couple of weeks and we'll be dicthing that server so upgrading isn't an option. I guess that I would be doing a search and replace for these characters in PHP (by ascii code?) and then inserting into the database. Then doing the reverse when displaying the product on the page?
Filtering Odd Ascii Characters From MYSQL Input
My users are sometimes pasting "funny" quotation marks into their FCKEditor, also some kind of elongated hypen. How can I filter these out before writing the user input to mySQL? Obviously I could filer each one out, but I rather like something more generic.
Mysql Client Dont Write Russian Characters
I installed MySQL 5.0.24 and have so problem.I can't type russian characters in mysql client. Database has data in koi8 encoding (from dump, from php form...) and this data correctly shown.But when I switch encoding to russian in mysql client cursor stops moving independent from my keys pressing,when switch it return to English and typing continued.For example,I enter: select fld from tbl where fld="russ",if "russ" in koi8 I cann't type this characters. It is possible type russian characters from OS command line: mysql -p -e "select fld from tbl where fld='russ'" dbname. In this case whole query text will be entered and correctly executed. If anybody know how possibly decide this problem write me please. My OS is ALTLINUX 3.0 : LANG=ru_RU.KOI8-R MySQL's variables: | character_set_client | koi8r | character_set_connection | koi8r | character_set_database | koi8r | character_set_filesystem | binary | character_set_results | koi8r | character_set_server | koi8r | character_set_system | utf8 | character_sets_dir | /usr/local/mysql-standard-5.0.24-linux-i686/share/mysql/charsets/ | | collation_connection | koi8r_general_ci | collation_database | koi8r_general_ci | collation_server | koi8r_general_ci
MySQL LOad Data Infile Problem With Japanese Characters In Linux
I am trying to import a data file wich has japanese characters (sjis encoding). I am having problem loading the datafile into database using LOAD command in linux. The same command works on Windows though (Reagion set to Japan, Language Japanese without using any of the settings. I have created the database using character set set to sjis. Table type is InnoDB and char set is sjis. My MySQL server version is 5.0.16 on RedHat EL 3.0 AS (English and Japanese language support). I have set the following sys variables;
Invalid Use Of Group Function (was "Baffled By Query Error")
trying to figure out why I keep getting this error with the following query: SELECT c.account_id,a.name,a.company,SUM(c.agent_product_time) AS mins FROM account a LEFT JOIN calls c ON c.account_id = a.id WHERE c.calldate >= DATE_SUB(NOW(),INTERVAL 14 DAY) AND c.agent_id = 2 AND SUM(c.agent_product_time) >= '500' GROUP BY c.account_id ORDER BY mins ERROR: #1111 - Invalid use of group function
How To Add ... After # Of Characters?
Can somebody tell me how to add ... after a certain number of characaters that are pulled from a column in a MySQL database? I've tried this but for some reason it isn't working: LEFT('entry_excerpt', 40) as excerpt
ë Characters
I have a type of car in my database : Murciëlago . I have entered this directly in the db. But I can't seem to get it out right. Can anyone tell me how to handle these things ?
20-30 Characters
How to make in MySQL search results displaying 20-30 characters before and after the search word so that users can see what they found (like Google or Altavista search, you know). It could be something like SUBSTRING(-30, ‘%$search%’, 30), but it does not work of course. I spent the whole day trying to make it and no results! Can you please help me with that?
15 Characters
Say I have "medium grey jumpsuit" as a post title, but i only want to display the first 15 characters from it. how can i do so
Western Characters
When I populate a table with "MySQL command line" and insert French characters like "é à " and then query the database with "MySQL query browser" I've got corrupted characters. Same is true vice-versa. My OS is Windows XP (French). The server MySQL 4.1.7 is configured with character set latin1 the same for the table and field.
|