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




Cannot Retrieve Data In Utf-8 From Php


I have a IIS server with php3 installed. I have SQL server database
and data stored in unicode format (nvarchar fields). In header of my
php I have the meta: <meta HTTP-EQUIV="content-type"
CONTENT="text/html; charset=UTF-8">.

I have the following problem:

- I trie to do a query using ODBC (version 3.525.1022.0) and SQL
Server odbc driver (version 200.85.1022.00). The query doesn't
retrieve information in utf format and accents and extra characters
aren't showed correctly.

- I trie to di the query usin native OLE DB. I use mssql funtions and
the problem is the same.

If I install php4 and I use "new
COM("ADODB.Connection",NULL,CP_UTF8);", then it works correctly.

Anybody knows if its posible to retrieve data from sql-server in utf-8
format using php3?

I see in other postings that odbc driver only accept utf-8 in version
3.7 or higher? Is it true? If is true, where I can download odbc
driver 3.7?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Use PHP To Retrieve Data From A PDF
I am looking for a tutorial, script about how to use PHP to retrieve data (Ex: filled customer input in a PDF file) from a PDF file and store it as a XML file.

Is There A Another Way To Retrieve Data From My Database
Is there another way I can retrieve and display the data in the
database. Am completely exhausted by this script.

Using A Hyperlink To Retrieve Data? Is It Possible Without?
I was wondering if it is possible to get data from a database using a hyperlink instead of a form? My situation is I have a page with a list of products (data from a mysql table) and I want to keep the info on the page small so I have limited the description and left out some info. what I want is a link at the bottom of each product that says "more details" and when clicked it creates a new page on the fly to show more info. is it possible to do this without javascript? If so How.

Can't Retrieve Data From The Net With File_get_contents ?!
for some reason i keep getting :

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed:
Temporary failure in name resolution in
/home/rob/www/php/filegetcontents2.php on line 3

Warning:
file_get_contents(http://folding.stanford.edu/teamstats/team92.txt): failed
to open stream: Resource temporarily unavailable in
/home/rob/www/php/filegetcontents2.php on line 3

when trying to retrieve a page of text (stats for a distributed computing
project) from the Net like this :

$personal =
file_get_contents("http://folding.stanford.edu/teamstats/team92.txt");

i also tried implode/file ... same error.
but when i fill in the URL in Mozilla it is retrieved just fine and no
'temporary failures' at all ?!

what could be going wrong with the name resolution ?

Retrieve Data From Mysql
i have this code:
<?php
// Connects to your Database
mysql_connect("localhost") or die(mysql_error());
mysql_select_db("eurialz") or die(mysql_error());

//This code runs if the form has been submitted
if (isset($_POST['submit'])) {

//This makes sure they did not leave any fields blank
if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] | !
$_POST['name'] | !$_POST['gender'] ) {
header("location: register.php?error=yes");
exit;}

// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username =
'$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);

//if the name exists it gives an error
if ($check2 != 0) {

header("location: register.php?error2=yes");
exit;

}

// this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2']) {
header("location: register.php?error3=yes");
exit;
}

// here we encrypt the password and add slashes if needed
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
}

// now we insert it into the database
$insert = "INSERT INTO users (username, password, name, gender,
dobmonth, dobday, dobyear)
VALUES ('".$_POST['username']."', '".$_POST['pass']."', '".
$_POST['name']."', '".$_POST['gender']."', '".$_POST['dobmonth']."',
'".$_POST['dobday']."', '".$_POST['dobyear']."')";
$add_member = mysql_query($insert);
header("Location: newmember.php");
?>

Send Data To Db And Retrieve
After a visitors submits the form, the data is saved in database table in a new row and a unique ID will be given to that row.

I am trying to work with the data after it has been created by retrieving the ID. I want to send the ID to payment page, and after the payment is complete, change one field in that row to show that the payment is done). I don't know how can I get the ID for that record back from the database so I pass it on to next script.

Retrieve Data Into Html Form
I want to retrieve fields from mysql table into html form to update those fields.

Retrieve Data From The Database And Populate
I know how to fill data in text boxes and submit to the database and retrieve from the database. But how do you retrieve data from the database and populate a drop down menu?

Retrieve Data From Unlimited Level
I have a function to create unlimited sub sub folders, and now i want to retrive the sub sub folders according to their level in a drop down box. something to be display in a drop down box like below for user to select:

Retrieve Data From Text File
I have a text file (accounting information) which contains a lot of information and some of this information (numbers) I want to retreive (import to a php script) and be able to use some figures in calucations etc. Here is a piece of the text which shows the build up of the information I want to use: Code:

Retrieve Randomly Data From Database
I have store in a database some question with four answers for each question.
I want retrieve randomly 20 questions from the database. Also I have to mix the answers as I echo them out… Do you have any idea how can I do this?

Retrieve Data Based On The Dates?
I have been searching everywhere on the net on how to retrieve data based on the dates. for eg. today's date. Is it possible to do this? If yes, how can it be done?

Retrieve Data From A Site's Xml File
actually, i don't know where to get the xml file of the particular...how do i get the file ? is there a way to get the xml file with php ?

Retrieve Data From Multiple Tables Via Combo
I am working on a small project to create a single web page which retrieves data from 3 tables.

The first table is retrieved by a combo box. It only contains the primary key of the table. I know how to get the data in the combo.

The second table contains other information, related to the primary key of table 1. I know how to retrieve all the data, but not how to retrieve only the data of the selected primary key. I think I should work with a WHERE clause in the SELECT statement, but I have no idea how to get to the selected value.

The third table should work in a similar way, so when I have an answer for the second table, I can also use it for the third table.

Retrieve Data From Mysql Table And Put A Hyperlink For Download
I have created a database and a table and have stored the information in mysql table.
Now my question is how do I retrieve that data from the my sql table and have a php page that when someone goes to say:download.php, he/she will be able to download the data from my mysql table? Also what if I have multiple tables in mysql that I want to be able to download from the php file?

Store While Statment Data In Array Using Session And Retrieve?
I wish to store retreve value from my sql using session array and retrieve this value.
here is my while statement, which is displaying records from my database. I want to store all this value in an array using session and than retrieve this value on click of the table row. Code:

Retrieve Data From Table With Multiple Returned Variable
I am trying to set up a function to recalculate prices for my products - (per product that is) The problem I am having is that I have a table that stores the prices for each client type (so one product can have multiple prices) so I need to be able to recalculate the price for each client. Code:

Retrieve Formname
In my PHP script I want to put the name of the form, i'm currently in, into
a variable.

So far I haven't found an answer!

How Do I Retrieve $Variable From URL?
How Do I Retrieve $Variable From URL? I am designing a user registration section for a web site. "Page One" below contains excerpts from the user input form and "Page Two" below contains excerpts from the script that 1).inputs the data into the database and 2).sends an e-mail with the $UserName variable appended to the URL. Pages One and Two work just fine. Page Three is where I'm having the difficulty.

My question is this: How do I get the $UserName variable that is appended to the URL on page two (that is subsequently sent in an e-mail) to insert into the "UPDATE $TableName..." query shown below on Page Three? PHP Code:

How Do I Retrieve The Next Record?
I am searching the mySQL DB for a particular item num. When it retunrs the result I want to be able to go to the 'NEXT' and 'PREV' records in the order of the Table. Do I first need to put in an auto increment or index column?

Retrieve Body Tag
If I have a body tag that looks something like this <body id="home
page"> where each page on my website has a unique "id", is it possible
to retrieve the body tag in PHP and pass the id along as a variable?

Retrieve All Pics From Url
I want to get all pics (.jpg) from a url and I use this code but sometimes
with some urls it doesnt work :(
Anyone can check it out?

$text = implode("", file($url));
$text = eregi_replace("<!--([^-]|-[^-]|--[^>])*-->","", $text);
while (eregi("[:space:]*(img)[:space:]*=[:space:]*([^ >]+)", $text, $regs))
{
$regs[2] = ereg_replace(""", "", $regs[2]);
$regs[2] = ereg_replace("'", "", $regs[2]);
$regs[2] = preg_replace("/(s.+)/" , "" , $regs[2]);
if(eregi(".jpg|.jpeg|.jpe",$regs[2])){
echo $regs[2]."<br>";
}
$text = substr($text, strpos($text, $regs[1]) + strlen($regs[1]));
}

Retrieve String From URL
i have the following URL : www.mysite.com/Rates/USA/1/China/2
i wana extract the two countries from this URL ( USA and China)
N.B: this URL is rewrited using mode rewrite.

Retrieve Arrays From URL
how would you go about getting an array form the URL?

can you just post it like this "domain.com/index.php?array=1,2,3,4

and then use: <?php
$array = $_GET['array'];
and then the array would read as:
$array[0] == 1
$array[1] == 2
etc...

Retrieve Info Via Id
How can I retrieve data from my database based on the item's id and how can I built it up on one page dynamically?

How To Retrieve An Image From Mysql In Php
I upload an image into mysql database as blob type. Now i am trying to retrieve that image to display in php. But its not displaying the image. Can i know how to retrieve/ display image in php.

Retrieve Filenames From Directory
I have a directory with images, of which I need to place the file names in a column in a MySQL db. There are two files for every image: image.jpg and image_t.jpg (the thumbnail for image.jpg)

What I would like to do is strip the file extension (as well as the '_t.jpg') from the filenames, and just enter the 'root' filename (image). This way I have only one db entry per image pair.

Retrieve ONLY First 100 Words Of The Paragraph From DB
This is just a simple data retrieve from database. What I need to view is ONLY THE FIRST 100 words from one of the columns of the members table. Code:

Retrieve URL Array From $string
Is there a way to retrieve an array of URL's from a text string? For example:

$string = 'This is a <a href="www.site.com">string</a> of text with 2 URL's, one of which is http://site2.com'

I want code that gives this array:

$url_array = array('www.site.com' , 'http://site2.com')

Retrieve <TITLE> In Php Code ?
Simple question, but headache !

I have a PHP Page like :

<HTML>
<HEAD>
<TITLE>Sunny day !</TITLE>
</HEAD>
<BODY>
<?
echo "The title of this page please (Sunny Day !)"
?>
</BODY>
</HTML>

I think that you have understanding my problem : How to retrieve the
title of my page ?

Not Able To Retrieve Session Vars
everything seems to work fine when I test if a session variable is stored on the page that is was stored (after login I print off the login name stored in the session object). I then remove the test print statement and put in a header("Location...) to forward the user to the next page. It is at this page that I seem unable to retreive the session variable. I check the folder where the session objects are stored and the object file is still there, but.

How To Retrieve An Oracle VARRAY
I am using PHP 4.4.4 with Oracle 10g Express Edition on Windows XP.

I am trying to emulate in Oracle the SET datatype in MySQL and the ARRAY
datatype in PostgreSQL

I have the created a user-defined datatype as follows:

Code: ( text )

How To Retrieve Javascript Object Value In PHP ?
I want to set an initial text in a TEXTAREA based on the value selected
in an earlier SELECT box in the same document.

I tried something like

$init_text=set_init_text() ;
<TEXTAREA>
<?php echo $init_text ; ?>
</TEXTAREA>

function set_init_text() {
return <script>
document.forms[0].SelectBox.options[document.forms[0].SelectBox.selectedIndex].value
</script }

But I get a php syntax error with the <script> tag.

What's the correct way to do it ?

Retrieve Multiple Select
How to retrieve multiple selected value from select component with multiple
attribute?

Retrieve Certain Info From A File
I am wanting to bascally do an fread() on a file with a starting point and ending point.
For eaxmple: I want to retrieve text in position 60 for 30 characters and place it in a string.

Retrieve Header Info ?
I'm looking for a way to retreive header("location..."); info from external urls (assuming they are indeed using header("location..."); I was told to use fsockopen to open the url, and after that there should be a way to retrieve the header info, can anybody tell me exactly HOW I can retrieve that header info using fsockopen ?

Update And Retrieve Problems
The following code is to edit a movie detail form.the problem is first when i click edit it displays the current available data in the input text fields.But none of the details are displayed in the text area.

when i enter the new values for the fields to update,i get the success message but none of the info are updated in the database.can someone pls help me to fix this. Code:

Retrieve The Primary Key After Submitting?
how to retrieve the primary key from a table after submitting a record through a form. I want to pull the primary key out, drop it on another form on the next page.

Php Retrieve With Delete Checkbox
is it possible to retrieve all data in tables with checkbox delete...so the customer will view the history of the reservation and if they want to cancel it they will check the checkbox then click the delete button..

Retrieve Last Ten Records From The Database
using LIMIT I know how to easily retrieve the first 10 records from the database. But is there an easy way to retrieve the LAST 10 records  from the database? e.g

$sql = "SELECT * FROM employees";

How would i retrieve the last 10 records.

Retrieve Remote XML Before Transformation?
I need to scrape some data from a particular website, and had myself geared up for some regular expression magic--when I realized the site was serving straight XML files, transformed client side with XSLT.

"Lovely" I thought, "This will make my life easy!" Alas, no matter what method I try to retrieve the xml I can only manage to fetch the rendered HTML output.

file_get_contents returns rendered html.
curl_exec returns the rendered html.
a socket connection returns rendered html.

The most frustrating part is I can "view source" in my browser window and see the xml I'm looking for, but can't get to it with PHP. Arrrrgh!

Retrieve Mp3 File Properties?
is it possible to create script where i paste an mp3 link and it tells me the title and artist as stated in the file properties? if so, how can i go about doing this?

Retrieve Latest Result...
I need to make a query that pulls the latest added news article so whichever one has the highest id, how do I do this?

How Does One Retrieve All Table Names From A Database...
I'm trying, through an SQL statement, to retrieve table names and column names from a selected database.

Something like...

**PSUEDO CODE**

GET all_table_names FROM $db

->returns(table1, table2, table3, table4)

Retrieve Number Of Days Between Two Dates
I am trying to write a script that grabs todays date and then counts the number of days between today and a date in the future. Both the future date and the number of days interval are retrieved from a database (MySQL). PHP Code:

Retrieve And Save Mail Attachtments With PHP
I made a funstion that checks a mail account, retrieves and stores the
attachments in a folder on my website.

This works great for .doc files but not for .pdf files.

I am almost sure the problem is in: $fileContent =
imap_base64($fileContent);

Whet is the encoding for PDF attachments?

Retrieve And Display 3rd Party Pages
I'm wondering if you can show me an example php page that allows me to
retrieve and display 3rd party pages. I.e.,

when my php script is called as http://site/path/getit.php?file_key
it can retrieve from http://3rd.party/path2/name-with-file_key.htm
and display the result back to the browser.

I don't know php, and start to learning it. So I hope you can give me a full
php page, not a segment. I don't think it'd be too long though. Luckily, I'm
a programmer, so you don't need to comment it much, unless it is too
convoluted.

Further, if you can throw in handling of gzipped files, that'd be super.

If you have Firefox,

PHP Retrieve Image From Mysql Database
I was able to insert images into mysql stored as binary data. How do I
retrieve it.

How Can I Retrieve, Edit, And Update Text?
I'm trying to retrieve a text value from a MySQL database, put it into
an updateable form, allow edits, and send back the edited text back
into the MySQL database. I've been able to successfully retrieve the
text and put it into the editable form, using htmlspecialchars
function. But, I can't find a way of accepting the edited text and
sending back to the database.

Here's my code for retrieval.

<?php

@ $db = mysql_connect('localhost', '<database>', '<password>');
if (!$db)
{
echo "Error: Could not connect to database. Please try again
later.";
exit;
}
mysql_select_db("<database>");

$query = "select * from albert where ".$searchtype." like
'%".$searchterm."%'";

$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
$title = $row['title'];
$teaching = $row['teaching'];
$teaching = wordwrap($teaching, 60, "
", 1);
$teachnum = $row['teachnum'];
}
if ($result)
{

echo '<textarea name="newteachnum" rows="1" cols="4"
wrap="off">'
echo htmlspecialchars($teachnum)."
";
echo '</textarea>'
echo '<textarea name="newtitle" rows="1" cols="60"
wrap="off">'
echo htmlspecialchars($title)."
";
echo '</textarea>'
echo '<textarea name="newteaching" rows="20" cols="80"
wrap="on">'
echo htmlspecialchars($teaching)."
";
echo '</textarea>'


}
?>
<form action="teach_update.php" method="post">
<input type=submit value="Submit">
</form>

Here's the code to update the database.

<?php

@ $db = mysql_connect('localhost', '<database>', '<password>');
if (!$db)
{
echo "Error: Could not connect to database. Please try again
later.";
exit;
}
mysql_select_db("<database>");

$newtitle = addslashes($newtitle);
$newteaching = addslashes($newteaching);
$newteachnum = addslashes($newteachnum);

$query = "update albert set title =". $newtitle . " and teaching =
". $newteaching . " where teachnum =" . $newteachnum ;

print $query; //the print shows nulls for $newtitle, $newteaching,
and $newteachnum. It seems like those values are not being held in
memory from the calling program teach_edit.php

//$result = mysql_query($query) or die("Could not update!");

// if ($result)
// {
// echo mysql_affected_rows()." text item updated into
database.";
// }
?>


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