I've been having trouble with this one piece of code, and can't seem to sort out the problem.
I've looked online and the error im currently getting has something to do with a failed query but as i follow the steps to solve this problem it doesent seem to work.
What I need to do is have two separate columns one for the id, and the other for the data which the id
s hold and I need it to pull information from my table called tbl typeofbusiness
This is my code :
<tr>
<td>Type of Business:</td>
<td>
<select name="typeofbusiness">
<option value=''> - select type of business -</option>
<?php
$sql = "SELECT tbl_typesofbusiness.ID, tbl_typesofbusiness.Agent
FROM tbl_typesofbusiness";
$res = mysqli_query($con,$sql)or ("Error: ".mysqli_error($con));
while (list($id, $tob) = mysqli_fetch_row($res)); {
echo "<option value='$id'>$tob</option>\n";
}
?>
</select>
</td>
<td>
<span class="error">*
<?php if (isset($errors['typeofbusiness']))
echo $errors['typeofbusiness']; ?>
</span>
</td>
</tr>
This creates the dropdown box and has a default value : select type of business, but it does not seem to pull the data from the database, as there are no other options under that. It also shows an error message.
Which I no how to solve by changing or to or die but when i make that change all code under or die dosent appear and i have another 6-7 fields which really isn't convenient and even worse when I do this no error message appears.
I need someone to help me with removing these problems so that it pulls information from the database and all the other errors no longer appear.
The error is:
Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\AddLeads\addeadstemplate.php on line 256 Call Stack # Time Memory Function Location 1 0.2188 192992 {main}( ) ..\addeadstemplate.php:0 2 2.1875 205216 mysqli_fetch_row ( ) ..\addeadstemplate.php:256