PHP Add button malfunction -


i trying hard learn how create shop cart using php , seems me got stuck once more. time can not make "additional conditioning amount available in stock" work well. can me figure out wrong php code below?

if (isset($_get['add'])) {     $con = mysqli_connect("localhost", "noivaemd_etalhes", "password", "***") or die (mysqli_error());     $quantity = mysqli_query($con, "select id, quantity products id=".mysqli_real_escape_string($con, $_get['add']));     echo '<p>'.$quantity_row['quantity'];     while($quantity_row = mysqli_fletch_assoc ($quantity)) {         if ($quantity_row['quantity']!=$_session['cart_'.$_get['add']]) {             $_session['cart_'.$_get['add']]+='1';         }     } } 

many things.

  1. you using mysqli, nice step mysql, you're still injecting values query. note escape_string not here because did not put quotes around value, meaning you're still wide open injections. learn parameterised queries.

  2. you misspelled fetch fletch.

  3. you using += string '1'. while php correct integer 1 via type coercion, it's still not thing writing because makes lack understanding.

these things visibly wrong code. if fixing these issues doesn't resolve problem, useful know error messages you're getting.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -