Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a problem with this MySQL Query?
    primarykey
    data
    text
    <pre><code>public function create() { echo $this-&gt;equipment-&gt;getCatId() . "&lt;br/&gt;"; echo $this-&gt;equipment-&gt;getName() . "&lt;br/&gt;"; echo $this-&gt;equipment-&gt;getYear() . "&lt;br/&gt;"; echo $this-&gt;equipment-&gt;getManufacturer() . "&lt;br/&gt;"; echo $this-&gt;equipment-&gt;getModel() . "&lt;br/&gt;"; echo $this-&gt;equipment-&gt;getPrice() . "&lt;br/&gt;"; echo $this-&gt;equipment-&gt;getLocation() . "&lt;br/&gt;"; echo $this-&gt;equipment-&gt;getCondition() . "&lt;br/&gt;"; echo $this-&gt;equipment-&gt;getStockNum() . "&lt;br/&gt;"; echo $this-&gt;equipment-&gt;getInformation() . "&lt;br/&gt;"; echo $this-&gt;equipment-&gt;getDescription() . "&lt;br/&gt;&lt;br/&gt;"; $db = Connect::connect(); $current_time = date('y M d'); $query = "INSERT INTO equipment (cat_id, name, year, manufacturer, model, price, location, condition, stock_num, information, description, created, modified) VALUES ({$this-&gt;equipment-&gt;getCatId()}, {$this-&gt;equipment-&gt;getName()}, {$this-&gt;equipment-&gt;getYear()}, {$this-&gt;equipment-&gt;getManufacturer()}, {$this-&gt;equipment-&gt;getModel()}, {$this-&gt;equipment-&gt;getPrice()}, {$this-&gt;equipment-&gt;getLocation()}, {$this-&gt;equipment-&gt;getCondition()}, {$this-&gt;equipment-&gt;getStockNum()}, {$this-&gt;equipment-&gt;getInformation()}, {$this-&gt;equipment-&gt;getDescription()}, '$current_time', '$current_time')"; $result = $db-&gt;query($query); return $db-&gt;insert_id; } </code></pre> <ul> <li>The echos at the top all display valid data that fit the database schema.</li> <li>There are no connection errors</li> </ul> <p>Any ideas?</p> <p>Thanks in advance!</p> <p>Here is the echo'ed query</p> <p>INSERT INTO equipment (cat_id, name, year, manufacturer, model, price, location, condition, stock_num, information, description, created, modified) VALUES (1, 'r', 1, 'sdf', 'sdf', '2', 'd', 'd', '3', 'asdfasdfdf', 'df', '10 May 10', '10 May 10')</p> <p>MySQL is giving: #1064 - 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 'condition, stock_num, information, description, created, modified) VALUES (1, 'r' at line 1</p> <p>id int(11) unsigned NO PRI NULL auto_increment Edit Delete cat_id int(11) unsigned NO NULL<br> Edit Delete prod_name varchar(255) YES NULL<br> Edit Delete prod_year varchar(10) YES NULL<br> Edit Delete manufacturer varchar(255) YES NULL<br> Edit Delete model varchar(255) YES NULL<br> Edit Delete price varchar(10) YES NULL<br> Edit Delete location varchar(255) YES NULL<br> Edit Delete condition varchar(25) YES NULL<br> Edit Delete stock_num varchar(128) YES NULL<br> Edit Delete information text YES NULL<br> Edit Delete description text YES NULL<br> Edit Delete created varchar(20) YES NULL<br> Edit Delete modified varchar(20) YES NULL</p> <p>Query: INSERT INTO equipment (cat_id, prod_name, prod_year, manufacturer, model, price, location, condition, stock_num, information, description, created, modified) VALUES (1, 'asdf', '234', 'adf', 'asdf', '34', 'asdf', 'asdf', '234', 'asdf', 'asdf', '10 May 10', '10 May 10') </p> <p>Here is the SQL export from PhpMyAdmin in case someone wants to try duplicating this issue: <a href="http://pastie.org/954206" rel="nofollow noreferrer">http://pastie.org/954206</a></p> <p>BLEHBLEHSDFOHSE -- So apparently, 'condition' is also a reserved word... threw in some backticks, then it started working.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload