View Single Post
ישן 31-07-13, 13:50   # 3
kobisl
חבר בקהילה
 
מיני פרופיל
תאריך הצטרפות: Jan 2006
הודעות: 76

kobisl לא מחובר  

תנסה את mysql_real_escape_string
אם זה לא עוזר אז כנראה שזה בגלל בעיות של קידוד, תנסה להשתמש בפונקציה file_get_contents במקום fopen ו fgetcsv, זה ידרוש ממך קצת להבין איך בנוי קובץ CSV כדי לעבור על כל הנתונים (\n לשורה הבאה ו \t לעמודה הבאה).

דוגמה (לא בדקתי אותה):
PHP קוד:
$file_content file_get_contents('A.csv');
$rows=explode("\n",$file_content);
foreach(
$rows as $id=>$value)
{
$row=explode("\t",$value);
$first_name=mysql_real_escape_string($row[0]);
$query "INSERT INTO `questions3`  (first_name,last_name) VALUES  ('{$first_name}','דשגד')"
$result mysql_query($query)or die("Query failed: " mysql_error()); 


Last edited by kobisl; 31-07-13 at 14:11..
  Reply With Quote