View Single Post
Old 12-02-2012, 09:31 PM   PM User | #11
KULP
Regular Coder

 
Join Date: Mar 2012
Posts: 166
Thanks: 5
Thanked 11 Times in 11 Posts
KULP is an unknown quantity at this point
I finally got the query to work after an hour or two of messing with it / research! Now I have it echoing the question and first choice, but how do I access choice 2 (I have 2 choices in the choice table, both with pollid as 1.) This works, but does it look right? I just feel weird fetching an array inside of an array.
PHP Code:

                $qry 
'SELECT * FROM polls
                INNER JOIN choices ON polls.id = choices.pollid
                WHERE polls.userid = 1000'
;
                
                
$result mysql_query($qry$connection);
                
                if(
$result === FALSE)
                {
                    die(
mysql_error()); 
                }

                while(
$row mysql_fetch_array($result))
                {
                    echo 
$row['question'];
                    echo 
$row['choice'];
                    
                    while(
$row mysql_fetch_array($result))
                    {
                        echo 
$row['choice'];
                    }
                } 
/////////////////////////////////////////////////////////////////////

EDIT x12312 :

Nevermind I figured it out, so far!

Last edited by KULP; 12-03-2012 at 12:24 AM..
KULP is offline   Reply With Quote