having problem in php | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

having problem in php

Have this error, Notice: Undefined variable: conn.... and Warning: mysqli_query() expects parameter 1 to be mysqli, null given ..... don't know what's wrong. help!

20th Aug 2018, 7:24 AM
Phoebe Gaufo
Phoebe Gaufo - avatar
3 Answers
+ 3
Did you forget to include the connection file?
20th Aug 2018, 8:54 AM
Toni Isotalo
Toni Isotalo - avatar
+ 2
it seems that you didn’t well defined var $conn (with the database configuration) that’s must be the first param of musqli_connect function... ex: $conn = mysqli_connect(“localhost”, “admin”, “12345”, “mydatabase”); msqli_query($conn, “SELECT * FROM table”);
20th Aug 2018, 7:35 AM
Zguillez
Zguillez - avatar
+ 1
yes i just forgot to include the connection. thanks
24th Aug 2018, 12:01 AM
Phoebe Gaufo
Phoebe Gaufo - avatar