How to compare two input variables with mysql stored values (PHP)? -
I'm basically wanted to make an HTML form in which the user puts two different input then this information in a MySQL table Compiled data is compared with. If both of the input variables match the two variables in the same row from the table, it gives a message, if it does not give another, how can I do it? This is my code so far:
if (mysqli_connect_errno ()) {
echo "failed to connect to MySQL:". Mysqli_connect_error (); }
Escape Wheriabls
For security // $ numero_cedula = mysqli_real_escape_string ($ to, $ _POST [ 'numero_cedula']);
$ codigo = mysqli_real_escape_string ($ con, $ _POST ['codigo']);
$ sql1 = "select
Numero Cedula
Numero Sedula = $ numero_cedula";
mysqli_query ($ conn, $ sql1);
$ Sql2 = "Select
from Codigo where the tester is
codego = $ codigo";
In Micli_kweri ($ why, $
and >
WHERE
if (mysqli_connect_errno ()) failed to connect to {echo "MySQL:". mysqli_connect_error ();} // escape variable for security $ numero_cedula = mysqli_real_escape_string ($ conn, $ _POST ['numero_cedula']); $ codigo = mysqli_real_escape_string ($ col, $ _POST ['codigo']); $ sql1 = "selection Numerer Sedula "test Where 'Numero Sidula` = $ numero_cedula and `codigo` = $ codigo"; $ ObjGet = mysqli_query ($ conn, $ sql1); if (mysqli_num_rows ($ objGet)) gt; {echo "duplicate";} Else {echo " Not a duplicate ";}
Comments
Post a Comment