Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.