php - mysqli_fetch_array returning less results than expected -
I am using the code to return and resonates the array. If I define 'mysqli_fetch_array ($ result, MYSQLI_BOTH)', then my array is reduced by a result, the first result in the array emits from the list. If I remove MYSQLI_BOTH, then I hope I get those results, but my hosting company throws this error:
Warning: mysqli_fetch_array () [function.mysqli-fetch -array]: The result type must be on either line of MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH /blah/blah/blah.co.uk/index.php
What exactly do I want mysqli_fetch_array ($ result, 0) so that I hold all the results, but do not receive this error message
Thanks for any and all help.
CODE:
$ dbc = mysqli_connect ($ Dbhost, $ dbuser, $ dbpass, $ dbname) or die ('This is a dying error');
$ query = "Select a different continent from travel"; $ Result = mysqli_query ($ dbc, $ query) or die ('This is a query query error'); $ Line = mysqli_fetch_array ($ result, MYSQLI_BOTH); // (0 $ result, 0) to begin with 0, now in error, 1 starts on missing result ($ row = mysqli_fetch_array ($ result)) {echo '
The difference in those standards will be how the array is defined.
MYSQLI_NUM
= Array items will use a numerical index key.
MYSQLI_ASSOC
= Array items will use column names as a column list.
MYSQLI_BOTH
= Array objects will be duplicated, one of which will be a numerical index key and one will be the name of the column in the form of an index key.
You are not losing the results.
You are fetching twice before output, which means that you were touching a line ... do this:
$ query = "travel Select a different continent from "; $ Result = mysqli_query ($ dbc, $ query) or die ('This is a query query error'); While ($ row = mysqli_fetch_array ($ result, MYSQLI_ASSOC)) {echo '& lt; A href = "country.php? Continent = '. $ Line [' continent ']." & Gt; '. $ Line ['continent'] "& lt; / a & gt; & lt; br / & gt; \ n"; } Mysqli_close ($ dbc);
Comments
Post a Comment