truck7758 Posted March 28, 2008 Share Posted March 28, 2008 can anyone see whats wrong with this query: <? $supp = $_POST["supp"]; $supp = addslashes($supp); // Connecting, selecting database $mysqli = new mysqli('host','username','password'); $mysqli->select_db('orders'); // Performing SQL query $result = $mysqli->query("SELECT * FROM supplier where `name` = '".$supp."'"); while($line = $result->fetch_assoc()) { echo "\t<tr>\n"; foreach ($line as $col_value) { if (empty($col_value)) { echo "\t\t<td> </td>\n"; } else { echo "\t\t<td>$col_value</td>\n"; } } echo "\t</tr>\n"; } // Free resultset mysqli_free_result($result); // Closing connection $mysqli->close(); ?> Thanks, Mike Link to comment https://forums.phpfreaks.com/topic/98297-query-error/ Share on other sites More sharing options...
rhodesa Posted March 28, 2008 Share Posted March 28, 2008 I don't see anything wrong. What error are you getting? Try changing this line: $result = $mysqli->query("SELECT * FROM supplier where `name` = '".$supp."'"); to $result = $mysqli->query("SELECT * FROM supplier where `name` = '".$supp."'") or die("Query error: ".$mysqli->error); Link to comment https://forums.phpfreaks.com/topic/98297-query-error/#findComment-503003 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.