Hi,
I'm trying to sort out the names from the database based on the first letter by using (addr WHERE LIKE 'A%'). This gives me the following error message:

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in...

Does anyone know what’s wrong here? Everything works great when I do not use (addr WHERE LIKE'A%') in the query string.

<?php
require_once ('../mysqli_connect.php'); 

$q = "SELECT CONCAT(adresse) AS addr FROM gate_vei WHERE addr LIKE 'A%'"; 
$r = @mysqli_query ($dbc, $q); 

echo '<table align="center" cellspacing="3" cellpadding="3" width="75%">
	<tr><td align="left"><b>Adresse</b></td></tr>';

	while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
		echo '<tr><td align="left">' . $row['addr'] . '</td>
		</tr>';
	}

	echo '</table>'; 

mysqli_free_result ($r); 	
mysqli_close($dbc); 
?>

Recommended Answers

All 2 Replies

addr is not a column name. You should probably use addresse

Yes, it solved the problem. Thank you pritaeas!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.