SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: HAVING or WHERE on json value for persian word?

  1. #1
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HAVING or WHERE on json value for persian word?

    I want done "HAVING" for value json that store values array in a row from database table with json_encode, this values is persian word but but not done "HAVING" for it, how is fix it?(collation is utf8_general_ci)(i use codeigniter)

    row_s is as:


    row_s id 1: ["All5","\u0648\u06cc\u0632\u0627 8"]
    row_s id 2: ["All5","\u0648\u06cc\u0632\u0627 7"]
    row_s id 3: ["All5","\u0648\u06cc\u0632\u0627 6"]


    This is my php code: (output this is: There is not)

    PHP Code:
    $val   'ویزا 8';
    $query $this->db->query('SELECT * FROM table HAVING row_s LIKE "%' $val '%"');
    if (
    $query->num_rows() > 0) {
        foreach (
    $query->result() as $val) {
            echo 
    $val->name '<br>';
        }
    } else {
        echo 
    'There is not';


  2. #2
    SitePoint Evangelist smftre's Avatar
    Join Date
    Dec 2008
    Location
    London
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make sure that the file is UTF8
    Web Development London UK We make web 3.0 applications
    SiteInfo See how a website is doing compared to it's competitors
    Statvoo.com The Website Traffic Monitor -
    The best way to monitor traffic to your sites for free!

  3. #3
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can where value “$val” that is number or latin word with value json in database, but can not for persian word.

    for example, following code have output, and is $query->num_rows()=3.

    PHP Code:
    $val   'All5';
    $query $this->db->query('SELECT * FROM table HAVING row_s LIKE "%' $val '%"');
    if (
    $query->num_rows() > 0) {
        foreach (
    $query->result() as $val) {
            echo 
    $val->name '<br>';
        }
    } else {
        echo 
    'There is not';


  4. #4
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where is file?

  5. #5
    SitePoint Evangelist smftre's Avatar
    Join Date
    Dec 2008
    Location
    London
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The php file....
    Web Development London UK We make web 3.0 applications
    SiteInfo See how a website is doing compared to it's competitors
    Statvoo.com The Website Traffic Monitor -
    The best way to monitor traffic to your sites for free!

  6. #6
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is UTF8, not problem for it (i use 'ویزا 8' in same file). What is other proposed?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •