hi im using the following code to display all the query results but its just giving me one
$do_search=mysqli_query($conx, "SELECT * FROM `vehicles` WHERE `$op` LIKE '%$search%'");
while ($row = mysqli_fetch_array($do_search))
{
echo $row['model'];
}
this code works fine giving me 2 results but when i use
$do_search=mysqli_query($conx, "SELECT * FROM `vehicles` WHERE `$op` LIKE '%$search%'");
while ($row = mysqli_fetch_array($do_search))
{
echo $row['id'];
}
it gives me only one result why?
output for first code:
xk-1 xk-2
output for second code:
2
Your code seems correct, are you sure that your id
column in table is not empty.
If it is empty/blank it will be echoing something that you cannot recognize, to investiage you may put a counter and see if the effect is still same.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.