Jump to content

2 collumn 1 hidden HELP!


spanner206
Go to solution Solved by mac_gyver,

Recommended Posts

hopefully this will be the end of this little project but ive been trying to do this for a while now i need to get 2 different collumns one of which is hidden which will be the ID one has the value of the field e.g. test, im hopefully down to the last error.

( ! ) Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\AddLeads\addeadstemplate.php on line 254 Call Stack # Time Memory Function Location 1 0.0000 186408 {main}( ) ..\addeadstemplate.php:0 2 0.0156 194880 mysqli_fetch_row ( ) ..\addeadstemplate.php:254
	<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 (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>

i can get rid of the error bie adding 'or die' on line 253 other than just or but what this does is stop everything under or die stops working cause ive got another 6 or 7 fields under type of business aswell as this no error occurs so im confused to hell, hopefully its not to complicated any help will be greatly appreciated :) 

Link to comment
Share on other sites

yh ive tried that and for some reason everything under or die will stop working e.g. ive got about 5 -6 other fields under type of business and they will not appear, in the form. when i do this no error occurs aswell and still nothing is being pulled from the database any ideas???

Link to comment
Share on other sites

the view source is 

<select name="typeofbusiness">
        <option value=''> - select type of business -</option>
        <option value=''></option>
        </select> 

so they is quite a bit missing

 

this is my current code 

    <td>Type of Business:</td>
    <td>
        <select name="typeofbusiness">
        <option value=''> - select type of business -</option>
        <?php 
        $sql = "SELECT tbl_typeofbusiness.id, tbl_typeofbusiness.Agent FROM tbl_typeofbusiness;";
       $res = mysqli_query($con, $sql) or die (mysqli_error($con));
        while (list($id, $tob) = mysqli_fetch_row($res)); {
            echo "<option value='$id'>$tob</option>\n";
        }
        ?>
        </select>
Link to comment
Share on other sites

since using or die() or or trigger_error() doesn't address the execution path the code takes when there is an error, unless you want your code to die() or use E_USER_ERROR with trigger_error(), using an or die() or or trigger_error() are only best used for troubleshooting purposes and it doesn't really matter which one you use in that case.

 

actual code needs to address the execution path that is taken when there is an error, either through conditional logic or by using exceptions.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.