Quote:
Originally Posted by amnesia623
Thanks for the reply.
I am having some issue with the syntax of this.
My goal is to display a list of items as a side menu. Where is my error in the following code? I am confused on where exactly to query and the pull it into an array.
Thanks BTW...
Code:
$getstate = $db->query_read("SELECT state_name FROM vb_sidemenu_states");
while ($getstate = $db->fetch_array($result))
{
$mytest = $results;
};
|
Just a little explanation that may help out. Your first line does a read query and the results from the query (which are actually pointers, not actual results) go into a variable called $getstate. Your next line needs to go through the results of that query and so they assign a new variable to the array they are fetching. So, your second line makes no sense. You need to assign a new variable name to go through the array, like "while ($result = $db->fetch_array($getstate))". Now you can actually do something with the variable called "$result". Normally you would call the variable as "$result['state_name']" (don't quote me on the use of the single quotes there, I've never understood when to use then and when not, I'm a trial and error coder). So, you could say "$mytest = $result['state_name'];" and then spit out the variable $mytest in your code.