I am missing something???
As already pointed out
SELECT name, age, id ...
Hopefully you understand the most of the folks here are just yanking your chain a bit. It doesn’t matter in this case if you use select * or select individual columns. Just a bit of humor for those in the know.
The code you posted tries to echo out $row data but there is nothing setting the value of $row. Typically you would need a loop of some kind.
You must have gotten db.php and the resulting $DB from some place. Maybe go back there and see if they have some examples to follow?
@Rybat It is fairly obvious to be that you are missing some fairly basic, fundamental understanding of programming in general. Concepts as simple as variables, conditionals, loops (control structures), input/output. It would do you well to look into the resources Sitepoint offers for beginning PHP development. Perhaps take a week go through a basic course/book and come back to your problem here. Anything less you will probably just end up being told how to do everything learning little to help you solve programming problems yourself.
It is not a “chain yank” at all and I am pretty sure no one is finding any humor in saying it. There are numerous reasons to specify column names. Google is your friend if you don’t know what the reasons are.
Yes, you’ve run the query, checked the number of rows in the result set, but you haven’t retrieved any of the results before you try to display them. Whatever your DB layer uses instead of the
single() function when it needs to retrieve more than one row would be the function to use.
Thanks for the help