Re: [PHP] Re: Left Join extremely slow (MySQL)

2001-08-03 Thread William Poarch

"explain"

 - - - - - - - - - -
 Scott Poarch
 www.globalhost.com
 - - - - - - - - - -

> From: "Richard Lynch" <[EMAIL PROTECTED]>
> Organization: Lynch Interplanetary Enterprises
> Date: Fri, 3 Aug 2001 17:09:49 -0500
> To: <[EMAIL PROTECTED]>
> Subject: [PHP] Re: Left Join extremely slow (MySQL)
> 
> Use MySQL's built in "analyze" ("describe"? SQL statement to see what's
> taking so long).
> 
> I'm betting on one server having an INDEX on the id or ex fields, and the
> other not.
> 
> --
> WARNING [EMAIL PROTECTED] address is an endangered species -- Use
> [EMAIL PROTECTED]
> Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
> Volunteer a little time: http://chatmusic.com/volunteer.htm
> - Original Message -
> From: James Crowley <[EMAIL PROTECTED]>
> Newsgroups: php.general
> To: <[EMAIL PROTECTED]>
> Sent: Friday, August 03, 2001 11:40 AM
> Subject: Left Join extremely slow (MySQL)
> 
> 
>> Hi,
>> I had been using an INNER JOIN statement for a MySQL query, which
>> worked fine. However, my new ISP does not have the latest version of
>> MySQL. The version they have does not support conditions for Inner Join
>> statements, so I have tried switching to a Left Join instead. However,
>> the Left Join query takes 12.15 sec (which is obviously far too slow).
>> The Inner join statement, meanwhile, completed the query in 0.04. Any
>> idea why??
>> 
>> Here are the two statements (fast):
>> 
>> SELECT i.id, i.title, i.description FROM dir_items i INNER JOIN
>> dir_assoc a ON a.itemid=i.id WHERE a.parentid=59 AND a.ex=0
>> 
>> Here are the two statements (slow):
>> 
>> SELECT i.id, i.title, i.description FROM dir_items i LEFT JOIN dir_assoc
>> a ON a.itemid=i.id WHERE a.parentid=59 AND a.ex=0
>> 
>> Regards,
>> 
>> - James
>> 
>> Editor, VB Web
>> ==
>> Web   - http://www.vbweb.co.uk
>> Email - [EMAIL PROTECTED]
>> ICQ#  - 60612011
>> Fax   - +44(0)8707052859
>> ==
>> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP3

2001-06-20 Thread William Poarch

Hi,

Does "Select a.field, b.field from table_one a, table_two b where a.id =
b.id" work in PHP3/MySQL 3.22.32?

Client's running PHP3, and I'm on 4.

thanks.
 - - - - - - - - - -
 Scott Poarch
 www.globalhost.com
 - - - - - - - - - -


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Missing Records

2001-05-15 Thread William Poarch

Hi all,

I have a setup where I populate one table as a temporary holding place for data. When 
the user's session is complete, I want to transfer all that data to a similar, 
permanent table.

The strangeness is this - most of the time the data is all transferred fine, but 
sometimes only a few of the records will make it. If it always failed, I'd just figure 
the code was wonky, but becuase it gets through sporadically, I'm stumped. I'm 
guessing it has something to do with one mysql_query starting up before the previous 
one is finished. Help, please.

Here's the code:

for($counter = 1; $counter <=20; $counter++)
{
if($carray[$counter] != "" && $carray[$counter] != "0")
{
$sql = "SELECT * FROM feedback_results_temp where about_user_pkey = '$aboutradio' and 
by_user_pkey = '$user_pkeytemp' and competency_pkey = '$carray[$counter]'";
$result = mysql_query($sql);

$num = mysql_numrows($result);
if ($num != "0") 
{
$row=mysql_fetch_object($result);
$competency_pkey = $row->competency_pkey;
$rating = $row->rating;
$notes = $row->notes;

$sql_insert = "INSERT INTO feedback_results (about_user_pkey, by_user_pkey, 
competency_pkey, rating, date, notes) VALUES ('$aboutradio', '$user_pkeytemp', 
'$competency_pkey', '$rating', '$todaysdate', '$notes')";
$result_insert = mysql_query($sql_insert);
}
}
}

(After this, the code erases everything from feedback_results_temp)