$check = mysql_fetch_array(mysql_query("select a from table"));;
That will still throw an error. It does for me at least.
You have 2 ;; after each other on the first row.
Originally Posted by benton
I did - it doesn't work. Thus the question. Perhaps if you tried it you would see that too?
Your question was if it's possible to do so. If you tried to do so and it didn't work, it's logical to assume that it's not possible.
The reason I told you to try it was because I've seen people(including myself before) ask things they can easially try out on their own(trial and error is the best way of learning). If you've tried it, that's great.
For the record, I've tried that too a long time ago(or something similar) and it doesn't work.
This is where a good database abstraction layer (or class) comes in handy. If you really want to simplify it down to one line create a MySQL class or use someone else's. You could even just create a single function to do this:
I was setting up up some test code and got tired of typing in two lines. I wouldn't use in the live code I work on. It seemed an obvious thing to combine the two but when I tried it, it didn't work. I've found in the past that learning how to do things like this helps me understand other problems I may encounter later on so I wanted to learn how to do it to further my understanding of php. But since no one knows how to do it, I'm beggining to think it isn't possible.