php-general Digest 9 Feb 2006 08:30:34 -0000 Issue 3953
Topics (messages 230115 through 230143):
Re: Recompile PHP on pre-installed system
230115 by: Rory Browne
230123 by: Justin Cook
230124 by: Dan McCullough
230126 by: Justin Cook
target?
230116 by: William Stokes
230117 by: Jay Blanchard
230121 by: William Stokes
230125 by: Weber Sites LTD
230127 by: afan.afan.net
230129 by: Curt Zirzow
Re: REGEX query
230118 by: phplists
230119 by: Kim Christensen
230120 by: phplists
Re: Array sizes?
230122 by: Anders Norrbring
Re: Sending error_log to screen
230128 by: Curt Zirzow
Re: how to show 6 randomly selected featured products?
230130 by: Chris
230134 by: Afan Pasalic
230135 by: Afan Pasalic
230136 by: Chris
230137 by: Chris
230138 by: Curt Zirzow
230139 by: Chris
Re: image location hiding techniques
230131 by: Chuck Anderson
Re: How to output multiple tables nicely(!) from PHP in Excel format?
230132 by: Gerry Danen
Re: php.ini version changed, code broke
230133 by: Gerry Danen
define() or $variable for application settings?
230140 by: Matt Arnilo S. Baluyos (Mailing Lists)
230141 by: Chris
Re: multisession download
230142 by: Shu Hung (Koala)
Is my user system bad?
230143 by: Peter Lauri
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
php-general@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
If you're using a Redhat Enterprise version with a support contract then I
personally don't think you should attempt to run a non-redhat php binary.
Instead find out how redhat make their php-mysql or php-ldap or
php-{some_other_php_module} rpm, Make an RPM, and install it like you would
any other RPM.
Better still would be to upgrade to Debian( they have more php modules I
believe than RH), but that would require much more downtime than an apache
restart.
What module do you need?
On 2/7/06, Marcus Bointon <[EMAIL PROTECTED]> wrote:
>
> On 7 Feb 2006, at 11:13, Jochem Maas wrote:
>
> > in theory your done, in practice something might bite you in the
> > ass ...
> > oh and then there is the issue of making sure that the redhat
> > package manager really
> > won't overwrite your handbuilt php install (cannot for the life of
> > me remember what you have
> > to do to make redhat ignore the php install).
>
> This might be of help: http://www.ae.iitm.ac.in/pipermail/ilugc/2005-
> August/020152.html
>
> You can edit those srpms to include whatever configure line switches
> you need.
>
> I run RHEL4, and my own compile of PHP, set up outside of rpm. You
> only need to worry about rpm getting confused if you use it to
> install any packages that are dependent on php, e.g. squirrelmail.
> Essentially either do ALL of your PHP setup and install through rpm
> or none of it. I'm quite happy handling PHP myself, and conflicts are
> rare as php is rarely a dependency for apps installed through rpm.
>
> Marcus
> --
> Marcus Bointon
> Synchromedia Limited: Putting you in the picture
> [EMAIL PROTECTED] | http://www.synchromedia.co.uk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Yes, we are using RHE 4 with a support contract. I need to get db2 support
compiled in so we can access our AS400 using ODBC. _____
From: Rory Browne [mailto:[EMAIL PROTECTED]
To: Marcus Bointon [mailto:[EMAIL PROTECTED]
Cc: Justin Cook [mailto:[EMAIL PROTECTED], PHP General [mailto:[EMAIL PROTECTED]
Sent: Wed, 08 Feb 2006 12:45:16 -0600
Subject: Re: [PHP] Recompile PHP on pre-installed system
If you're using a Redhat Enterprise version with a support contract then I
personally don't think you should attempt to run a non-redhat php binary.
Instead find out how redhat make their php-mysql or php-ldap or
php-{some_other_php_module} rpm, Make an RPM, and install it like you would
any other RPM.
Better still would be to upgrade to Debian( they have more php modules I
believe than RH), but that would require much more downtime than an apache
restart.
What module do you need?
On 2/7/06, Marcus Bointon <[EMAIL PROTECTED]> wrote: On 7 Feb 2006, at 11:13,
Jochem Maas wrote:
> in theory your done, in practice something might bite you in the
> ass ...
> oh and then there is the issue of making sure that the redhat
> package manager really
> won't overwrite your handbuilt php install (cannot for the life of
> me remember what you have
> to do to make redhat ignore the php install).
This might be of help: http://www.ae.iitm.ac.in/pipermail/ilugc/2005-
August/020152.html
You can edit those srpms to include whatever configure line switches
you need.
I run RHEL4, and my own compile of PHP, set up outside of rpm. You
only need to worry about rpm getting confused if you use it to
install any packages that are dependent on php, e.g. squirrelmail.
Essentially either do ALL of your PHP setup and install through rpm
or none of it. I'm quite happy handling PHP myself, and conflicts are
rare as php is rarely a dependency for apps installed through rpm.
Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
you can use php-odbc make sure you have unixODBC or like install on
the system, once you do that its a piece of cake, been doing that here
for a few months.
On 2/8/06, Justin Cook <[EMAIL PROTECTED]> wrote:
> Yes, we are using RHE 4 with a support contract. I need to get db2 support
> compiled in so we can access our AS400 using ODBC. _____
>
> From: Rory Browne [mailto:[EMAIL PROTECTED]
> To: Marcus Bointon [mailto:[EMAIL PROTECTED]
> Cc: Justin Cook [mailto:[EMAIL PROTECTED], PHP General [mailto:[EMAIL
> PROTECTED]
> Sent: Wed, 08 Feb 2006 12:45:16 -0600
> Subject: Re: [PHP] Recompile PHP on pre-installed system
>
> If you're using a Redhat Enterprise version with a support contract then I
> personally don't think you should attempt to run a non-redhat php binary.
>
> Instead find out how redhat make their php-mysql or php-ldap or
> php-{some_other_php_module} rpm, Make an RPM, and install it like you would
> any other RPM.
>
> Better still would be to upgrade to Debian( they have more php modules I
> believe than RH), but that would require much more downtime than an apache
> restart.
>
> What module do you need?
>
>
> On 2/7/06, Marcus Bointon <[EMAIL PROTECTED]> wrote: On 7 Feb 2006, at
> 11:13, Jochem Maas wrote:
>
> > in theory your done, in practice something might bite you in the
> > ass ...
> > oh and then there is the issue of making sure that the redhat
> > package manager really
> > won't overwrite your handbuilt php install (cannot for the life of
> > me remember what you have
> > to do to make redhat ignore the php install).
>
> This might be of help: http://www.ae.iitm.ac.in/pipermail/ilugc/2005-
> August/020152.html
>
> You can edit those srpms to include whatever configure line switches
> you need.
>
> I run RHEL4, and my own compile of PHP, set up outside of rpm. You
> only need to worry about rpm getting confused if you use it to
> install any packages that are dependent on php, e.g. squirrelmail.
> Essentially either do ALL of your PHP setup and install through rpm
> or none of it. I'm quite happy handling PHP myself, and conflicts are
> rare as php is rarely a dependency for apps installed through rpm.
>
> Marcus
> --
> Marcus Bointon
> Synchromedia Limited: Putting you in the picture
> [EMAIL PROTECTED] | http://www.synchromedia.co.uk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
--- End Message ---
--- Begin Message ---
Great, I'll do it that way. That sounds easier than what I was attempting to
do. Thanks!
_____
From: Dan McCullough [mailto:[EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Wed, 08 Feb 2006 13:23:17 -0600
Subject: Re: [PHP] Recompile PHP on pre-installed system
you can use php-odbc make sure you have unixODBC or like install on
the system, once you do that its a piece of cake, been doing that here
for a few months.
On 2/8/06, Justin Cook <[EMAIL PROTECTED]> wrote:
> Yes, we are using RHE 4 with a support contract. I need to get db2 support
> compiled in so we can access our AS400 using ODBC. _____
>
> From: Rory Browne [mailto:[EMAIL PROTECTED]
> To: Marcus Bointon [mailto:[EMAIL PROTECTED]
> Cc: Justin Cook [mailto:[EMAIL PROTECTED], PHP General [mailto:[EMAIL
> PROTECTED]
> Sent: Wed, 08 Feb 2006 12:45:16 -0600
> Subject: Re: [PHP] Recompile PHP on pre-installed system
>
> If you're using a Redhat Enterprise version with a support contract then I
> personally don't think you should attempt to run a non-redhat php binary.
>
> Instead find out how redhat make their php-mysql or php-ldap or
> php-{some_other_php_module} rpm, Make an RPM, and install it like you would
> any other RPM.
>
> Better still would be to upgrade to Debian( they have more php modules I
> believe than RH), but that would require much more downtime than an apache
> restart.
>
> What module do you need?
>
>
> On 2/7/06, Marcus Bointon <[EMAIL PROTECTED]> wrote: On 7 Feb 2006, at
> 11:13, Jochem Maas wrote:
>
> > in theory your done, in practice something might bite you in the
> > ass ...
> > oh and then there is the issue of making sure that the redhat
> > package manager really
> > won't overwrite your handbuilt php install (cannot for the life of
> > me remember what you have
> > to do to make redhat ignore the php install).
>
> This might be of help: http://www.ae.iitm.ac.in/pipermail/ilugc/2005-
> August/020152.html
>
> You can edit those srpms to include whatever configure line switches
> you need.
>
> I run RHEL4, and my own compile of PHP, set up outside of rpm. You
> only need to worry about rpm getting confused if you use it to
> install any packages that are dependent on php, e.g. squirrelmail.
> Essentially either do ALL of your PHP setup and install through rpm
> or none of it. I'm quite happy handling PHP myself, and conflicts are
> rare as php is rarely a dependency for apps installed through rpm.
>
> Marcus
> --
> Marcus Bointon
> Synchromedia Limited: Putting you in the picture
> [EMAIL PROTECTED] | http://www.synchromedia.co.uk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hello
Is target="_parent" opposite to target="_blank"?
Thanks
-Will
--- End Message ---
--- Begin Message ---
[snip]
Is target="_parent" opposite to target="_blank"?
[/snip]
Opposite? no. Not alike? yes.
--- End Message ---
--- Begin Message ---
I mean.
If I open popup named page2.htm from page1.htm with target="_blank" can I go
back to page1.htm with target="_parent"?
-W
"Jay Blanchard" <[EMAIL PROTECTED]> kirjoitti
viestissä:[EMAIL PROTECTED]
> [snip]
> Is target="_parent" opposite to target="_blank"?
> [/snip]
>
> Opposite? no. Not alike? yes.
--- End Message ---
--- Begin Message ---
What you need to do is close page2.htm with JavaScript (window.close)
And then page1.htm will be back. To make sure page1 will be back
You can reload it with onload=focus() in the <BODY>.
Sincerely
berber
Visit the Weber Sites Today,
To see where PHP might take you tomorrow.
PHP code examples : http://www.weberdev.com
SEO Monitor : http://seo.weberdev.com
-----Original Message-----
From: William Stokes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 08, 2006 9:10 PM
To: php-general@lists.php.net
Subject: Re: [PHP] target?
I mean.
If I open popup named page2.htm from page1.htm with target="_blank" can I go
back to page1.htm with target="_parent"?
-W
"Jay Blanchard" <[EMAIL PROTECTED]> kirjoitti
viestissה:[EMAIL PROTECTED]
> [snip]
> Is target="_parent" opposite to target="_blank"?
> [/snip]
>
> Opposite? no. Not alike? yes.
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Let's say you did some change on your popup window (page2.php)
if(isset($_POST['change']))
{
# your "changes" code here
# and, once you are finished you are going to execute the folloving html
code
?>
<html>
<head>
<script language="JavaScript"><!--
function close_redirect() {
parent.opener.location='page1.php';
parent.close();
}
//--></script>
</head>
<body onLoad="close_redirect()">
</body>
</html>
<?php
exit; # with this exit you are not allow executing the rest of the code
}
popup (page2.php) will close and page1.php will be refreshed.
-afan
> What you need to do is close page2.htm with JavaScript (window.close)
> And then page1.htm will be back. To make sure page1 will be back
> You can reload it with onload=focus() in the <BODY>.
>
> Sincerely
>
> berber
>
> Visit the Weber Sites Today,
> To see where PHP might take you tomorrow.
> PHP code examples : http://www.weberdev.com
> SEO Monitor : http://seo.weberdev.com
>
>
> -----Original Message-----
> From: William Stokes [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 08, 2006 9:10 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] target?
>
> I mean.
>
> If I open popup named page2.htm from page1.htm with target="_blank" can I
> go
> back to page1.htm with target="_parent"?
>
> -W
>
>
>
> "Jay Blanchard" <[EMAIL PROTECTED]> kirjoitti
> viestissä:[EMAIL PROTECTED]
>> [snip]
>> Is target="_parent" opposite to target="_blank"?
>> [/snip]
>>
>> Opposite? no. Not alike? yes.
>
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
On Wed, Feb 08, 2006 at 09:02:10PM +0200, William Stokes wrote:
> Hello
> Is target="_parent" opposite to target="_blank"?
http://www.w3.org/TR/html4/types.html#type-frame-target
Curt.
--
cat .signature: No such file or directory
--- End Message ---
--- Begin Message ---
Hi Murray,
The length of text is quite long..it is in fact a 150+ page PDF file,
which as it's using an earlier version of PDF I can 'translate' into a
format that I can extract data from..it's just this one bit of text that
I'm stuck on. Yes it does appear multiple times, but the pattern is
always the same.
Cheers
Alexis
Murray @ PlanetThoughtful wrote:
On 9/02/2006 12:29 AM, phplists wrote:
Thanks for that...and yes that would do very nicely.
Unfortunately, for what I'm trying to do, it is of little use. I
probably should have mentioned that the bit of text I used is actually
just part of a much bigger bit of text so exploding on a space would
cause havoc with the rest of it. Hence the REGEX question.
But, I still agree with you 100% about keeping things simple :o)
Thanks
Alexis
Hi Alexis,
Can you give us an example of the full length of text? Does the target
value appear only once in any one string?
Is the pattern always:
-left bracket
-backslash
-left bracket
-2 letters
-backslash
-right bracket
-space
-2 letters
-dash
-single digit
-space
-right bracket
?
Much warmth,
Murray
---
"Lost in thought"
http://www.planetthoughtful.org
"Urban legends, superstitions, ghost
stories and folklore"
http://www.ulblog.org
--- End Message ---
--- Begin Message ---
Alexis,
> Unfortunately, for what I'm trying to do, it is of little use. I
> probably should have mentioned that the bit of text I used is actually
> just part of a much bigger bit of text so exploding on a space would
> cause havoc with the rest of it. Hence the REGEX question.
$text = '(\(EX\) RV-6 )';
preg_match_all("/\([^\)]+\) ([^\)]+) \)/", $text, $result);
echo $result[1][0];
Take care
--
Kim Christensen
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
>>> > I have this bit of text:
>>> > (\(EX\) RV-6 )
>>> >
>>> > I want to remove the '\(EX\)' part of it
>>> > so leaving just: ( RV-6 )
$text = '(\(EX\) RV-6 )';
$str = str_replace('\(EX\)','',$text);
As Burhan put it, regex is not always the solution to your problem -
in most cases, using regex for this kind of operations will just hog
your scripts.
--
Kim Christensen
[EMAIL PROTECTED]
Thanks Kim, that'll solve the problem very nicely.
As a matter of point though, and as I initially said I ma trying to get
to grips with REGEX, so perhaps if someone would be kind enough to
explain the format that it needs to be in for REGEX, as I've said, I'm
having problems with the escaping of the \ & (, so it's somethign I
defintely need to know for future reference.
Cheers
Alexis
--- End Message ---
--- Begin Message ---
Rory Browne skrev:
At 01:05 AM 2/8/2006, Barry wrote:
I don't think a "function" exists, but i would probably use (for
benchmarking) a recursive foreach in combination with strlen.
And add it all up.
(This is probably some work for the PC so that's why benchmarking)
It would be interesting to know whether that method was faster or
slower than using this:
$iLen = strlen(implode("", $aArray));
the problem I would have with the above code would be that it assumes
you're using a single dimention array.
Recursive foreach:
function array_size($a){
$size = 0;
while(list($k, $v) = each($a)){
$size += is_array($v) ? array_size($v) : strlen($v);
}
return $size;
}
This could possibly be optimised even more by using references or something
like that.
eg
foreach(array_keys($a) as $k){
size = is_array($a[$k]) =& array_size($a[$k]) : strlen($a[$k])
But I think that for the most part your time programming will be more
important than the programs time running.
Exactly what I was looking for.. :) Thanks!
I personally don't need this at runtime, only at design time, just to
help setting limits etc for the running app when testing.
--
Anders Norrbring
Norrbring Consulting
--- End Message ---
--- Begin Message ---
On Wed, Feb 08, 2006 at 01:25:18PM -0500, Reuben D. Budiardja wrote:
>
> Hello,
> For debugging purposes, I have "display_errors = On" in the /etc/php.ini on
> my
> development server.
>
> I'm trying to use the error_log() function to log errors, however, the string
> message does not get send to script output (ie. browser), even with
You want to use trigger_error()
Curt.
--
cat .signature: No such file or directory
--- End Message ---
--- Begin Message ---
Hi,
Grab that query and run it through mysql with 'explain', so:
explain SELECT p.prod_id, p.prod_name, p.prod_no, chp.cat_id,
c.cat_name, c.cat_parent, pr.price
FROM products as p
LEFT JOIN categories_has_products as chp ON chp.prod_id = p.prod_id
LEFT JOIN categories as c ON chp.cat_id = c.cat_id
LEFT JOIN prices as pr ON pr.prod_id = p.prod_id
WHERE prod_featured = '1'
ORDER BY RAND(), pr.price ASC
LIMIT 6
That will show you whether you are using the database indexes or not.
If you can't work it out then post the explain output.
[EMAIL PROTECTED] wrote:
I'm still in trouble with this problem :(
Solution:
$query = my_query("
SELECT p.prod_id, p.prod_name, p.prod_no, chp.cat_id, c.cat_name,
c.cat_parent, pr.price
FROM products as p
LEFT JOIN categories_has_products as chp ON chp.prod_id = p.prod_id
LEFT JOIN categories as c ON chp.cat_id = c.cat_id
LEFT JOIN prices as pr ON pr.prod_id = p.prod_id
WHERE prod_featured = '1'
ORDER BY RAND(), pr.price ASC
LIMIT 6
", 0);
was working fine but KILLLING SLOW!!!
Now, I'm trying this way:
$query = my_query("
SELECT prod_id
FROM products
WHERE prod_featured = '1'
ORDER BY RAND() LIMIT 6
", 0);
while($result = mysql_fetch_array($query))
{
$FEATURED_PRODUCTS_IDS[] = $result['prod_id'];
}
$query = my_query("
SELECT p.prod_id, p.prod_name, p.prod_no, chp.cat_id, c.cat_name,
c.cat_parent, pr.price
FROM products as p
LEFT JOIN categories_has_products as chp ON chp.prod_id = p.prod_id
LEFT JOIN categories as c ON chp.cat_id = c.cat_id
LEFT JOIN prices as pr ON pr.prod_id = p.prod_id
WHERE
p.prod_id = ". $FEATURED_PRODUCTS_IDS[0] ." OR
p.prod_id = ". $FEATURED_PRODUCTS_IDS[1] ." OR
p.prod_id = ". $FEATURED_PRODUCTS_IDS[2] ." OR
p.prod_id = ". $FEATURED_PRODUCTS_IDS[3] ." OR
p.prod_id = ". $FEATURED_PRODUCTS_IDS[4] ." OR
p.prod_id = ". $FEATURED_PRODUCTS_IDS[5] ."
ORDER BY pr.price ASC
", 0);
But, since I have more than one price for product I'm getting 6 products
but with all avaliable prices. And I need ONLY the lowest price.
Any idea?
Thanks for any help.
-afan
--- End Message ---
--- Begin Message ---
Hm. Have no idea what does it means:
table
type
possible_keys
key
key_len
ref
rows
Extra
p
ALL
NULL
NULL
NULL
NULL
1268
Using
where;
Using
temporary; Using filesort
chp
index
NULL
PRIMARY
8
NULL
1741
Using
index
c
eq_ref
PRIMARY
PRIMARY
4
chp.cat_id
1
pr
ALL
NULL
NULL
NULL
NULL
10231
-afan
On Thu, 2006-02-09 at 09:53 +1100, Chris wrote:
> Hi,
>
> Grab that query and run it through mysql with 'explain', so:
>
> explain SELECT p.prod_id, p.prod_name, p.prod_no, chp.cat_id,
> c.cat_name, c.cat_parent, pr.price
> FROM products as p
> LEFT JOIN categories_has_products as chp ON chp.prod_id = p.prod_id
> LEFT JOIN categories as c ON chp.cat_id = c.cat_id
> LEFT JOIN prices as pr ON pr.prod_id = p.prod_id
> WHERE prod_featured = '1'
> ORDER BY RAND(), pr.price ASC
> LIMIT 6
>
> That will show you whether you are using the database indexes or not.
>
> If you can't work it out then post the explain output.
>
--- End Message ---
--- Begin Message ---
The result display is bad (at least on at email). Here is a snapshot:
http://afan.net/bhw/snapshot1.png
-afan
On Wed, 2006-02-08 at 19:39 -0500, Afan Pasalic wrote:
> Hm. Have no idea what does it means:
>
> table
> type
> possible_keys
> key
> key_len
> ref
> rows
> Extra
> p
> ALL
> NULL
> NULL
> NULL
> NULL
> 1268
> Using
> where;
> Using
> temporary; Using filesort
> chp
> index
> NULL
> PRIMARY
> 8
> NULL
> 1741
> Using
> index
> c
> eq_ref
> PRIMARY
> PRIMARY
> 4
> chp.cat_id
> 1
>
> pr
> ALL
> NULL
> NULL
> NULL
> NULL
> 10231
>
>
>
> -afan
>
>
> On Thu, 2006-02-09 at 09:53 +1100, Chris wrote:
> > Hi,
> >
> > Grab that query and run it through mysql with 'explain', so:
> >
> > explain SELECT p.prod_id, p.prod_name, p.prod_no, chp.cat_id,
> > c.cat_name, c.cat_parent, pr.price
> > FROM products as p
> > LEFT JOIN categories_has_products as chp ON chp.prod_id = p.prod_id
> > LEFT JOIN categories as c ON chp.cat_id = c.cat_id
> > LEFT JOIN prices as pr ON pr.prod_id = p.prod_id
> > WHERE prod_featured = '1'
> > ORDER BY RAND(), pr.price ASC
> > LIMIT 6
> >
> > That will show you whether you are using the database indexes or not.
> >
> > If you can't work it out then post the explain output.
> >
>
>
--- End Message ---
--- Begin Message ---
Can you post it how it comes back or copy/paste it to a webpage (.txt is
fine) so we can see it formatted?
Afan Pasalic wrote:
Hm. Have no idea what does it means:
table
type
possible_keys
key
key_len
ref
rows
Extra
p
ALL
NULL
NULL
NULL
NULL
1268
Using
where;
Using
temporary; Using filesort
chp
index
NULL
PRIMARY
8
NULL
1741
Using
index
c
eq_ref
PRIMARY
PRIMARY
4
chp.cat_id
1
pr
ALL
NULL
NULL
NULL
NULL
10231
-afan
On Thu, 2006-02-09 at 09:53 +1100, Chris wrote:
Hi,
Grab that query and run it through mysql with 'explain', so:
explain SELECT p.prod_id, p.prod_name, p.prod_no, chp.cat_id,
c.cat_name, c.cat_parent, pr.price
FROM products as p
LEFT JOIN categories_has_products as chp ON chp.prod_id = p.prod_id
LEFT JOIN categories as c ON chp.cat_id = c.cat_id
LEFT JOIN prices as pr ON pr.prod_id = p.prod_id
WHERE prod_featured = '1'
ORDER BY RAND(), pr.price ASC
LIMIT 6
That will show you whether you are using the database indexes or not.
If you can't work it out then post the explain output.
--- End Message ---
--- Begin Message ---
Oops, missed this one before I sent that other email.
I think it's the order of your joins playing up.
LEFT JOIN categories as c ON chp.cat_id = c.cat_id
LEFT JOIN prices as pr ON pr.prod_id = p.prod_id
That means it will join categories -> prices - not what you want.
Try this query:
SELECT p.prod_id, p.prod_name, p.prod_no, chp.cat_id,
c.cat_name, c.cat_parent, pr.price
FROM
products p,
categories_has_products chp,
categories c,
prices pr
WHERE
chp.prod_id = p.prod_id
AND chp.cat_id = c.cat_id
AND pr.prod_id = p.prod_id
AND prod_featured = '1'
ORDER BY RAND(), pr.price ASC
LIMIT 6
Afan Pasalic wrote:
The result display is bad (at least on at email). Here is a snapshot:
http://afan.net/bhw/snapshot1.png
-afan
On Wed, 2006-02-08 at 19:39 -0500, Afan Pasalic wrote:
Hm. Have no idea what does it means:
table
type
possible_keys
key
key_len
ref
rows
Extra
p
ALL
NULL
NULL
NULL
NULL
1268
Using
where;
Using
temporary; Using filesort
chp
index
NULL
PRIMARY
8
NULL
1741
Using
index
c
eq_ref
PRIMARY
PRIMARY
4
chp.cat_id
1
pr
ALL
NULL
NULL
NULL
NULL
10231
-afan
On Thu, 2006-02-09 at 09:53 +1100, Chris wrote:
Hi,
Grab that query and run it through mysql with 'explain', so:
explain SELECT p.prod_id, p.prod_name, p.prod_no, chp.cat_id,
c.cat_name, c.cat_parent, pr.price
FROM products as p
LEFT JOIN categories_has_products as chp ON chp.prod_id = p.prod_id
LEFT JOIN categories as c ON chp.cat_id = c.cat_id
LEFT JOIN prices as pr ON pr.prod_id = p.prod_id
WHERE prod_featured = '1'
ORDER BY RAND(), pr.price ASC
LIMIT 6
That will show you whether you are using the database indexes or not.
If you can't work it out then post the explain output.
--- End Message ---
--- Begin Message ---
On Wed, Feb 08, 2006 at 08:02:41PM -0500, Afan Pasalic wrote:
> The result display is bad (at least on at email). Here is a snapshot:
> http://afan.net/bhw/snapshot1.png
That isn't good. I would suggest you seek help on a sql list like
mysql's general list
Curt.
--
cat .signature: No such file or directory
--- End Message ---
--- Begin Message ---
Hi,
Joins are fine to use, the problem here is you have them in the wrong order.
SELECT p.prod_id, p.prod_name, p.prod_no, chp.cat_id,
c.cat_name, c.cat_parent, pr.price
FROM products as p
LEFT JOIN categories_has_products as chp ON chp.prod_id = p.prod_id
LEFT JOIN categories as c ON chp.cat_id = c.cat_id
LEFT JOIN prices as pr ON pr.prod_id = p.prod_id
WHERE prod_featured = '1'
ORDER BY RAND(), pr.price ASC
LIMIT 6
This is doing:
join products to categories_has_products (using prod_id) -- fine
then join categories_has_products to categories (using cat_id) -- fine
then join categories to prices (using prod_id) --- not fine
You could try
SELECT p.prod_id, p.prod_name, p.prod_no, chp.cat_id,
c.cat_name, c.cat_parent, pr.price
FROM products as p
LEFT JOIN prices as pr ON pr.prod_id = p.prod_id
LEFT JOIN categories_has_products as chp ON chp.prod_id = p.prod_id
LEFT JOIN categories as c ON chp.cat_id = c.cat_id
and it should work quickly because it does:
join products to prices (using prod_id)
then join prices to categories_has_products (using prod_id)
then join categories_has_products to categories (using cat_id)
Afan Pasalic wrote:
?!?!? Yup. It works! YEAH!!! :) :) :)
And pretty fast too!
Ok. I was suggested to use JOIN. But you DON'T use it?
-afan
On Thu, 2006-02-09 at 13:09 +1100, Chris wrote:
Oops, missed this one before I sent that other email.
I think it's the order of your joins playing up.
LEFT JOIN categories as c ON chp.cat_id = c.cat_id
LEFT JOIN prices as pr ON pr.prod_id = p.prod_id
That means it will join categories -> prices - not what you want.
Try this query:
SELECT p.prod_id, p.prod_name, p.prod_no, chp.cat_id,
c.cat_name, c.cat_parent, pr.price
FROM
products p,
categories_has_products chp,
categories c,
prices pr
WHERE
chp.prod_id = p.prod_id
AND chp.cat_id = c.cat_id
AND pr.prod_id = p.prod_id
AND prod_featured = '1'
ORDER BY RAND(), pr.price ASC
LIMIT 6
Afan Pasalic wrote:
The result display is bad (at least on at email). Here is a snapshot:
http://afan.net/bhw/snapshot1.png
-afan
On Wed, 2006-02-08 at 19:39 -0500, Afan Pasalic wrote:
Hm. Have no idea what does it means:
table
type
possible_keys
key
key_len
ref
rows
Extra
p
ALL
NULL
NULL
NULL
NULL
1268
Using
where;
Using
temporary; Using filesort
chp
index
NULL
PRIMARY
8
NULL
1741
Using
index
c
eq_ref
PRIMARY
PRIMARY
4
chp.cat_id
1
pr
ALL
NULL
NULL
NULL
NULL
10231
-afan
On Thu, 2006-02-09 at 09:53 +1100, Chris wrote:
Hi,
Grab that query and run it through mysql with 'explain', so:
explain SELECT p.prod_id, p.prod_name, p.prod_no, chp.cat_id,
c.cat_name, c.cat_parent, pr.price
FROM products as p
LEFT JOIN categories_has_products as chp ON chp.prod_id = p.prod_id
LEFT JOIN categories as c ON chp.cat_id = c.cat_id
LEFT JOIN prices as pr ON pr.prod_id = p.prod_id
WHERE prod_featured = '1'
ORDER BY RAND(), pr.price ASC
LIMIT 6
That will show you whether you are using the database indexes or not.
If you can't work it out then post the explain output.
--- End Message ---
--- Begin Message ---
hbeaumont hbeaumont wrote:
Hi,
I have a site with images that I want people to download but not have
the direct path to. ie. I do not want them to be able to just view the
source, find the dir and then download everything or direct link to
them.
However I can see no way to do this other than keeping the images on
disk, having a php script read them and then spit them out. example:
view.php?92348924 where 92348924 is a code that translates to the
image on disk.
Can anyone think of a better method? If not, what is the most
efficient way to do this (ie. avoid the most i/o)
Thanks!
P.S. I also realize I could use .htaccess to stop direct linking and
turn off directory indexes. Still I think there might be some other
problems with .htaccess
I know it's not exactly what you're asking for, but here's a great php
based defense against hotlinking.
http://www.alistapart.com/articles/hotlinking/
--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************
--- End Message ---
--- Begin Message ---
Oli,
Looks interesting enough to play with. The page mentions "look at the
code" yet I cannot find the code. Is it available?
Gerry
On 2/8/06, Oli Howson <[EMAIL PROTECTED]> wrote:
> The example given outputs to two tabs, "sheeta" and "sheetb"
>
> Quoting Olaf Greve <[EMAIL PROTECTED]>:
>
> > Hi all,
> >
> >> I've written a ArrayToExcel(XML) class, you're welcome to use if you
> >> wish. May need a bit of tweaking to get the colspan working (I
> >> haven't touched it in quite a while). But the process itself I think
> >> is rather nice :)
> > >
> > > http://projects.londonis.co.uk/arraytoexcel/
--- End Message ---
--- Begin Message ---
You should use $_POST...
On 2/8/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hello all from a newbie. We have a Nitix server (from Net Integration
> Technologies, Inc.) that hosts various web site. Recently they released a
> software upgrade, and in the release notes was this warning:
>
> "A number of PHP options (in the php.ini file) were changed, either to
> improve security or to more closely follow the recommendations of the PHP
> developers. This should make it easier to run third-party PHP packages on
> Nitix, but could break existing installations that have been adapted for
> Nitix."
>
> After installing this release, the simplest of all simple things would no
> longer work - a basic HTML menu with 6 choices passed to a PHP script that
> prints out the selection chosen by the user!! The variable name when
> printed (echo'd) in the PHP script was empty.
>
> The HTML:
>
> <form name="form1" method="post" action="a.php">
> <select name="aName" size="1" id="select">
> <option>Deb</option>
> <option>Frank</option>
> <option>Jeff</option>
> <option>Lynne</option>
> <option>Nick</option>
> <option>Tom</option>
> </select>
> <input type="submit" name="Submit" value="Submit">
> </form>
>
> The PHP:
>
> <?php
>
> echo $aName . "ttt";
>
> ?>
>
> What displays??? Just ttt of course. What exactly could have changed to
> make this simple script fail?
--- End Message ---
--- Begin Message ---
Hello Everyone,
I have a config.inc.php file which basically contains all the
configuration info that the applications needs (directory/file
locations, database credentials, etc). The information there is set
using the define() function.
However, I've seen some open-source projects which either use
$variables or associative arrays to save the values.
My application works pretty fine but I'd like to solicit opinions from
everyone on what they are using in this case. Also, I have plans of
putting up a sort of coding guidelines for the company so it might
help to have other opinions on this one.
Thanks and best regards,
Matt
--
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.
--- End Message ---
--- Begin Message ---
Hi Matt,
I use define's.
With variables it's easy to forget to global'ise it when you go into a
function, define's don't have this issue.
Matt Arnilo S. Baluyos (Mailing Lists) wrote:
Hello Everyone,
I have a config.inc.php file which basically contains all the
configuration info that the applications needs (directory/file
locations, database credentials, etc). The information there is set
using the define() function.
However, I've seen some open-source projects which either use
$variables or associative arrays to save the values.
My application works pretty fine but I'd like to solicit opinions from
everyone on what they are using in this case. Also, I have plans of
putting up a sort of coding guidelines for the company so it might
help to have other opinions on this one.
Thanks and best regards,
Matt
--- End Message ---
--- Begin Message ---
2006/2/4, Richard Lynch <[EMAIL PROTECTED]>:
> Put the path of the file you want in the URL?
Sorry, what do you mean by this?
> And make *SURE* you do not let that turn into things like:
> /etc/passwd
I have control to that in my code to prevent this from happening ^^
More info here:
> http://phpsec.org
>
> On Fri, February 3, 2006 1:54 am, Shu Hung (Koala) wrote:
> > Hello,
> >
> > I have a little strange question.
> >
> > Let say if I have a file "/home/user/somefile.jpg"
> > I wanted to output this file from script, I wrote a little script:
> >
> > ------------------------------------------------
> > <?php
> >
> > // open and pass the file out
> > $handle = fopen($this->filedata['filepath'], "rb");
> >
> >
> > while (!feof($handle)) {
> > $buffer = fread($handle, 4096);
> > echo $buffer;
> > }
> >
> > fclose($handle);
> > ?>
> > ------------------------------------------------
> >
> > It works !!!
> >
> > But if I use a download accerlator to download this path, I can only
> > open 1 download session. Is there any way to pass a file out so one
> > can download the file with a multi-session download manager?
> >
> >
> > Thanks
> > Koala Yeung
> >
>
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
>
>
--- End Message ---
--- Begin Message ---
Hi,
I would like to get some comments about my user system.
1. A user logs in, the username and password is checked against the database
2. If correct it adds a row in my database "session" with member_id.
$_SESSION['session_id'] will be set to the mysql_insert_id().
3. To verify if someone is logged on or not, I have a function isLoggedOn()
that checks if there is $_SESSION['session_id'] and it returns the
member_id. If not logged in, the isLoggedOn() returns FALSE.
4. I user the member_id to retrive specific member information
5. To logout, I just unset $_SESSION['session_id']
Is this an ok system to continue to work on? Or is this a very weak system
that is easy to break in to?
I am thinking about setting an new variable $_SESSION['member_id'] so that I
do not need to o a query every time to get the member_id.
Thank you very much!
--- End Message ---