Jump to content

PHP,mysql,jquery and arabic text INSERTS


Confidence

Recommended Posts

hi,

i made my own page, but when i do an insert using mysql, jquery and php, the arabic text does not show properly

it is a comments page.

here is the DB structure


CREATE TABLE IF NOT EXISTS `app_comments` (
  `comment_id` int(20) NOT NULL auto_increment,
  `comment` text NOT NULL,
  `user_id` int(20) NOT NULL,
  `comment_date` date NOT NULL,
  `app_id` int(20) NOT NULL,
  PRIMARY KEY  (`comment_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=35 ;

here is the jquery piece that transfers to php code.

    function submit_comment(){
        $(".post_comments_button").click(function() {
            var post_comments = $('.post_comments').val();
            var app_id = $('#app_id').val();
            //alert (app_id);
           
            if(confirm('Add Comment?')) {
               
                var string = "task=add_comment&app_id=" + app_id + "&comment="+post_comments;
                            $.ajax({
                url : "appajax.php",
                type : "POST",
                data : string,
                success : function(data) {
                    alert(data);
                    window.location.reload(true);
                   
                }
            });
               
               
               
            }
            /**/
            });
    }

and here is the acutal insert code in php

$new_appquery = 'INSERT INTO app_comments (comment, user_id, app_id,comment_date)
                          VALUES ("' . $comment . '",' . $user_id . ',  ' . $app_id . ',NOW());';

                         

                          and the actual problem is, the arabic text shows like this in my application:

                         

                         

بالتوÙيق للريال

                         

how can i solve this issue? :confused:

Link to comment
https://forums.phpfreaks.com/topic/236934-phpmysqljquery-and-arabic-text-inserts/
Share on other sites

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.