php - How to validate record in database -


what trying check customerid exists in database. if exists order submitted orders table. if customerid not exist, returns error.

trying check customers table see if customerid entered user exists, don't know how this. code below got different thread.

$checkid = "select customerid $tablename customerid = ".($customerid).""; $check_ref = @mysql_query($check2,$connection)      or die("couldn't execute check.<br>".mysql_error()); if(mysql_num_rows($check_ref)<1){     $login_err = "the customer number entered not exist.";     $error = "1"; 

okay, here goes:

  1. your query stored in $checkid, yet query $check2
  2. you disable error reporting on mysql_query. wrong on many levels.
  3. what parens doing around $customerid in string concatenation?

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -