4
How do I handle this error?
source link: https://www.codeproject.com/Questions/5317530/How-do-I-handle-this-error
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
See more:
I got this error
Copy Code
Fatal error: Uncaught TypeError: mysqli_query(): Argument #1 ($mysql) must be of type mysqli, bool given in C:\xampp\htdocs\Login\signup.php:16 Stack trace: #0 C:\xampp\htdocs\Login\signup.php(16): mysqli_query(false, 'insert into use...') #1 {main} thrown in C:\xampp\htdocs\Login\signup.php on line 16
Please help me on how to fix it. Here's the code
Copy Code
if (!empty($user_name) && !empty($password)) { // save to db $user_id = random_num(20); $query = "insert into users (user_id, user_name, password) values ('$user_id',' $user_name',' $password')"; mysqli_query($query); header("Location: login.php"); die; } else { { echo "Please enter some valid information"; } } }
What I have tried:
I tried adding mysqli_query($con, $query);
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK