Jump to content

Dropdown list read arabic characters from mysql DB


snhlawy

Recommended Posts

i have the below error when trying to read arabic characters from DB to be displayed in the dropdown menu but if i read english characters from DB it works fine please help. 

 

the error message is

SCREAM: Error suppression ignored for
( ! ) Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\Autoservice website & system\inventory\pqty.php on line 132

my code is

<select name="owner">
<?php 
mysql_connect("localhost","snhlawy","thena7labee") or die("Couldn't connect.");
mysql_select_db("data") or die ("Couldn't select db.");
$sql = mysql_query("SELECT desc FROM inventory");
while ($row = mysql_fetch_array($sql)){

?>
<option value="owner1"><?php echo $row['desc']; ?></option>

<?php
// close while loop 
}
?>

That means your query failed and you don't have a check for it. The first example in the php.net docs for mysql_query() show how to do that.

 

However, pay attention to the big pink notice at the top of the page in the manual. The mysql extension is deprecated and won't be available in future versions of php, so if you want your app to work in the future without having to rewrite all of your DB stuff, you should use PDO or MySQLi (with an i) extension.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.