Problem with fetching results from mysql via php function?

Your mysql syntax looks bad. You have: SELECT * FROM `notice` ORDER BY nid LIMIT 12 DESC try SELECT * FROM `notice` ORDER BY nid DESC LIMIT 12 Erik's comments should have pointed you in the right direction, however: Figure out where PHP logs errors. Either turn up php's error reporting level so you see more errors, or start tailing your apache error_log You should always check for errors after running mysql_query and do some sort of logging on failure.

This is probably best accomplished by writing a wrapper function for mysql_query that does this, or using a 3rd party db wrapper that has already solved this problem.

1 And I should add, that: or die(mysql_query()) should not be in production code. Errors should be caught and logged so the end user won't see it, just like Frank says. – Erik May 11 at 18:44.

You're redefining function note_type every time through your while loop. You have a return call outside the function, below it. Really I can't see how this is even syntactically correct.It looks like you have a large problem with mismatched brackets.

As for an actual database issue, you should check mysql_error() if no rows return from the call because it's likely something went wrong. Also I recommend using PDO which is a true database class instead of the native function based ones.

1 Also if you have access to a command line you can do php -l your_filename. Php and it will give you the errors. It's probably in your webserver log as well.

– Cfreak May 11 at 18:41 wow, you're right, the WTF-per-line count here is high. $athor is spelled wrong in one place, and there's an attempt to call note_type($type) from inside of a docblock – Frank Farmer May 11 at 18:45 FYI: Returning no rows is not an error, and mysql_error() will not tell you anything. – Erik May 11 at 18:47 a yes manage to fail that part was in a bit of a rush I rewrote the entire code now.So it works the only part is note_type function which I can get to work... – PT Desu May 11 at 19:15.

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