I check if there is a numeric code in my database, but it does not return it.
-I want the function to pick the data from the Codes table if the code matches the declared code
connect_error) {
the ("Connection failed:". $ conn-> connect_error);
}
// passed
$ code_serial = "123456789";
// declared code
// code serial compares if the code matches the one in the database if it returns nothing
$ stmt = $ conn-> prepare ("SELECT * FROM codes WHERE code = # 39; $ code_serial. & # 39;") or the (mysqli_error ($ conn));
mysqli_stmt_execute ();
$ stmt-> execute ();
$ cresult = $ stmt-> mysqli_fetch_all ();
// cresult, coderesult
if (count ($ cresult)) {
foreach ($ cresult as $ cdata) {
extract ($ cdata);
$ code = $ cdata['code'];
// $ cdata['code'] Here's where the code comes out
return $ code;
Echo "ok";
}
}
}
$ dump = getCodes ();
print_r ($ dump);
// returns msg "unknown table # codes in information_schema"