PDA

View Full Version : Code Arabic Please Help !



codesaso
04-06-2009, 10:46 AM
Hello,
My site is in Arabic hosted by BlueHost (www.codesaso.com). In local, there is no problem with this code :

<?php
mysql_connect("localhost", "user1", "****"); // Connexion à MySQL
$link = mysql_connect ("localhost","user1") ;
mysql_query("SET CHARACTER SET 'utf8';", $link)or die(mysql_error());
mysql_select_db("codesa"); // Sélection de la base coursphp
?>

The forth line is for coding in Arabic.

But in Line I have this message :

Undefined variable in Line 4 :

mysql_query("SET CHARACTER SET 'utf8';", $link)or die(mysql_error());

Would you like to help me ?

wysiwyg
04-06-2009, 11:35 AM
mysql_connect("localhost", "user1", "****"); // Connexion à MySQL
$link = mysql_connect ("localhost","user1") ;
Should just be

$link = mysql_connect("localhost", "user1", "****"); // Connexion à MySQL
But that probably wouldn't throw an "undefined variable" error. That doesn't really make sense.

You don't technically need to include the connection handle in the query, if you leave it out it uses the last available connection.

mysql_query("SET CHARACTER SET 'utf8';")or die(mysql_error());

codesaso
04-07-2009, 11:00 AM
Thank you very much. That's it
:)