From 7eb055141bae63b85cef93e5d6f67e3016219d7b Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sat, 13 Dec 2008 10:01:56 -0500 Subject: Optimized posting Previously, Four Island posted a blog, and then searched through the table looking for it so it could retrieve its ID. Now, the "mysql_insert_id()" function is used instead. --- includes/functions.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'includes') diff --git a/includes/functions.php b/includes/functions.php index d8d1bc4..7f85f96 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -118,11 +118,8 @@ function postBlogPost($title,$author,$tags,$content) $inspost = "INSERT INTO updates (title,slug,author,text) VALUES (\"" . $title . "\",\"" . $slug . "\",\"" . $author . "\",\"" . addslashes($content) . "\")"; $inspost2 = mysql_query($inspost); - $getpost = "SELECT * FROM updates WHERE slug = \"" . $slug . "\""; - $getpost2 = mysql_query($getpost); - $getpost3 = mysql_fetch_array($getpost2); - - addTags($getpost3['id'], $tags); + $id = mysql_insert_id(); + addTags($id, $tags); $upconf = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdate\""; $upconf2 = mysql_query($upconf); @@ -161,6 +158,8 @@ function postBlogPost($title,$author,$tags,$content) $msg = new xmlrpcmsg("weblogUpdates.ping", array( new xmlrpcval('Four Island', 'string'), new xmlrpcval('http://fourisland.com/', 'string'))); $client->send($msg); + + return $id; } function recalcPop($id) -- cgit 1.4.1