php-general Digest 25 May 2011 02:06:20 -0000 Issue 7327
Topics (messages 313130 through 313136):
Re: WHERE field = a range of values (value
313130 by: Richard S. Crawford
313131 by: Paul S
Re: strcmp()?
313132 by: David Harkness
313133 by: tedd
GnuPG from PHP - Where is the include ??
313134 by: Eli Orr (Office)
313135 by: Stuart Dallas
about php comet
313136 by: æç½|å䏿¥
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:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
On Tue, May 24, 2011 at 6:51 AM, Paul S <[email protected]> wrote:
> I'd like to check a table to retrieve rows for which one field equals one
> of a set of values
>
> ....
> #get products(fields) in category list
> while ($row = $db_connect->fetch_array($productsincategory_list)) {
> $product = $row ['selection'];
> $fields = "$fields" . " $product,";
> }
> $fields = substr($fields,'',-1);
>
> ###### echo "$fields<br><br>";
> ###### $fields = Prod1, ProD2, Prod3
>
> This ...
>
> $db_connect->fetch_array($sql_result);
>
> $store_result = $db_connect->query("select * from $sql_usertable WHERE
> (($sql_usertable.product1 = '($fields)')||( $sql_usertable.product2 =
> '($fields)')||($sql_usertable.product3 = '($fields)')) order by id desc
> limit $entry, $entries_per_page");
>
> doesn't work. It selects nothing (obviously because no single field equals
> ' (Prod1, Prod2, Prod3) '). But it's the idea. Can I change the:
>
> = '($fields)'
>
> syntax I'm trying?
>
> The actual select checks more fields for this or that and gets more
> complicated so I'd like to keep this as simple
> as possible. I would like to do this without UNIONS (in one pass) if
> possible (my
> dbsql.php doesn't seem to go beyond regular query).
>
Try "in":
where productx in (Prod1, Prod2, Prod3)
--
Sláinte,
Richard S. Crawford ([email protected])
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)
--- End Message ---
--- Begin Message ---
On Tue, 24 May 2011 21:09:34 +0700, "Richard S. Crawford"
<[email protected]> wrote:
On Tue, May 24, 2011 at 6:51 AM, Paul S <[email protected]> wrote:
I'd like to check a table to retrieve rows for which one field equals
one
of a set of values
....
#get products(fields) in category list
while ($row = $db_connect->fetch_array($productsincategory_list)) {
$product = $row ['selection'];
$fields = "$fields" . " $product,";
}
$fields = substr($fields,'',-1);
###### echo "$fields<br><br>";
###### $fields = Prod1, ProD2, Prod3
This ...
$db_connect->fetch_array($sql_result);
$store_result = $db_connect->query("select * from $sql_usertable WHERE
(($sql_usertable.product1 = '($fields)')||( $sql_usertable.product2 =
'($fields)')||($sql_usertable.product3 = '($fields)')) order by id desc
limit $entry, $entries_per_page");
doesn't work. It selects nothing (obviously because no single field
equals
' (Prod1, Prod2, Prod3) '). But it's the idea. Can I change the:
= '($fields)'
syntax I'm trying?
The actual select checks more fields for this or that and gets more
complicated so I'd like to keep this as simple
as possible. I would like to do this without UNIONS (in one pass) if
possible (my
dbsql.php doesn't seem to go beyond regular query).
Try "in":
where productx in (Prod1, Prod2, Prod3)
THANKS. You saved me another day of frustration trying UNION! :-)
In addition your answer also got me here:
http://dev.mysql.com/doc/refman/4.1/en/comparison-operators.html
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
--- End Message ---
--- Begin Message ---
On Tue, May 24, 2011 at 12:48 AM, Vitalii Demianets <[email protected]
> wrote:
> So. to write compatible scripts one should check "< 0", not "== -1".
>
Which matches the documentation:
Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2,
and 0 if they are equal.
David
--- End Message ---
--- Begin Message ---
At 11:10 AM -0700 5/24/11, David Harkness wrote:
On Tue, May 24, 2011 at 12:48 AM, Vitalii Demianets <[email protected]
wrote:
So. to write compatible scripts one should check "< 0", not "== -1".
Which matches the documentation:
Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2,
and 0 if they are equal.
David
David:
I think the point here is that the documentation says the function
returns a number greater than zero, or less than zero, or zero.
It's just that many who have responded on this list show that the
function commonly returns -1, 1, and 0.
It's wise to keep with the documentation.
Cheers,
tedd
--
-------
http://sperling.com/
--- End Message ---
--- Begin Message ---
Please advise - I'guess it is not a build in and looking for the GnuPG
PHP include as
all the GnuPG functions are now considered undefined.
See below.
Thanks
Eli
// GnuPG from PHP - Where is the include ??
// http://www.gnupg.org/gph/en/manual.html
// http://www.gnupg.org/documentation/howtos.en.html
// GnuPG allows to encrypt and sign your data and communication,
// features a versatile key management system as well as access
// modules for all kinds of public key directories.
//
echo "GNU Encrypt with agreed secret key between sides.";
$secret_key = "8660281B6051D071D94B5B230549F9DC851566DC"; // Only shared
parties know this
$the_secret_content = "this is a very secret XML keep the secret key in
the server and client well hidden from 4rd parties"; // Only shared
parties know this
echo "Secret Key between Parties: [$secret_key] <br>";
echo "The sensitive content to keep safe <br>
from 3rd parties: <b> $the_secret_content </b><br>";
//Creating the encryption content
$res = gnupg_init();
gnupg_addencryptkey($res, $secret_key);
$enc = gnupg_encrypt($res, $the_secret_content);
echo "This is the sensitive content encrypted by strong shared secret
key:[".$enc."] <br>";
echo "Secret Key between Parties: [$secret_key] <br>";
$res = gnupg_init();
gnupg_adddecryptkey($res,$secret_key);
$plain = gnupg_decrypt($res, $enc);
echo "This is the sensitive content decrypted by recieving party <br>
that has the shared secret key:[".$plain."] <br>";
_
_
--- End Message ---
--- Begin Message ---
On Tue, May 24, 2011 at 8:41 PM, Eli Orr (Office) <[email protected]> wrote:
> Please advise - I'guess it is not a build in and looking for the GnuPG PHP
> include as
> all the GnuPG functions are now considered undefined.
http://php.net/gnupg.installation
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--- End Message ---
--- Begin Message ---
hello,
I am every interested in comet applications recently, and sadly found php is
very weak in this area.
i am just wondering if it is possible to write an extension to extend the
ability of the php to easy the way to comet applications?
if it possible for php to hold the connect from the client when it is in
fast cgi mode or apache mod php mode?
thanks.
--- End Message ---