php - mySQL error on syntax -
<html> <head><title> inpatientlist </title><head> <body> <h1> inpatientlist </h1> <?php $conn = mysqli_connect("127.0.0.1","root","root",""); if (mysqli_connect_errno()) { printf("connect failed: %s\n", mysqli_connect_error()); exit(); } $q1 = mysqli_query($conn," select * joseph.inpatient_1501003f"); if ($q1 = mysqli_query($conn,"query string")) { while ($r1 = mysqli_fetch_row($q1)) { ($k=0; $k<count($r1); $k++){ print htmlspecialchars($r1[$k]). " : "; } print "<br>"; }; } else { printf("errormessage: %s\n", mysqli_error($conn)); } mysqli_close($conn); ?> </body> </html>
i got error says
"you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'query string' @ line 1"
how fix this? appreciated much!
you performing 2 queries in first 1 correct te second 1 in if
condition totally wrong.
so remove if ($q1 = mysqli_query($conn,"query string")) {
condition , rest ok.
note:- remove condition , ending }
also.
Comments
Post a Comment