2017년 1월 10일 화요일

arabic in mysql database


i am saving data from app inventor text to mysql database , it always save as ?????????????????????? and not in arabic charachter
i have this code in my php file
   mysql_query("set character_set_server='utf8_general_ci'");
   mysql_query("set names 'utf8_general_ci'");
   mysql_set_charset('utf8');
database set to utf8
and aso the table
how can i save arabic text to mysql using appinventor

--
probably Q3 can help? see here https://puravidaapps.com/mysql.php#q
also you should use mysqli instead of mysql...

-- 
its not working when i use mysqli it gives me server error, i am woundering if the problem starts when the app inventor block send the data to the php script or its in the php script it self or its in the database , i dont think its in the database bcz its all configured as utf8 its in the appinventor blocks that may be send the arabic from the textfields as ?????? or in the php that gets the code 


$name=mysql_real_escape_string($_GET['name']);
$phone=mysql_real_escape_string($_GET['phone']);

or in the insert into statment 
$sql = "INSERT INTO new 
  (name,phone,adress,besttimetocall,date) 
  VALUES ('$name','$phone','$adress','$besttimetocall',NOW())";

or i donno

-- 
can u give me a sample php code for insert into plz that working for inserting arabic text fro appinventor text field to database mysql

-- 
well, the mysql API is deprecated, you should use mysqli instead
what about using my example script as test?
what about using mysqli_set_charset($dbc, "utf8"); as Celog suggested in Q3 here https://puravidaapps.com/mysql.php#q?
let us know, what you find out

-- 
now i am getting error 
Could not enter data:
in mysqli
my php code for insert into is

$name=($_GET['name']);
$phone=($_GET['phone']);
$adress=($_GET['adress']);
$besttimetocall=($_GET['besttimetocall']);
mysqli_set_charset($conn, "utf8");
   $sql = "INSERT INTO springli_app.neww 
      ('name','phone','adress','besttimetocall') 
      VALUES ('$name','$phone','$adress','$besttimetocall')";
         
   //mysqli_select_db('springli_app');
   $retval = mysqli_query( $sql, $conn );
   if(! $retval ) {
      die('Could not enter data: ' . mysqli_error());
   }
   
   echo "Entered data successfully\n";
   
   mysqli_close($conn);

-- 
can you give me a correction for my code plz

-- 
oki mysqli is working now still getting ?????/ in the database , this thing is driveing me crazy help me plz

-- 
what about using mysqli_set_charset($dbc, "utf8"); as Celog suggested in Q3 here https://puravidaapps.com/mysql.php#q?


let us know, what you find out


--
still getting ???????????????????????????

Untitled.jpg 표시 중

 Untitled.jpg

-- 
i think may be its the app inventor it self its not sending the arabic text correctly how can i fix this plz

-- 
it seems to be, you did not follow the Stackoverflow suggestions?
what about for example this one? http://stackoverflow.com/a/19588466/1545993
in case this does not help, don't hesitate to look for more tips here https://www.google.com/search?q=mysql+arabic+characters
and let us know, what worked for you

-- 
still not working i did every thing

-- 
you might want to ask somewhere else and first set up your database correctly
sorry, unfortunately I'm not able to help more 

-- 

댓글 없음:

댓글 쓰기