PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 9, 2022

[FIXED] Getting Gibberish on phpmyadmin output

 February 09, 2022     mysql, php, phpmyadmin     No comments   

Issue

I'm trying to send Hebrew content through to show up on phpmyadmin. English letters go through perfectly, but Hebrew gives me something like this: חן דו××§.

phpmyadmin collation is set on utf8_unicode_ci (Also tried utf8_general_ci). How can I solve it?

This is my code:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php

header('Content-Type: text/html; charset=utf-8');

$servername = "//";
$username = "//";
$password = "//";
$dbname = "//";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
$sql = "INSERT INTO nigunim (name, time, day)
VALUES ('בדיקה', 'בדיקה', 'בדיקה')";

if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>

Solution

Finally fixed by creating a new table and then adding mysql_set_charset("UTF8", $conn); along with making sure collation is set to utf8_general_ci.



Answered By - Samuel
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing