Results 1 to 2 of 2

Thread: whats wrong with this ?

  1. #1

    Thread Starter
    Fanatic Member kevin_sauerwald's Avatar
    Join Date
    Feb 2002
    Location
    outside Philly
    Posts
    516

    whats wrong with this ?

    I must need another set of eye's.. at the top of the page I have mysql connects and traces that show its attached and connected..

    but with this code I'm trying to populate a table.. I need the first sql to populate the header.. and the next sql to populate checkbox answers for
    the question... but for some reason the first sql comes back with nothing.. ever.. even if I take out the where clause.. and there is data in the table.. I can run that sql interactive and get data back.. so what am I missing here ??
    The second one errors at the momement.. but I think thats because its looking for params from the first one.. if I take out where clause in the second one the checkboxes do show.. seems that first sql does nothing.. but second runs.. can you only do one at a time for some reason ?

    Code:
    				<?php
    					$query = "SELECT Question_itn,Question_Text,Answer_Type from question where Category =0";
    					$result1 = mysql_query($query);
    					echo $query;
    					echo "data" . $result1['Question_itn'];
    				    echo "<tr>";
    					echo "<th>" . $result1['Question_Text'] . "</th>";
    					echo "</tr>";
    					$query2 = "SELECT Answer_Text,Answer_itn from answer where Question_itn = " . $result1['Question_itn'];
    					echo $query2;
    					$result2 = mysql_query($query2);
    					while ($line = mysql_fetch_array($result2, MYSQL_ASSOC)) {
    				?>
    					<input type="checkbox" name="Answer[]" value="<?php echo $line['Answer_itn']?> "> <?php echo $line['Answer_Text']?>
    					<br>
    				<?php } ?>

  2. #2

    Thread Starter
    Fanatic Member kevin_sauerwald's Avatar
    Join Date
    Feb 2002
    Location
    outside Philly
    Posts
    516

    Re: whats wrong with this ?

    I just figured it out.. they both return multi rows.. so I need to read them out with the

    while ($line = mysql_fetch_array($result2, MYSQL_ASSOC)) {
    ?>

    DUH!!!..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width