The mysql_fetch_array () function is always unsuccessful (.. webshop_ SQL _con.php); if (isset ($ _ GET [search]) {$ search $ _ GET [search]; $ querySELECT & nbsp; * & nbsp; FROM & nbsp; obj _ mysql_fetch_array () function always fails to run.
Include ('../webshop_ SQL _con.php ');
If (isset ($ _ GET ['search']) {
$ Search = $ _ GET ['search'];
$ Query = "SELECT * FROM obj_info WHERE obj_name LIKE '% search %' order by obj_sale DESC ";
If ($ result = mysql_query ($ query, $ dbc )){
While ($ row = mysql_fetch_array ($ result )){
Print'
'. $ Row ['obj _ name'].'
Price: '. $ row ['obj _ pri'].'
< li>';
}
}
The database connection file has been written, and other search results can be returned in this way. this is always the case. I also tried var_dump ($ row ), the result is FALSE .. What do you mean?
I am working on a graduation project, and PHP is just getting in touch. could you please advise me?
------ Solution --------------------
There is no search record in the table.
What you may need is
$ Query = "SELECT * FROM obj_info WHERE obj_name LIKE '% $ search %' order by obj_sale DESC ";
------ Solution --------------------
The same as the $ query = "SELECT * FROM obj_info WHERE obj_name LIKE '% $ search %' order by obj_sale DESC ";
Be careful
------ Solution --------------------
Agree to the second floor. be careful when splicing statements.
------ Solution --------------------
SQL error