![]() |
need help with retrieving
I've used this code before, and has worked. But now I can't understand what is the problem.
I have a code to test my queries for a website I am doing. This is the code: PHP Code:
Code:
8Code:
mysql> SELECT ArticleID FROM articles;If you need more info this is the articles table: Code:
mysql> SHOW COLUMNS FROM articles; |
I believe it is the following line that's causing all your troubles:
php Code:
There shouldn't be a semi-colon at the end of that line, it should be either nothing, or curly braces. I think curly braces should always be present, even if the inner code of the conditional is a mere one line. It saves on headache-inducing problems like this! |
PHP Code:
|
Wow how could I have missed that!
I guess I needed to relearn to look at the code after a break with a clear mind. :P saves headaches like wildhoney said. Thanks guys. |
Sorry to nit-pick here, but your try..catch block isn't doing much, you need to throw and exception before its caught:
PHP Code:
I agree with Wildhoney about the curly braces, although not needed for PHP to execute it, it will make debugging harder in the future |
I thought the point of try and catch is that try automatically throws an error if there is any.
Maybe not, I come from a c++ and java background and I thought it would be the same. I am going to look more about it. And now I can see the need of braces for debugging, this is my first large project so I am learning more each time. |
| All times are GMT. The time now is 04:36 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0