Welcome Guest, Not a member yet? Register   Sign In
How to select all or get all the data in a table?
#5

[eluser]towki[/eluser]
[quote author="skunkbad" date="1342365392"]In the view, the way you wrote the foreach is probably wrong. mr_prasanna was right. I was going to suggest you try:

Code:
<?php
foreach( $results as $row )
{
     echo '
          <h2>' . $row['id'] . '</h2>
          <h3>' . $row['Name'] . '</h3>
     ';
}

Even though you are using alternative syntax for your foreach, you have left out the colon(Smile, so I'm not sure it's going to work. Personally, I don't like the alternative syntax, and think you should use standard syntax because alternative syntax is cluttered.[/quote]

I have tried your code skunkbad, and my problem was solved! But I dont understand why mr_passana was suggesting a endforeach while your code had no endforeach at all. Was my problem was caused by using alternative syntax??
Thanks to all of you for fast reply!



Messages In This Thread
How to select all or get all the data in a table? - by El Forum - 07-15-2012, 07:56 AM
How to select all or get all the data in a table? - by El Forum - 07-15-2012, 08:11 AM
How to select all or get all the data in a table? - by El Forum - 07-15-2012, 08:16 AM
How to select all or get all the data in a table? - by El Forum - 07-15-2012, 08:39 AM
How to select all or get all the data in a table? - by El Forum - 07-15-2012, 08:43 AM
How to select all or get all the data in a table? - by El Forum - 07-15-2012, 09:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB