Re: langauage error
| From: | M. Sokolewicz | Date: | Mon, 02 Aug 2004 15:32:14 +0000 |
| Subject: | Re: langauage error | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-192474@lists.php.net to get a copy of this message | ||
try using htmlentities()
- Tul
Me2resh wrote:
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 يبلي 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">عنوان الموضوع</font></span></b></td> <td width="341"><input type="text" name="post_title" size="40" dir="rtl"></td> <td> </td> </tr> <tr> <td width="193"><b><span lang="ar-eg"> <font size="3" face="Simplified Arabic">اسم الكاتب</font></span></b></td> <td width="341"><input type="text" name="post_author" size="40" dir="rtl"></td> <td> </td> </tr> <tr> <td width="193"><b><font size="3" face="Simplified Arabic"> <span lang="ar-eg">تاريخ الموضوع</span></font></b></td> <td width="341"><input type="text" name="post_date" size="40" dir="rtl"></td> <td> </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"> </td> <td width="341"><input type="submit" value="Submit" name="submit"><input type="reset" value="Reset" name="reset"></td> <td> </td> </tr> </TABLE> </form> </body> </html> <?php ob_end_flush(); ?> /-------Original Message-------/ /*From:*/ John Holmes <mailto:holmes072000@charter.net> /*Date:*/ 08/02/04 13:45:22 /*To:*/ me2resh <mailto:me2resh@hotmail.com> /*Cc:*/ php-general@lists.php.net <mailto: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 ____________________________________________________ <http://www.incredimail.com/redir.asp?ad_id=309&lang=9> /IncrediMail/ - *Email has finally evolved* - *_Click Here_* <http://www.incredimail.com/redir.asp?ad_id=309&lang=9>