Beyond inspecting the posted code, are there any quality FREE tools that can
monitor MySQL resource usage? I searched Google using "mysql resource tools"
and came up with a number of tools, but all required payment.

I'm figuring that if you run a monitor while testing your code locally,
you'll be able to pinpoint precisely what causes the recources to be chewed

Just a thought.

-----Original Message-----
From: pthes [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 09, 2003 11:42 AM
Subject: Re: [PHP-DB] Is my Hosting service full of it?

Thanks for the comments,. I'm putting some code here to hopefully get an
idea of what is considered inefficient when dealing with mysql. I'm confused
because all I'm doing is collecting the data from a form and writing it to
the db. I have about 30 pages in the survey, so a script similar to this is
called after each page.


$connection = mysql_connect($host,$user,$password)
       or die ("couldn't connect to server");
$db = mysql_select_db($database,$connection)
       or die ("Couldn't select database");

$intable = "tablename";

/* this is the duplicate check section */
$sql = "SELECT * FROM $intable WHERE datein = '$datein' AND itemID='$itemID'

$mysql_result = mysql_query($sql,$connection);
$num_rows = mysql_num_rows($mysql_result);

if ($num_rows == 0) {
/* insert if no dupes */
$query = "INSERT INTO itemsread (itemread,itemID,datein) VALUES
$result = mysql_query($query);
/* update if existing timestamp */
$query = "UPDATE $intable SET itemread='$itemread' WHERE datein='$datein'
AND itemID='$itemID' ";
$result = mysql_query($query);
} # end else

It seems pretty simple to me. What am I missing?

PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to