If you want to insert values into a MySQL table, but only if those values don’t already exist, and you don’t want to use a primary key on the table (and deal with the resulting error suppression ), here’s an elegant one-query method of doing so.
INSERT INTO [table name] SELECT ‘[value1]’, ‘[value2]’ FROM DUAL
WHERE NOT […]
Remember the old saying: “6 months in the lab saves an afternoon in the library.”
So I finally bought an iPhone. It’s rockin. I’m going to be getting on a plane to Vegas for the weekend, and I have a 6-hour layover at Dallas-Fort Worth. Between books and phone video, I think I’ll be sufficiently entertained.
I really do like the phone. It’s so convenient. I’ll be walking along somewhere, and […]
If you’re in the East Orlando area, and are looking for a good bite to eat, let me clue you in on some local deliciousness.
Fratellos
Fratellos is an Italian-American takeout/delivery store with some amazing pizza and subs. Everything they serve looks like real food, no mystery mush. They say their dough and sauce are made fresh […]
Continue reading about Orlando Restaurants (Fratellos & El Cerro)
All data should be escaped before going into a query, to prevent a SQL-injection attack. The current “best practice” is to use mysql_real_escape_string(), which connects to the DB, checks how strings should be escaped, and then returns the safe string.
Unfortunately, this requires a round trip to the DB, and it takes time and resources. Here’s […]
Continue reading about Quick Tip: Save time on escaping from mysql_real_escape_string()