having problem in php | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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