gneral

mysql query not work

Mar 28th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.00 KB | None | 0 0
  1. <meta charset="UTF-8">
  2. <pre>
  3. <?
  4. error_reporting(E_ALL & ~E_NOTICE);
  5. $link = mysql_connect("localhost", ) or die(mysql_error());
  6. $db = mysql_select_db("_sistem", $link) or die (mysql_error());
  7.  
  8.  
  9. mysql_query("SET NAMES 'UTF8'");
  10. mysql_query("SET character_set_connection = 'UTF8'");
  11. mysql_query("SET character_set_client = 'UTF8'");
  12. mysql_query("SET character_set_results = 'UTF8'");
  13.  
  14. echo "....<br>";
  15. echo "Revisioned #6" . " Last modified: " . date ("F d Y H:i:s.", getlastmod()) . "<p>";
  16.  
  17. require('files/excel_reader/reader.php');
  18. $connection = new Spreadsheet_Excel_Reader();
  19. $connection->setOutputEncoding('UTF-8');
  20.  
  21. // Sistem seç:
  22. $sistem = "artemis";
  23.  
  24. // Platform seç:
  25. $platform = "all";
  26. echo "Selected brand group is <b>$sistem</b> and platform is <b>$platform</b><br>";
  27. if ($platform == "all") {
  28.     $appKey = "";
  29.     $appSecret = "";
  30. } elseif ($platform == "ha") {
  31.     $appKey = "616ba6e11a2";
  32.     $appSecret = "oNnZsGB";
  33. }   elseif($platform == "xx") {
  34.         $appKey = "ae317a8";
  35.         $appSecret = "1eNmx";
  36.     } else {
  37.     echo "Hangi sistem olduÄŸu seçili ama platform seçili deÄŸil. İşlem sonlandırılıyor.";
  38.     die;
  39. }
  40. $en = "_en";
  41. $tr = "_tr";
  42. $lang = "en";
  43. $secsis._.$lang = "Seçili sistem ";
  44. if ($sistem == "artemis") {
  45.     $connection->read('files/xls_files/artemis.xls');
  46. } elseif ($sistem == "bahariye") {
  47.     $connection->read('files/xls_files/bahariye.xls');
  48.     echo "$secsis_en $sistem";
  49. } elseif ($sistem == "foneks") {
  50.     $connection->read('files/xls_files/foneks.xls');
  51.     echo "$secsis_en $sistem";
  52. } elseif ($sistem == "patika") {
  53.     $connection->read('files/xls_files/patika.xls');
  54.     echo "$secsis_en $sistem";
  55. } // if:/sistem biti?i.
  56. echo "<u>Marka - Model - Stok - M2 - SS - Kategori - Stokkodu</u><br>";
  57. for ($i = 2; $i < $connection->sheets[0]['numRows']; $i++) {
  58.     for ($j = 1; $j <= $connection->sheets[0]['numCols']; $j++)
  59.     $marka = $connection->sheets[0]['cells'][$i][4];
  60.     $modell = $connection->sheets[0]['cells'][$i][3];
  61.     $stok = $connection->sheets[0]['cells'][$i][7];
  62.     $m2 = $connection->sheets[0]['cells'][$i][10];
  63.     $ss = $connection->sheets[0]['cells'][$i][1];
  64.     $kat = $connection->sheets[0]['cells'][$i][5];
  65.     $stokkod1 = $connection->sheets[0]['cells'][$i][3];
  66.     $stokkod2 = $connection->sheets[0]['cells'][$i][10];
  67.     $stokkodu = "$stokkod1-$stokkod2";
  68.  
  69.  
  70.  
  71.     if ($sistem == "artemis" AND $marka = "Artemis Halı") {
  72.     $model1 = str_replace(array(
  73.     "Art.","080x",".",
  74.     ),array(
  75.     NULL,"80x",NULL,
  76.     ),$modell);
  77.     $model_trconv1 = array("Ğ","Ü","İ","Ş","Ö","Ç","ğ","ü","ı","ş","ö","ç"); $model_trconv2 = array("G","U","I","S","O","C","g","u","i","s","o","c"); $model_trconv = str_replace($model_trconv1,$model_trconv2,$model1);
  78.     $model = rtrim($model_trconv);
  79.     $stok_kodu = $model."-".$m2;
  80.     $stokkod = str_replace(" ","-",$stok_kodu);
  81.     mysql_query('update urun set adet = "'.$stok.'" where stokk = "'.$stokkod.'"') or die(mysql_error());
  82.     }
Advertisement
Add Comment
Please, Sign In to add comment