Note that there are some explanatory texts on larger screens.

plurals
  1. POmySQL InnoDB Table doesn't work on 1and1 server, does on localhost
    primarykey
    data
    text
    <p><strong>EDIT</strong></p> <p>I changed the table to MyISAM, and it worked. Anyone know why InnoDB wouldn't work, and if there's a way to "enable" it?</p> <hr> <p>Basically, I insert a row, <strong>am able to reference the new id</strong> via $mysqli->insert_id, select the row, translate it into an associative array, and return it. Right after that, in another function, I try to select it and it does not exist. It also does not exist in the database. Update simply does not update, and delete simply does not delete (although when i say $stmt->affected_rows, it returns > 0).</p> <p>One table (news) modifies without a problem, but another table (products), which utilizes the same code (only it has it's own table name and field values) does not.</p> <p>The function is this:</p> <pre><code>function addNews($title, $message) { $mysqli = open_mysqli(); if ($stmt = $mysqli-&gt;prepare("INSERT INTO news(title, message) VALUES (?,?)")) { $stmt-&gt;bind_param("ss", $title, $message); $stmt-&gt;execute(); $stmt-&gt;close(); $id = $mysqli-&gt;insert_id; if ($stmt = $mysqli-&gt;prepare("SELECT * FROM news WHERE id=? LIMIT 1")) { $stmt-&gt;bind_param("i", $id); $stmt-&gt;execute(); $meta = $stmt-&gt;result_metadata(); while ($field = $meta-&gt;fetch_field()) { $params[] = &amp;$row[$field-&gt;name]; } call_user_func_array(array($stmt, 'bind_result'), $params); while ($stmt-&gt;fetch()) { foreach($row as $key =&gt; $val) { $c[$key] = $val; } $results[] = $c; } $stmt-&gt;close(); $mysqli-&gt;close(); if(isset($results) &amp;&amp; $results) { return sqlResultObj(true, $results[0]); } else { return sqlErrorObj('No news with id '.$id); } } } else { return sqlErrorObj('Problem adding news.'); } } </code></pre> <p>The only difference between the tables, besides the fields themselves, is that product is an InnoDB Storage Engine and has other tables referencing it as their foreign key, while news is MyISAM, and does not.</p> <p>Like I said, this works perfectly on my local WAMP server (running Apache 2.2.11, PHP 5.3.0, MySQL 5.1.36) but it presents the above problems on my 1and1 server (PHP 5, MySQL 5, and I have the USA 1&amp;1 Beginner Package Linux_WS... not sure which version of Apache or where to find it). Any ideas would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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