Anyone that works with MySQL and PHP knows that it’s a good idea to trap and handle errors as a part of making calls to the database. I have seen folk that do it in many different ways, and some that don’t do it at all. It’s a real handy thing to do, especially in the early phases of development. If there is a problem somewhere in your code, good feedback from the application can make troubleshooting much easier. I tend to write functions that make life easier, put them all into a file and then reference that from my pages that actually do the work. In this case, I have a function that will catch and return MySQL errors, along with the query so you can see what is going wrong. First I will show you the function, and then I will show you some usage examples.
Author Archives: Laz
New Stuff
Well, it seems we finally have a good code syntax highlighting plugin (Yeah!), so now I can post code in the actual posts without sending everyone to the forums. Not that going to the forums is a bad thing, it’s not I assure you, in fact why don’t you head over there right now and get some chit chat discussions going! Anyway, back to the topic at hand. I am going to start posting more code in posts marked with the category “Codebank” and whatever language it refers to. I think this will be a good place for me to store some code and have it readily available, plus it will be a good way for me to share it with all of you fine folk. If you have some code or scripts that are burning a hole in your disk drive and you are just itching to share them, send it on and I might just add it to the Codebank.
Really cool tool for Windows
I don’t know about anyone else out there, but I am a big fan of tabbed interfaces. If you have used the Firefox web browser within the last few years or so, you no doubt have come to appreciate this as much as I have. If you haven’t seen this in any apps that you are using, you don’t know what you are missing. Even Microsoft jumped on the bandwagon when they released Internet Explorer 7 by adding tabbed browsing support, no doubt inspired by how popular that feature is with Firefox users.
Microsoft had doubts about the “Vista Capable” label
This one is too easy to make fun of, we all had doubts about that little logo proclaiming readiness for Vista. Instead, I will simply send you off to Slashdot to read the article.
mysqldump tricks
In a recent post we talked about using the ever more awesome mysqldump command to dump the schema or structure of a table, but not the data. For example, if you want to create a copy of the database with new data.
I thought I might expand on mysqldump and talk about some other useful things you can do with your data. Let’s start by putting this into perspective. Since we are talking about the mysqldump command, obviously whatever we are doing is going to focus on getting data out of the database. Hence the “dump” portion of the command. This can be to backup the database, to clone it or move it, or in development/test/verification situations where you are taking part of the data and doing something with it.
List Of Latest Vulnerabilities
I have setup a page that shows the latest discovered vulnerabilities from SecurityFocus. I figured this would give anyone and everyone convenient access to the latest list of exploits out there so you can keep an eye on what’s going on and hopefully head off any troubles before they start. You can click the link in this article, and you can find the permanent link in the middle column, under Pages at the bottom of the list. Enjoy!