langauage error

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: langauage error
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192467@lists.php.net to get a copy of this message
i am using a form to enter articles into mysql databse in Arabic language when i enter the data from Phpmyadmin it converts the letters to the unicode they match like &#1610;&#1576;&#1604;&#1610; but when i enter it from my form it returns strange letters which is not usefull like OE??C?EO??CO?E? how can i make my scripts encode the arabic letters to the unicode of them before it stores it in the database here is my script <?php ob_start(); $post_title = addslashes($post_title); $post_author = addslashes($post_author); $post_author = "<span lang=\"ar-eg\">.$post_author.\"</span>"; $post_content = addslashes($post_content); $post_date = addslashes($post_date); $db = mysql_connect("localhost", "root"); mysql_select_db("balady", $db); $query = "insert into posts (post_id ,post_title ,post_date ,post_author post_content ,m_cat_id ,s_cat_id ,post_pic) values ('', '$post_title', $post_title', '$post_author', '$post_content', '', '', 'subject.gif' )"; mysql_query($query) or die(mysql_error()); ?> <html> <head> <title>Add Article</title> </head> <body> <form name="post_article" method="post" action="<?php print ($PHP_SELF); ?>" onSubmit="submit_form()"> <table border="0" width="56%" id="table1"> <tr> <td width="193"><b><span lang="ar-eg"> <font size="3" face="Simplified Arabic">&#1593;&#1606;&#1608;&#1575 &#1606; &#1575;&#1604;&#1605;&#1608;&#1590;&#1608;&#1593 </font></span></b></td> <td width="341"><input type="text" name="post_title" size="40" dir="rtl ></td> <td>&nbsp;</td> </tr> <tr> <td width="193"><b><span lang="ar-eg"> <font size="3" face="Simplified Arabic">&#1575;&#1587;&#1605; &#1575 &#1604;&#1603;&#1575;&#1578;&#1576;</font></span></b></td> <td width="341"><input type="text" name="post_author" size="40" dir="rtl ></td> <td>&nbsp;</td> </tr> <tr> <td width="193"><b><font size="3" face="Simplified Arabic"> <span lang="ar-eg">&#1578;&#1575;&#1585;&#1610;&#1582; &#1575;&#1604 &#1605;&#1608;&#1590;&#1608;&#1593;</span></font></b></td> <td width="341"><input type="text" name="post_date" size="40" dir="rtl ></td> <td>&nbsp;</td> </tr> <tr> <td> </td> <td> <?php // include the config file and editor class: include_once ('editor_files/config.php'); include_once ('editor_files/editor_class.php'); // create a new instance of the wysiwygPro class: $editor = new wysiwygPro(); $editor->set_name('post_content'); // print the editor to the browser: $editor->print_editor(700, 400); ?> </td> </tr> <tr> <td width="193">&nbsp;</td> <td width="341"><input type="submit" value="Submit" name="submit"><input type="reset" value="Reset" name="reset"></td> <td>&nbsp;</td> </tr> </TABLE> </form> </body> </html> <?php ob_end_flush(); ?> -------Original Message------- From: John Holmes Date: 08/02/04 13:45:22 To: me2resh Cc: php-general@lists.php.net Subject: Re: [PHP] script error > $query = "insert into 'posts' ( post_id , > post_title , post_date , > post_author , post_content , > m_cat_id , s_cat_id , > post_pic) > values (\'\', \'$post_title, \'$post_title, \'$post_author, > \'$post_content, \'\', \'\', \'subject.gif\' )"; > mysql_query($query); Change that last line to mysql_query($query) or die(mysql_error()); and run the script again. If you can't figure it out, post back with the error message and what troubleshooting you've done. -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#192467) next »