2millionways Posted December 17, 2008 Share Posted December 17, 2008 Hello, This is part of my php code: <?php $sql = "SELECT * FROM `table_tickets` ORDER BY `step_status1`, `step_status2`"; $options=''; $i=1; { echo <<<EOC <tr> <td>Ticket status: $ticket[step_status1]</td> <td>Ticket status: $ticket[step_status2]</td> </tr> EOC; } // End while ?> My question is: can I create code that will automatically take number of step_status fields, so when someone adds another "step", let's say step_staus3 (through a form) the rest script will read it from database. Sorry for lame language Thank for help. Link to comment https://forums.phpfreaks.com/topic/137366-random-help/ Share on other sites More sharing options...
[email protected] Posted December 17, 2008 Share Posted December 17, 2008 Use a for loop? <?php for ($j=1; $j <= count($ticket); $j++) { echo ' <td>Ticket Status: '.$ticket['step_status'.$j].'</td>'; } ?> Or something similar to that. Link to comment https://forums.phpfreaks.com/topic/137366-random-help/#findComment-717724 Share on other sites More sharing options...
redarrow Posted December 17, 2008 Share Posted December 17, 2008 Lookup the switch statement and Lookup the if statement .......... Link to comment https://forums.phpfreaks.com/topic/137366-random-help/#findComment-717759 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.