php-general Digest 23 Jan 2009 14:30:27 -0000 Issue 5918
Topics (messages 287037 through 287041):
Re: To check for existing user in database
287037 by: Lars Torben Wilson
Java / PHP Bridge
287038 by: DaveLyons85
Re: distinguish between null variable and unset variable
287039 by: Thodoris
Re: PHP 5.2.8 fails to find libiconv
287040 by: Thodoris
Authentication by client certificate
287041 by: Jesus Campos
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 ---
2009/1/16 Shawn McKenzie <[email protected]>:
> Lars Torben Wilson wrote:
>> 2009/1/15 tedd <[email protected]>:
>>> At 9:46 AM -0800 1/15/09, Chris Carter wrote:
>>>
>>> Chris:
>>>
>>> That's not the way I would do it. After establishing a connection with the
>>> database, I would use the query:
>>>
>>> $query "SELECT email FROM owners WHERE email = '$emailAddress' ":
>>> $result = mysql_query($query) or die(mysql_error());
>>>
>>> if(mysql_affected_rows())
>>> {
>>> // then report a duplicate email/record.
>>> }
>>> else
>>> {
>>> // else insert a new record in the dB.
>>> }
>>>
>>> HTH's
>>>
>>> tedd
>>
>> You want to use mysql_num_rows() there instead of
>> mysql_affected_rows(). (Just a typo in this case, I suspect, but for
>> the benefit of the less experienced it's worth pointing out.)
>>
>> For the newer PHP users, mysql_num_rows() tells you the number of rows
>> you found with a SELECT query, while mysql_affected_rows() tells you
>> how many rows you affected with an INSERT, UPDATE, REPLACE INTO, or
>> DELETE query.
>>
>>
>> Regards,
>>
>> Torben
>
> mysql_num_rows() may make more sense, however mysql_affected_rows() will
> work the same with a select. The PHP mysql_affected_rows() calls the
> MySQL mysql_affected_rows(), which states:
>
> "For SELECT statements, mysql_affected_rows() works like mysql_num_rows()."
(My apologies for not following the thread for a week. . .)
Yes, you are right, except that the restriction isn't with MySQL, it's
within PHP. The problem is that if you leave out the optional resource
argument it works like you describe, but if you include the argument,
PHP barfs. It's good practice to use the one intended for the purpose
at hand, even if the other will work in some (or even most)
situations.
I suppose this is a bug in PHP in that it should really behave the way
that the MySQL API does to avoid surprises, but it does illustrate the
point that using the intended function is easier in the long run: you
know it's been tested against its intended usage and not necessarily
against others.
Regards,
Torben
--- End Message ---
--- Begin Message ---
Hi all,
I've been looking into running a complex Java simulation I've made from a
LAMP web server and was wondering if this was possible? Basically the user
is able to set the configuation from a page and then my intention is for a
PHP script to execute the Java. I've read into all the Java/PHP bridge sf
stuff (without actually attempting to do it yet admitidly), but was
wondering if something like this is possible, there will be several PHP
objects that I'll need to be passed over to instantiate my Java simulation
class.
Any info is much appreciated
Thanks
DL
--
View this message in context:
http://www.nabble.com/Java---PHP-Bridge-tp21620091p21620091.html
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
How can I tell the difference between a variable whose value is null and
a variable which is not set?
// cannot use === null:
ket% php -r '$null = null; var_dump(null === $null);'
bool(true)
ket% php -r 'var_dump(null === $unset);'
bool(true)
ket%
// - cannot use isset() either:
ket% php -r '$null = null; var_dump(isset($null));'
bool(false)
ket% php -r 'var_dump(isset($unset));'
bool(false)
ket%
Although this is a good problem to lose time for I think it is
pointless. Since assigning the null constant to a var is making PHP to
pretend like it never existed.
Is this not the point?
Without this feature I can think many cases that isset or is_null would
be useless.
You could always assign to something the empty string '' and use empty()
to check it as an alternative.
BTW what are you trying to do?
--
Thodoris
--- End Message ---
--- Begin Message ---
Hi,
I'm attempting to install PHP 5.2.8 on CentOS 5.2 x86_64. The glibc iconv
doesn't seem to function very well, leading to a bunch of failed tests when
running 'make test' (see below). After a bit of Googling I stumbled upon
http://nl2.php.net/manual/en/intro.iconv.php which suggests to install libiconv
instead of relying on glibc's iconv, when things go wrong.
My configure line reads as follows:
./configure --prefix=/chroot/apache2/php --with-apxs2=/chroot/apache2/bin/apxs
--disable-cgi --with-zlib --with-gettext --enable-sockets --with-xmlrpc
--with-xsl --with-config-file-path=/php/etc --with-mcrypt --enable-mbregex
--with-gd --with-mime-magic=/usr/share/mime/magic --enable-mbstring=all
--with-openssl --with-mysql=/chroot/mysql --with-curl=/usr/lib64 --enable-zip
--with-freetype-dir=/usr/lib64 --with-png-dir --with-jpeg-dir
--with-libdir=lib64 --with-gnu-ld --with-iconv=/usr/local/lib
which yields the following result:
--------
checking for iconv support... yes
configure: error: Please reinstall the iconv library.
--------
Configure runs fine when I omit the path in the --with-iconv directive, but
that will use glibc's iconv, which results in the following failed tests when
running make check:
--------
Bug #16069 (ICONV transliteration failure) [ext/iconv/tests/bug16069.phpt]
iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
Test session_decode() function : variation
[ext/session/tests/session_decode_variation3.phpt]
Test session_encode() function : variation
[ext/session/tests/session_encode_variation8.phpt]
Test tempnam() function: usage variations - permissions(0000 to 0777) of dir
[ext/standard/tests/file/tempnam_variation4.phpt]
htmlentities() test 2 (setlocale / fr_FR.ISO-8859-15)
[ext/standard/tests/strings/htmlentities02.phpt] (warn: possibly braindead libc)
htmlentities() test 4 (setlocale / ja_JP.EUC-JP)
[ext/standard/tests/strings/htmlentities04.phpt] (warn: possibly braindead libc)
htmlentities() test 15 (setlocale / KOI8-R)
[ext/standard/tests/strings/htmlentities15.phpt] (warn: possibly braindead libc)
--------
Any thoughts/suggestions/ideas on how to solve this would be greatly
appreciated!
Regards,
Ro
Although this not strictly a PHP question you could try to update first.
#yum update
Just in case something went wrong
--
Thodoris
--- End Message ---
--- Begin Message ---
Hi there,
I would like to create a application that can be able to authenticate by
client certificate.
Can I make this by apache/php? Anyone can recomend me documantation?
Thanks,
JCampos
--- End Message ---