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="" > <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-------
Date: 08/02/04 13:45:22
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
--
|