Retrieving data from DB oop?

1 Oh my gosh! What purpose does this code have? I guess most of the users prefer not to put every single command inside .

It's considered as bad coding style. – Jan. Sep 15 '10 at 14:38 This assumes you are in the view where you usually do most of your iterating over database records.

– Mischa Sep 15 '10 at 14:40 IMHO this assumes way too much: Not every piece of code is meant to be outputted in HTML. And even if so, then why would you seperate the first line from the first echo? IT's more work for the interpreter and it's not easy readable for humans.

Just my 2cents – Jan. Sep 15 '10 at 14:42 thats perfect! Except you should use the shorthand I think it makes it look nicer .

But thanks – andrei Sep 15 '10 at 14:42 1 @Jan using PHP code in HTML like this is totally acceptable IMO and I can't see how this is less future-oriented than using a full-blown templating system (that replicates what PHP does anyway) - as long as you stick to variables and simple control structures. PHP operations and calculations inside HTML is what's evil. (I am a happy user of template engines in many projects by the way, but they're not always needed.) – Pekka Sep 15 '10 at 18:05.

Look close! You are putting the outter Array into the foreach loop. Every "$r" is then one Object with the properties id, title, data.

Try foreach ($data as $k => $r) { echo $r->id; }.

The problem is in echo $r. $r is of type stdClass, which can not be printed like that. Try print_r($r).

Echo "Your major is in the DB. $collegemajor = isset($user_profile'education'0'concentration'0'name')? $collegemajor_db = isset($row'major')?

Look close! You are putting the outter Array into the foreach loop. Every "$r" is then one Object with the properties id, title, data.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions