Warning: Cannot use a scalar value as an array in /home/admin/public_html/forum/include/fm.class.php on line 757

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/include/fm.class.php on line 770

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/topic.php on line 737
Форумы портала PHP.SU :: не выполняется запрос

 PHP.SU

Программирование на PHP, MySQL и другие веб-технологии
PHP.SU Портал     На главную страницу форума Главная     Помощь Помощь     Поиск Поиск     Поиск Яндекс Поиск Яндекс     Вакансии  Пользователи Пользователи


 Страниц (1): [1]   

> Без описания
alexiy
Отправлено: 09 Января, 2012 - 16:41:28
Post Id



Посетитель


Покинул форум
Сообщений всего: 483
Дата рег-ции: Янв. 2011  


Помог: 6 раз(а)




есть метод
PHP:
скопировать код в буфер обмена
  1.  
  2.  
  3. public function saveOrder($startDate, $startTime, $initialHotel, $clientName, $room, $finishDate, $finishTime, $finishHotel, $finishAdmin, $dayCount, $retCountry, $car, $carPricePerDay, $insurance, $addDriver, $childSeat, $autoTrans, $gps, $skiBox, $another, $outOfWork, $another2, $outBorder, $orderSumm, $cashType)
  4.                 {
  5.                         $this->startDate = $startDate;
  6.                         $this->startTime = $startTime;
  7.                         $this->initialHotel = $initialHotel;
  8.                         $this->clientName = $clientName;
  9.                         $this->room = $room;
  10.                         $this->finishDate = $finishDate;
  11.                         $this->finishTime = $finishTime;
  12.                         $this->finishHotel = $finishHotel;
  13.                         $this->finishAdmin = $finishAdmin;
  14.                         $this->dayCount = $dayCount;
  15.                         $this->retCountry = $retCountry;
  16.                         $this->car = $car;
  17.                         $this->carPricePerDay = $carPricePerDay;
  18.                         $this->insurance = $insurance;
  19.                         $this->addDriver = $addDriver;
  20.                         $this->childSeat = $childSeat;
  21.                         $this->autoTrans = $autoTrans;
  22.                         $this->gps = $gps;
  23.                         $this->skiBox = $skiBox;
  24.                         $this->another = $another;
  25.                         $this->outOfWork = $outOfWork;
  26.                         $this->another2 = $another2;
  27.                         $this->outBorder = $outBorder;
  28.                         $this->orderSumm = $orderSumm;
  29.                         $this->cashType = $cashType;
  30.                        
  31.                         $query = "INSERT INTO order (startdate, startTime, initialHotel, clientName, room, finishDate, finishTime, finishHotel, finishAdmin, dayCount, retCountry, car, carPricePerDay, insurance, addDriver, childSeat, autoTrans, gps, skiBox, another, outOfWorkTIme, anothertwo, outBorderPermission, paytype, orderSumm) VALUES ('$this->startDate', '$this->startTime', '$this->initialHotel', '$this->clientName', '$this->room', '$this->finishDate', '$this->finishTime', '$this->finishHotel', '$this->finishAdmin', '$this->dayCount', '$this->retCountry', '$this->car', '$this->carPricePerDay', '$this->insurance', '$this->addDriver', '$this->childSeat', '$this->autoTrans','$this->gps', '$this->skiBox', '$this->another', '$this->outOfWork', '$this->another2', '$this->outBorder', '$this->orderSumm', '$this->cashType)";         
  32.                                                                                                                                                                                                                                
  33.                         mysql_query($query) or die(mysql_error());     
  34.                                                                                                                                                                                                                                                                                                                                                                                                                                
  35. }
  36.  

после того как я его вызываю,
PHP:
скопировать код в буфер обмена
  1. $order->saveOrder($startDate, $startTime, $initialHotel, $clientName, $room, $finishDate, $finishTime, $finishHotel, $finishAdmin, $dayCount, $retCountry, $car, $carPricePerDay, $insurance, $addDriver, $childSeat, $autoTrans, $gps, $skiBox, $another, $outOfWork, $another2, $outBorder, $orderSumm, $cashType);


выдает ошибку 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 'order (startdate, startTime, initialHotel, clientName, room, finishDate, finishT' at line 1

в чем может быть проблема?
 
 Top
illy
Отправлено: 09 Января, 2012 - 16:54:00
Post Id



Участник


Покинул форум
Сообщений всего: 1117
Дата рег-ции: Июль 2011  
Откуда: от верблюда)


Помог: 28 раз(а)




кавычку поставь
'$this->cashType)";
'$this->cashType')";


-----
Всё гениальное - просто
И ещё проще, если ты - индиго
 
 Top
alexiy
Отправлено: 09 Января, 2012 - 17:55:57
Post Id



Посетитель


Покинул форум
Сообщений всего: 483
Дата рег-ции: Янв. 2011  


Помог: 6 раз(а)




illy пишет:
кавычку поставь
'$this->cashType)";
'$this->cashType')";

исправил, но все равно ошибка остается
 
 Top
DlTA
Отправлено: 09 Января, 2012 - 18:04:52
Post Id



Постоянный участник


Покинул форум
Сообщений всего: 2952
Дата рег-ции: Окт. 2010  


Помог: 53 раз(а)




alexiy пишет:
исправил, но все равно ошибка остается
выведите текст запроса в браузер и сюда, там уже будет виднее
 
 Top
alexiy
Отправлено: 09 Января, 2012 - 19:44:57
Post Id



Посетитель


Покинул форум
Сообщений всего: 483
Дата рег-ции: Янв. 2011  


Помог: 6 раз(а)




Исправил, просто таблицу переименовал и все заработало Улыбка
 
 Top
Страниц (1): [1]
Сейчас эту тему просматривают: 0 (гостей: 0, зарегистрированных: 0)
« SQL и Архитектура БД »


Все гости форума могут просматривать этот раздел.
Только зарегистрированные пользователи могут создавать новые темы в этом разделе.
Только зарегистрированные пользователи могут отвечать на сообщения в этом разделе.
 



Powered by PHP  Powered By MySQL  Powered by Nginx  Valid CSS  RSS

 
Powered by ExBB FM 1.0 RC1. InvisionExBB