Archive for the ‘mysql’ tag
playing with clay
What is it about PHP and MySQL that makes them so damn easy to play with? You just use a few applications that are written in PHP and you get hooked. When I was setting up a wiki, I started with PhpWiki, then MediaWiki and ended up with DokuWiki. On the CMS front, Drupal was the one and only app I could think of. And on the blogging side, its WP over MT.
Even as it is competent enough to run the WP engine, I find it ridiculously easy to play with. From writing small hacks to take care of Blogger imports into the WP databse, to writing survey applications for Dave. Right now, I’m chipping away at a simple blogring script.
Also running on my localhost is a database of my fanfiction record. Searchable and editable by the enduser, without reaching PMA. Plus, I’m thinking of offering a better version of the survey to Dave to keep running with his blog - though that would require some work on the UI part.
The last time I had so much fun was when I wrote my cricket program in BASIC.
Dave’s survey
Dave asked me to setup a survey for him - to be precise, I told him that with the sort of survey he wanted, a custom-built one was the best option. So I set about creating one for him - my first true PHP/MySQL application. With no help from anyone except the manual and the Net. Bhise did the text field and form part - guess I was too lazy to do that; but then I did the scripting and the radio buttons, so there you are. Besides, I wanted to do the stuff all by myself.
There were many differences and much grumbling. I experienced first hand what I heard in OOAD and Project Management.
Client’s demands are exceeding the scope. Client is not comprehending the software capabilities. Client’s vision of the project is flawed.
And much more stuff in a similar vein. All that for a simple survey script. No wonder the success rate for software projects is around 20% (thats what I remember from the OOAD course - no research done; so no flames on that please).
Anyway, its done and online. Dave will let you all know in due course where you should head to participate in the survey. I’ll put up the sanitized code (can’t let you have my database details now, can I?) in a few days.
the final touch
The one thing that was keeping me from recommending WP all-out to others was its import compatibility. Till now, I could import Blogger posts and make sure their comments were linked and counted. But I was not able to set their categories. I got this idea a few hours ago. Its my first PHP-MySQL code.
The MySQL query on lines 8-11 updates the post2cat table which holds the post-category linkages. The import script I am using somehow skips this detail. Once the posts have a legal category ID, it is a trivial matter to move them in the WP system.
// after initial install, this should be 3, check your wp_post2cat table, take last value + 1 $new_rel_id = 18; // check the ID of the last imported post ID from admin interface $last_post = 83; // value of counter is the first imported post ID for ( $counter = 3; $counter < = $last_post; $counter += 1) { mysql_query(" INSERT INTO wp_post2cat (rel_id, post_id, category_id) VALUES ('$new_rel_id', '$counter', '1' ) ") or die(mysql_error()); $new_rel_id += 1; }
I will put up the full details of my WP install and an enhanced version of this code (two more queries to merge post authors and comment authors) on a static page later.
what to do?
Now I’m confused. Anyone reading this is welcome to help me out. I’m interested in coding - just enough to solve problems that crop up in my engineering course. Preferred - Linux and C/C++. Also I’m interested in creating small websites with simple databases. Preferred - Apache and MySQL.
Now the dilemma. I’ve learnt C/C++ on DOS Turbo C and stopped at simple function templates. No GUI, system I/O or file handling. Basic Apache with Perl runs happily on Fedora. How do I rig it for a database and some other scripting language?
Do I go for Qt or KDevelop or Anjuta in Linux? And PHP and MySQL in Linux? I’m not going for heavy duty stuff. Basic familiarity and ability to do some home-projects is all I’m aiming at.
PS: I would love PHP, MySQL, KDevelop - what say?
No responses yet