Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Please reply to some of the comments so we can help figure out what the issues is. This is how your function would look with proper <code>mysqli</code> syntax. </p> <ul> <li><p>How to make the connection: <a href="http://www.php.net/manual/en/mysqli.construct.php" rel="nofollow">$mysql = new mysqli(...)</a></p></li> <li><p>How to prepare the statement: <a href="http://www.php.net/manual/en/mysqli-stmt.prepare.php" rel="nofollow">$stmt = $mysqi->prepare(....)</a></p></li> <li><p>How to bind the parameters: <a href="http://php.net/manual/en/mysqli-stmt.bind-param.php" rel="nofollow">$stmt->bind_param(...)</a></p></li> <li><p>Execution: <a href="http://www.php.net/manual/en/mysqli-stmt.execute.php" rel="nofollow">$stmt->execute()</a></p></li> </ul> <p><strong>Note</strong>: you were making your insert string like it was to be used for <code>mysqli</code> but your parameter binding was more similiar to <code>pdo</code>. I wasn't sure which one you were wanting to use so I chose <code>mysqli</code>. I personally prefer <code>PDO</code>, though... so I can re-write this using that if you want. <a href="http://www.php.net/manual/en/pdo.prepare.php" rel="nofollow">Link to the PDO Prepare Function that also shows some binding.</a></p> <pre><code> // this is your database connection for mysqli $mysqli = new mysqli('localhost', 'my_user', 'my_password', 'world'); function insertSeries($mysqli) { $options = array( 'user' =&gt; $_POST['user'], 'email' =&gt; $_POST['email'], 'summary' =&gt; $_POST['summary'], 'due_date' =&gt; $_POST['due_date'], 'problem_type' =&gt; $_POST['problem_type'], 'status' =&gt; $_POST['status'] ); $sql = "insert into ticket_summary('user','email','summary','due_date','problem_type','status') Values (?, ?, ?, ?, ?, ?)"; if ( $stmt = $mysqli-&gt;prepare($sql) ) { $stmt-&gt;bind_param("ssssss", $options['user'], $options['email'], $options['summary'], $options['due_date'], $options['problem_type'], $options['status']); $success = $stmt-&gt;execute(); if ($success) { print "query worked"; } else { print "query failed"; } } } </code></pre>
    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.
    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