Extract Unicode Data From MySQL Db

I have a little, big, boring problem :)

I have a utf8 txt file to import in a MySQL db, cause I must create a
web-application in PHP for reading this information on-line.

I have create a new DB in MYSQL 4.1.1a setting CHARACTER=utf8,
then I have create a table t1 with character set utf8 and some fileds
also with CHARACTER=utf8.

Then I imported the Txt file (really in UTF8 format, with 22600
records!) in my db. MySQL have imported the non-utf8 field correctly,
26000 records.
When I try to read this utf8 filed they appear like "?-?-?".

Then, also my PHP application show this field with stranges
characters. I have try also with PHPfunction utf8_encode with no
success :(



ADVERTISEMENT

Accessing Unicode Data From A MySQL Database With It

I am a training developer in .NET and web 2.0 technologies and this one is an exercise from one of our first lessons in PHP: accessing a MySQL database from a PHP script. The problem I've encountered is that while database is thought to be in Unicode (i.e. the values contain accented characters, as this exercise is in French), the PHP script result in garbage characters (actually just one, a enlongated rectangle).

The exercise consists of a PHP script and a MySQL database with two tables where the script queries all entry data from one column in just one table (so no joins necessary). The MySQL table is called "Restaurant" - well, actually this side isn't that much important yet. (Which means I'll come back to that later.)

<?php
mysql_connect("localhost","root","");
mysql_select_db("Restaurant");
$myQuery = "SELECT LibPlat FROM Plats";
$rs = mysql_query($myQuery);
[code].......

My setup consists of Eclipse with PDT and Zend Debugger (latest version, i.e. 3.5.1 and just updated). I use Zend Server CE with its MySQL install (phpMyAdmin). Basically the script does just what I've been asking it to do, except that the French accents (like in thé or café) don't appear (there's this rectangle instead).........

View 7 Replies View Related

Jquery: Ajax Retrieving Unicode Data From MySQL

i managed to SAVE unicode data using jquery ajax call, but when i try to retrive back using jquery and ajax i cant pass array of unicode data using json_encode, the unicode data were changed to NULL from my php page, this one give back the same data

[Code]....

in my jquery page

[Code]....

if i add json_encode, the result in my jquery call is NULL

[Code]....

in my jquery page

[Code]....

View 1 Replies View Related

Insert Unicode Data Into Mysql Using Script From The Command Line?

I am running this php code from command line that fetches text (may contain unicode characters) and insert into a mysql table. I verified that the php variables have the unicode text, but when it does an insert, the table columns are blank. I can accomplish the same with an html form without any issues. The table charset is utf8 and i use set names utf8 before the query.

View 1 Replies View Related

MySQL 5.0, FULL-TEXT Indexing And Search Arabic Data, Unicode

MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode

[This version has a couple subtle edits from the orginial I posted
on mailing.database.myodbc - I'm cross posting here on this
topic/subject related newsgroup]

I was wondering if anybody has experienced the same issues
challenges I'm experiencing I'll describe shortly. Once
resolved some fascinating and powerful multi-lingual
apps incorporating non-English/latin character sets can be
realized by many developers.

I have a Unicode utf8 English - Arabic - Hebrew - Greek (and
several other languages) database in Microsoft Excel. I KNOW
that it is Unicode utf8 data because MySQL tells me it
recognizes the encoding as such but not in the context I want.

Allow me to explain ...

I can search the Unicode utf8 encoding with no problem in
Excel. While in Excel I highlight a complete word or a
partial string of an Arabic word copy it to the clipboard
(i.e. memory). I then do a find and the process is the
same successful result as if it was an English string.

MySQL 5.0 is supposed to handle Unicode utf8

I created a MySQL database I named: languages

CREATE DATABASE languages ;

and I implemented the following command on a MySQL
command prompt:

ALTER DATABASE languages DEFAULT CHARACTER SET utf8;

No problem (so far) MySQL seemingly recognized utf8 and
accepted it. My understanding is with the ALTER command
the tables I create against languages will be utf8.

I now created a table I named mainlang which denotes it
will be the main table for my languages.

mysql>CREATE TABLE mainlang
->(
->langNumID varchar(30),
->colB varchar(30),
->colC varchar(30),
->primary key (langNumID, colB)
->);

Again so far no problem: Table successfully created.
My third column 'colC' is where the Unicode data
will be stored.

I now attempt to import the database from my
Excel file into my MySQL database as follows:

mysql>load data infile 'c:arabicdictionary.csv'
->into table mainlang
->fields terminated by ','
->lines terminated by '
'
->(langNumID, colB, colC);
ERROR 1406 (22001): Data too long for 'colC' at row 1

So what to do? I did a search and found other
people seemingly had the same problem and someone
suggested:

ALTER DATABASE languages DEFAULT CHARACTER SET cp1250;

I dropped mainlang, recreated it, redid the load and
Lo and behold ... it seemed to work. No Data too long
error occurred and when I did the following query:

mysql>select langNumID, colB, colC
->from mainlang
->where colB = &#55617;&#57074;'

I see colA have a correct numeric value, colB a
correct numeric value (4994) and for colC a string of
unintelligible characters with diacritical marks,
oomlats etc. which I know is the cp1250 encoding
interpretation of the Unicode utf8 data which is
similarly unintelligible in its own regard.

Now what I try is: do a copy of the obscure colC
cp1250 character string into the clipboard/memory
and then do the following tweak on the original
select statement to see if I can search on the
(now) cp1250 character string:

mysql>select langNumID, colB, colC
->from mainlang
->where colc = 'paste of the cp1250 character string'

The computer would not allow a paste unless I pressed
the escape key. On initiating this select command
I got an empty set (no match)

My questions are:

Has anyone been successful creating a Unicode utf8
MySQL database that accepts Arabic?

If yes, how did you get around or not encounter the
Data too long issue?

Have you tried the cp1250 (or cp1251 - same mechanics
same results) work around as I have? Are you
able to search the cp1250 character string (my colC)?
If yes, how did you successfully manage to do it?

Lastly, if I take the cp1250 encoded string and paste
it into Excel ... I can string search the cp1250
encoding with no problem.

Also, here's how I know my Unicode utf-8 data is
correct apart from my own manual cross-referencing
and being recognized by MySQL in some respect:

When I copy the Unicode utf8 encoding and try to
paste it into the select command to see what would
happen I get the following error:

ERROR 1257 (HY000): Illegal mix of collations
(cp1250_general_ci, IMPLICIT) and
(utf8_general_ci, COERCIBLE) for operation '='

So what I have here is a situation where MySQL
is recognizing Unicode utf8 encoding but not
from the respect of packing a table!

Go Figure ...

View 1 Replies View Related

MySQL Data - Extract Data From 2 Different Sources?

I've got my pagination script working, but now I m trying to get it to extract data from 2 different sources.
The episode data is stored in table episodes, whilst the main table (where the info on airdates for episodes is stored in epdata2).

This is my code:

<?php
/***********************************
* PhpMyCoder Paginator *
* Created By PhpMyCoder *[code]....

Basically, what I'm trying to do is select certain records from the episodes table, and have them with certain airdates, stored in the datetime format, similar to this:

2010-04-26 13:00:00 13:30:00 Episode 1
2010-05-04 00:15:00 00:50:00 Episode 2

I'm trying to get it to remove the record after it expires (i.e. hide it) - one bug I found today was the event disappeared during it, at 10:09am it did not show, despite the fact the event expired at 10:30am. (this is UK time, GMT).

View 1 Replies View Related

While Loop To Extract Data From Mysql

I am using the following code to extract from mysql a users shopping basket. What i want to be able to do is to get all the information that is displayed by the while loop and be able to submit all that information in a hidden file:

ie <input type="hidden" name="desc" value="$whatever"> $whatever being the information generated by the while loop.

while ($row=mysql_fetch_array($sq1_result)){
$code=$row["CODE"];
$description1=$row["DESCRIPTION"];
$cost=$row["COST"];
$quantity=$row["QUANTITY"];
$price=$row["PRICE"];
$total=$row["TOTAL"];

View 6 Replies View Related

Error In Php For Mysql Data Extract

What is wrong with this at line 15 ( } else { ) error out. Im trying to pull data from database and display on page. It all worked till I added the if( . Also I need some idea about how to keep this output sheet a little more current.

What I mean by this is the current code desplays by Race_date desc, How would I get it to remove anything older than say 2 weeks. Code:

View 8 Replies View Related

Failed To Extract The Data From Mysql Db?

I have a bit of trouble as I am trying to extact the data from mysql database when I enter the url as something like this:

[URL]

PHP Code:

<?php
session_start();
define('DB_HOST','localhost');
define('DB_USER','myuser');
define('DB_PASSWORD','mypass');
define('DB_DATABASE','mydbname');

[Code]....

View 3 Replies View Related

Extract Data From Pdf & Enter Into Mysql Database?

how to extract data from pdf & enter into mysql database in PHP.

View 4 Replies View Related

Separate Extract Data From A MySQL Database

Is it at all possible to extract date from a MySQL database with a while loop and assign each value extracted to a new unique variable?

View 1 Replies View Related

Extra Backlashes - Extract Data From Mysql Table

I have an issue that when I extract data from mysql table it's including backlashes with quotes. Example if I enter "james" in the table when I extract the data I get "james" Is there a function to correct this issue? This is a remote server and I don't have access to the PHP.ini file am using the code below to enter a value into the table

trim(mysql_real_escape_string($value))

I am using the follow code to retrieve the data

<?php echo $row['value_name']; ?>

View 2 Replies View Related

Extract Data From File Save Into Mysql Database?

This should be a code igniter based class,The table header should be Price Percent_change Company Name Company Code Volume

View 2 Replies View Related

Preg_replace With Unicode Chars - Allow Only Numbers / Letters And Unicode

I've a question similar this question: php preg_replace In that question, He/She want to allow only letters and numbers and _, but I want to allow only numbers, letters and Unicode (non-latin) letters and numbers (I think, I should use the Unicode values of this (for example U+1F70)).

View 1 Replies View Related

Echo RAW Data From Unicode Page?

How can I print raw data (string) from a UTF-8 .php file?

Simple

echo $var

ouputs unicode string to browser (with unicode prefix bytes), but if I
want to ouput BLOB data (jpeg file)?

View 2 Replies View Related

Display SQL Server Unicode Data?

How to display SQL Server Unicode data

[Code.......]

View 2 Replies View Related

Losing Unicode During Passing Unicode Char?

I want to store in array pairs of unicode chars (char, number of instances of the char), but I have some problem with passing unicode chars:

This code:

[code]...

displays:

array(6) {
[0]=>
string(1) "�"
[1]=>

[code]...

and for me it is a result, which I want to achieve.

EDIT: Replacement for str_split (length=1) for unicode chars:

function mb_str_split( $string ) {
# Split at all position not after the start: ^
# and not before the end: $

[code]...

View 1 Replies View Related

MySQL 4.1 / PHP 5.0 : Unicode Problems

I have been trying to build a website that has multilingual support
using the LAMP setup. I have created tables that store language
information and correlate different strings ids with languages. The
strings are all VARCHAR with unicode (utf8) encoding.

I have tried all the ways that I could think of and I have checked
every website to no avail. What I am trying to do is simply open a
connection to the database (using mysqli) and query the tables for one
unicode string entry. Then I call fetch_object on the result and print
it to an HTML document. This fails with me. The characters I see are
not unicode but either ??????? or some weird character. Aparently the
encoding turns out to be ISO-8859-1.

I have done the following:
1. Create the entries in the MySQL tables as unicode in InnoDB tables.
Unicode text shows up properly in phpmyadmin.
2. Query correctly to the best of my knowledge using mysqli.
3. Add the proper header encoding to the http header and add this meta
tag to the html:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

Everything I have read says that this should work even though PHP is
notorious for unicode support. What I have been able to narrow down the
problem to is that the string that I get back from the database is
latin encoding. I know it is unicode from MySQL (phpmyadmin), so I
assume the problem lies in the mysqli_query function call or with the
fetch_object call.

View 3 Replies View Related

Json_encode And Mysql Unicode?

i have the following javascript code:[URL] Which works fine(the makewindows function has been changed to show it is a php variable), however the html contains unicode characters, and will only be assigned characters leading up to the first unicode character. If I make a small test file and echo out article_desc directly, all the html is output, although quetsions marks are displayed instead of the correct symbols. However json_encode seems to cut short the html, resulting in errors.

edit: here is a dump straight from the mysql database of the html I am trying to display:[URL]

it says utf-8 in the source. the actual page code generated from echoing out article_desc is here:[URL]

it is definitely the same record, so I am unsure why it seems to very different.

edit: this was fixed by calling: mysql_query('SET NAMES utf8');

View 4 Replies View Related

Unicode Form Data - How To Obtain Character Codes?

We have a form through which unicode data might be submitted. We need to be
able to detect when this happens and, most importantly, we need to be able
to obtain the unicode character codes for each individual letter/symbol.

Is this possible in PHP? If so, can you please provide a short code snippet.
We looked at the mbstring extension but found nothing helpful, especially
since the documentation is less than satisfactory.

View 1 Replies View Related

Access A MS SQL 2000 Database With Unicode Data In Nvarchar Fields?

We need to access a MS SQL 2000 database with unicode data in nvarchar fields from PHP (on IIS). nfortunately PHP's MSSQL does not support this. Unfortunately we cannot use a different driver (like ADODB) - we're stuck with the application (Interspire KM) and can't rewrite it. Is there anyway to get PHP's MSSQL driver to talk to Unicode databases?The error message when we do UPDATEs is: Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC versionGoogling for a solution turns up the suggestion that we revert to varchar. However, if we do this, special characters (like "ü") get stored incorrectly and the search does not work so this is not really a workable option.

View 2 Replies View Related

Import Excel To Mysql Unicode Issue

i have a script which you can view below that will import a .csv file into a mysql table, however i get errors due to the various special characters in the spreadsheet. is there anyway i can get around this. Code:

View 1 Replies View Related

Unicode Characters From JSON.stringify To Real Unicode Characters?

I use JSON.stringify() function to stringify JS objects for AJAX sending to PHP. The problem arises when JSON.stringify function encodes unicode characters to format uxxxx (eg. u000a). My question is how to convert those characters to regular unicode characters in PHP?

View 1 Replies View Related

Extract Data From XML

I am trying to set up a very basic CMS using PHP and XML files. What i need to do is extract specific data from the xml file to display on each page. ie when the user clicks a link the php reads and sorts the xml file to retrieve the required data to display.
eg: We have an ID tag in the xml file, when a user requests the item with that id we would like to search the file and simply return the data for that id attribute.
Can anyone suggest a quick way to do this using PHP?

View 5 Replies View Related

Extract Data

Is it possible for PHP to parse another wesite and extract some data from it? For instance, I have a website that sells gold jewelry and i would like the price of the jewelry to change based upon the price of gold that day.

I want to get the price of gold from a different website by parsing its page and extracting the price and then do my caculating in PHP and display the new price automaticaly each time the page is loaded. Is this possible?If not,what language would I need to use?

View 2 Replies View Related

How To Extract XML Data

I am required to extract the information at a particular "area" of this large collection of xml. But i'm not familiar with extracting xml. I've looked through the site and tried various ways but all i get back is "Error in my_thread_global_end(): 1 threads didn't exit"Here's the url of the xml i'm getting my data from:ftp://ftp2.bom.gov.au/anon/gen/fwo/IDV10753.xmlI would to retrieve all the 7 forecast-period located only for the Swans Hill "area".

View 2 Replies View Related

How To Extract Data

How do I extract the data from that XML object, which is a value of a certain array:

[Code]...

I did a foreach of the array like:

foreach ($ArrayName as $FieldLabel => $FieldValue) {
$Variable = $FieldValue[0]....
}

but still, it gets the whole XML object as the field value. I wanted it to extract the value only not the whole object.

View 1 Replies View Related

Extract Data From URL

The visitor comes to the site via a 'personalised' value - http://www.mysite.com/?384
as I would like to be able to 'track' the user using this value (348) so need to extract this data for later.

I am able to print out the /?384 part using $REQUEST_URL, but when I try and write it to a log file (or send using the mail() function) it doesnt' seem to work.

The code I'm using for writing to log is simply:
$entry_line = "Username: $username | ID: $REQUEST_URL
";
$fp = fopen('logs.txt', 'a');
fputs($fp, $entry_line);
fclose($fp);

I also tried defining:
$number = str_replace("/?", "", $REQUEST_URL);
to see if I could just log the variable $number, but to no avail as it remains blank.

View 4 Replies View Related

Extract Data From XML?

I need to extract data from some XML. I have found a few sites that explain that part to me, however there is a section of the data which I need to extract and am not sure how to go about it. Below is an extract of the XML, the section I am trying to extract is highlighted in red (it is essentially a text message being sent I am trying to get the contents of the sms/text message):

<usa_smpp_host>THTTP</usa_smpp_host>
<short_message>id:660352946 sub:001 dlvrd:001 submit date:1102081032 done date:1102081035 stat:DELIVRD err:000 text:Test SMS message</short_message>
[code]....

View 6 Replies View Related

Unicode Support - Using MySQL 4.1.7 Collation Utf8 And Char Set Utf8-general_ci

Subject: We have some problem with utf-8 encoded characters in PHP.

Using MySQL 4.1.7 collation utf8 and char set utf8-general_ci, we are storing German, French, Spanish and turkey, Nederlandâs etc.. Characters, those special characters are storing properly in MySQL.

But when extracting those characters using PHP into variable and want to replace special characters with relevant Umlautâs, PHP unable to recognize the Special characters.

Please let me know reason, why PHP 4.3.11 does not support utf8 8-bit characters?? How do I achieve the replace functionality with utf8 characters in PHP.

View 1 Replies View Related

Extract Data That Was Placed In My DB By FCKeditor

I am trying to extract data that was placed in my DB by FCKeditor. I am using this to put into the WYSIWYG editor screen.

The content in the DB looks like this:

View 1 Replies View Related

Extract Data From XHTML Tag

I try to get the contents behind the tag name....

View 7 Replies View Related

Extract Data From Spreadsheet

I need help with extracting data from a spreadsheet, such as an excel file and importing that data into a static html file. I don't want to import the whole file into one page, want specific information on specific lines and to import that data to thepage/product it belongs to on an individual bases.

The main issue is that I have pricing information in an excel format that updates fairly often. There is around 10,000 products total, and updating is a nightmare. I want to insert a line of code into each product page that will extract the relevant prices from the spreadsheet for that product. The order and line number is always the same for the spreadsheet and each line is specified by a product ID number.

View 1 Replies View Related

Extract Certain Data From Page?

For example if a source had links that were all like http://server.com/dir/file.ext?id=1234567 and I just wanted to extract all of the the numbers after the id= how would I do it? There would be a lot of different links with different id's and I'd like to extract all of them.

View 3 Replies View Related

Parse/Extract Data

I am using cURL to access a remote search query. I am having no problems getting the data, but parsing it into something more usefull is causing me some trouble.

I want to strip out all of the "header data" (everything from <html>.......<table>[GOOD DATA]<more junk>)

I am guessing that Regular Expressions are probably the best way to go, but I have the slightest idea of how to begin.

View 1 Replies View Related

Extract Data From A Variable

I have a variable called: $data_response; It is the response given to me by a gateway, and it basically prints this out:

response=1&responsetext=SUCCESS&authcode=123456&transactionid=123456789&avsresponse=N&cvvresponse=N&orderid=TEST105&type=sale&response_code=100.

View 1 Replies View Related

Dynamically Extract Data From XML?

I have a string variable, containing XML data and I was wondering if there is an easy way to extract fields and data from the file. Through an iterative generic way, without specifying name of the tags in the code.

View 2 Replies View Related

Extract Data From An Array?

So i am using jQuery to append a form with more input fields; The Session is storing the data as an Array for the key: Children.

I would like to know show the user the data in that array how would this be done?

jQuery that adds the input fields (some pages previous)

$('.children-main-add').click(function(){
var attrName = $(this).attr('name');
var count = $(this).attr('count');
$(this).attr('count', (parseInt(count)+1))

[Code]....

The data from the session : Key: children / Value: Array

View 1 Replies View Related

Extract All The Data From A Database?

I am wondering how to extract the data from a table in a database onto a table in a page (users.php),

For example: I want to be able to get all of the usernames and all the id's from my database onto a table.
So if I have in my database:

1 - Fred
2 - Frank
3 - Margret

It will see that I have them user's and id's in the database and print them onto a table.

View 3 Replies View Related

Extract Data From A Database?

I need help with this code,I manage to extract data from a mysql database and convert them to a format required by Highcharts.

<?php
$query =mysql_query("select
date_format(connect_time,'%Y-%m-%d %H %i') AS date,
Customers.name as customer,
Sum(duration) as secondes

[code]....

The problem with this code is that it's only displays data from a single customer, so that the query returns data from multiple Customers.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved