PHP5 gripe
I’m writing a website in PHP that works off data in a MySQL database. The site was ready for launch, but there was a last minute functionality addition that required one of the scripts to add a record to a remote MySQL database. This should be a piece of cake, but it’s not. The function in PHP that actually runs the query on the database is mysql_query(). It usually requires just one argument the actual SQL query, which is then submits using the currently open database connection, or if one doesn’t exist, the last one.
There is an optional second argument that will connect to a specific connection, but if I force it to use this new remote database, all the other queries after it will connect to the wrong database, unless I modify them to force them to use the correct database. Aaaaaggghhh!
The logical option is to modify the other bits of code, but it’s already been tested and verified, so I’m not touching it if I can avoid it. What I’ll end up doing is separating this new function out into a separate PHP script, that I’ll call with CURL and pass the necessary data in the query string. It’s not ideal, but it’s the only way to integrate the new function without making radical changes.
About this entry
You’re currently reading “PHP5 gripe,” an entry on gary’s web sofa
- Published:
- 9.10.07 / 12pm
- Category:
- Internet, Software, Technology
- Tags:
No comments
Jump to comment form | comments rss [?] | trackback uri [?]