Recordset looping problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

mikaeerik
New php-forum User
New php-forum User
Posts: 3
Joined: Fri Sep 27, 2013 7:25 am

Recordset looping problem

Postby mikaeerik » Sat Sep 28, 2013 4:40 am

Hi!
I tried to loop recordset but it didn't work.
Here is the code:

<?php
$query_Recordset2 = sprintf("Select * From oireet");
$Recordset2 = $connect->query($query_Recordset2);
$row_Recordset2 = mysqli_fetch_array($Recordset2, MYSQL_ASSOC);

$index=1;

while ($row_Recordset2 = mysqli_fetch_array($Recordset2, MYSQL_ASSOC));
{
?>
<tr>
<td valign="middle" width="430" height="25"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<input type="checkbox" name="<?php $index; ?>">
<?php $row_Recordset2['oire']; ?></font></td>
<td valign="middle" width="10" height="25"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
&nbsp;</font>
</td>
<td valign="middle" colspan="3" height="25"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
&nbsp;</font>
</td>
</tr>
<?php
$index++;
}
?>

What is wrong? Can you help?

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Recordset looping problem

Postby johnj » Wed Oct 02, 2013 6:23 am

What do you mean by "it didn't work" ?

mikaeerik
New php-forum User
New php-forum User
Posts: 3
Joined: Fri Sep 27, 2013 7:25 am

Re: Recordset looping problem

Postby mikaeerik » Fri Oct 04, 2013 4:17 am

To teh web-page should have come 80 checkboxes and texts but came only one checkbox and no text.

mash
New php-forum User
New php-forum User
Posts: 7
Joined: Sat Jan 14, 2012 1:36 pm

Re: Recordset looping problem

Postby mash » Fri Oct 04, 2013 5:51 am

You're not outputting anything that's why you don't see no text:

E.g. what is this supposed to do?
<?php $row_Recordset2['oire']; ?>

depending whats in the field 'oire' you should check your apache log files to see the error

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Recordset looping problem

Postby johnj » Fri Oct 04, 2013 8:36 pm

please print $index to see how many records it is picking up.


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 4 guests

cron