Note that there are some explanatory texts on larger screens.

plurals
  1. POConverting To MYSQLI
    primarykey
    data
    text
    <p>I'm working to convert to MYSQLi. something i'm not entirely confident in just yet. I'm getting an error trying to breakdown this portion of my script.</p> <pre><code> &lt;?php // Parse the form data and add inventory item to the system if (isset($_POST['username'])) { $username = $_POST['username']; $password = $_POST['password']; $level = ($_POST['level']); // See if that product name is an identical match to another product in the system include "includes/db_conx.php"; $sql = "SELECT id FROM users WHERE username='$username' LIMIT 1"; $user_query = mysqli_query($db_conx, $sql); $productMatch = mysqli_num_rows($sql); // count the output amount if ($productMatch &gt; 0) { header("location: message.php?msg=usererror"); exit(); } // Add this product into the database now $username = preg_replace('#[^a-z0-9]#i', '', $_POST['username']); $ip = preg_replace('#[^0-9.]#', '', getenv('REMOTE_ADDR')); $email = mysqli_real_escape_string($_POST['email']); $p_hash = md5($password); $sql = mysqli_query("INSERT INTO users (username, password, ip, email, level, date_added) VALUES('$username','$p_hash','$ip','$email','$level',now())") or die (mysql_error()); header("location: order_complete.php"); exit(); } ?&gt; </code></pre> <p>I believe I've got most of it down, but the second half of this is giving me fits. I'm trying to establish past</p> <blockquote> <p>// Add this product into the database now</p> </blockquote> <p>a mysqli conversion. I just can't seem to keep myself from mangling the script and throwing all kinds of errors. I believe I'm about half way there, but introducing select is throwing me off. Can someone help me to figure out this.</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.
 

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