Jump to content
php.lv forumi

Ievieto tekstu datubāzē!


zintis8789

Recommended Posts

Es meiģinu ievietot .csv failu tur ir iekšā vārds: D'Agostini .Vins to nesaprot un man uzmet erroru:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\csv\index.php on line 24
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Agostini Matt','MTL','Player','1','13:39','0','0','0','-2','0','0','0','3','0')' at line 1

Bet parejos vārdus vinš iemet datubāzē.

Edited by zintis8789
Link to comment
Share on other sites

Es pieliku klāt: mysql_real_escape_string()

Bet tikuntā man rāda:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'not,team,name,note) values('1','Period','Time','Goal/Penalty','Team','Player Nam' at line 1

Link to comment
Share on other sites

     while (($data2 = fgetcsv($handle2, 1000, ",")) != FALSE)

    {

$ccm12 = mysql_real_escape_string($data2[2]);
$ccm1 = mysql_real_escape_string($data2[4]);
$ccm121 = mysql_real_escape_string($data2[5]);
$time = mysql_real_escape_string($data2[1]);
$kpp = mysql_real_escape_string($data2[3]);
$per = mysql_real_escape_string($data2[0]);


      $import2="INSERT into teamstat(id,per,time,not,team,name,note) values('$nr1','$per','$time','$ccm12','$kpp','$ccm1','$ccm121')";

      mysql_query($import2) or die(mysql_error());
      mysql_query("DELETE FROM teamstat WHERE team='Team'");
}

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...