php - My Select top query isn't working -
this question has answer here:
- is there alternative top in mysql? 5 answers
can tell me wrong query? it's printing else statement, , it's giving error:
you have error in sql syntax; check manual corresponds mysql server version right syntax use near '2 * `sql_tbl`' @ line 1.
<?php $con=mysqli_connect("localhost","root","","sql_db"); $sqli="select top 2 * `sql_tbl`"; $querys=mysqli_query($con,$sqli); if($querys){ echo "query correct";} else{ echo "query not write". mysqli_error($con); } ?>
the equivalent "top" syntax in mysql "limit":
so:
$sqli="select top 2 * `sql_tbl`";
becomes:
$sqli="select * `sql_tbl` limit 2";`
Comments
Post a Comment