|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Fri Sep 20 2002 - 18:54:29 CDT
php-general Digest 20 Sep 2002 23:54:29 -0000 Issue 1597
Topics (messages 116993 through 117066):
Re: Apache not parsing without .php on url?
116993 by: Paul Nicholson
about forms with php
116994 by: Meltem Demirkus
116995 by: Jon Haworth
116996 by: Ferhat Can
116999 by: Meltem Demirkus
117001 by: Meltem Demirkus
117003 by: Jon Haworth
117004 by: Ford, Mike [LSS]
Date Concat?
116997 by: Rankin, Randy
117011 by: John Holmes
why isn
116998 by: Jesse Lawrence
why isn't this working?
117000 by: Jesse Lawrence
Re: syntax question - eregi()
117002 by: Anthony Ritter
Re: java in php4 on debian testing distribution?
117005 by: Garth Dahlstrom
Re: Best practice question
117006 by: Ford, Mike [LSS]
getimagesize error
117007 by: Sascha Braun
How to check for data on a popen()ed FD?
117008 by: Andre
getimageresize error
117009 by: Sascha Braun
Re: Search system
117010 by: Jesse Cablek
117012 by: Jesse Cablek
Re: Sessions
117013 by: John Holmes
117016 by: Erwin
117017 by: Jeff Bluemel
Re: adding unix account via system command
117014 by: Jesse Cablek
117018 by: Dan Hardiker
Re: PHP source code
117015 by: Oliver Witt
117036 by: Chris Shiflett
Re: HTML 2 TEXT
117019 by: Justin French
117021 by: nicos.php.net
117038 by: Justin French
Closing a browser's child window after user downloads a file
117020 by: Merritt, Dave
Why isn't there much info on apache2?
117022 by: pierre.samson
117023 by: Adam Williams
117024 by: pierre.samson
117025 by: Adam Williams
117028 by: Danny Shepherd
117030 by: Jesse Cablek
117031 by: Danny Shepherd
117032 by: Jesse Cablek
117034 by: pierre.samson
117065 by: Rick Widmer
Querying from PHP to a MySQL database
117026 by: jcole.lgefcu.org
117033 by: Marek Kilimajer
Re: Is php even right for this design?
117027 by: Beau Hartshorne
117029 by: Robert Cummings
117041 by: Jeff Bluemel
117042 by: Robert Cummings
117043 by: John Holmes
odbc_fetch_row()
117035 by: Scott Fletcher
117051 by: Scott Fletcher
array_merge_recursive
117037 by: Michiel van Wessem
117039 by: Kevin Stone
117040 by: Michiel van Wessem
117050 by: Kevin Stone
Binary Safety and Sockets
117044 by: Hans Zaunere
117052 by: Evan Nemerson
117058 by: Hans Zaunere
array_chunk() - use or not use?
117045 by: cLeAnEr
session problem
117046 by: yasin inat
Re: MySQL > Access
117047 by: M1tch
117059 by: Liam MacKenzie
why php4.2.3 caches my pages?
117048 by: Raphael Hamzagic
my i ramble for a while?
117049 by: Lee Doolan
Import & Stamp PDF's
117053 by: Miles Thompson
How do you stop certain headers from going out?
117054 by: Steve Ramage
Dynamic HTML Email
117055 by: Mike Dunlop
117056 by: Jesse Cablek
117057 by: Daniel Kushner
117060 by: Fifield, Mike
Reg Exp issue
117061 by: Taylor York
117063 by: Thoenen, Peter Mr. EPS
All Queries TRUE even when they should be FALSE
117062 by: Monty
117064 by: Philip Hallstrom
117066 by: B.C. Lance
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey,
I think what you're after is 'Options MultiViews' in your apache
config.....don't know about v2 though.
http://httpd.apache.org/docs/mod/core.html#options
HTH!
~Pauly
On Thursday 19 September 2002 01:21 pm, Stefan wrote:
> Hello,
> I have a new Apache 2.0.40 with PHP 4.2.3 installation on a Solaris x86
> box.
>
> Configered in httpd.conf with:
> AddType application/x-httpd-php .php
> and
> LoadModule ....
>
> Parsing url´s with "xxxx .php" works fine, but i can´t figure out why it
> dosen´t
> work if i leave out the ".php"extension in the url? This works in my old
> apache 1 installation.!
>
> The file is named "test.php" in the "abc" directory.
> "http://my.server.se/abc/test.php" works, but not
> "http://my.server.se/abc/test"
>
> Any tips in what i missed out in configuration or how to fix this would be
> appreciated.
>
> best regards,
> Stefan
- --
~Paul Nicholson
Design Specialist
WebPower Design
"The web....the way you want it!"
paul
webpowerdesign.net
"It said uses Windows 98 or better, so I loaded Linux!"
Registered Linux User #183202 using Register Linux System # 81891
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE9iwjNDyXNIUN3+UQRAlJmAJ43X2Aitk+Qpo8wn1yjuqOr1SmW0wCgh5Z6
4AZvoaM6XP9gnE+7UJif+lA=
=Nh4/
-----END PGP SIGNATURE-----
attached mail follows:
Hi,
I want to learn if anyone tried to use both of javasccript and php together
?Because when I tried to use them like this:
<form name="sign" method="POST" action="sign_up_.php"
onSubmit="checkemail(email.value);return false" >
and when I click submit.. javascript is working but it is not going to the
sign_up_ page ......How can I manage it?..
thanks alot..
by the way , by using javascript , I am checking if the email adress are
written correctly ( '
' ...)..
thanks
meltem
attached mail follows:
Hi,
> <form name="sign" method="POST" action="sign_up_.php"
> onSubmit="checkemail(email.value);return false" >
>
> and when I click submit.. javascript is working but
> it is not going to the sign_up_ page ......
It's because of the "return false": that means "after running the checkemail
function, cancel the form submission".
I think you want to have your function return true or false depending on
whether the email address is OK, and take the return out of the onsubmit
handler.
Don't forget to validate the email address on the server as well, otherwise
people who turn off Javascript will be able to submit dodgy data.
Cheers
Jon
attached mail follows:
Hi Meltem,
Since you place return false in the onSubmit code, you cannot submit the
form to the next page. What you need to do is that check if the email field
is empty, if yes return false; if not return true.
----- Original Message -----
From: "Meltem Demirkus" <mdemirkus
momentum-dmt.com>
To: <php-general
lists.php.net>
Sent: Friday, September 20, 2002 2:44 PM
Subject: [PHP] about forms with php
> Hi,
>
> I want to learn if anyone tried to use both of javasccript and php
together
> ?Because when I tried to use them like this:
>
> <form name="sign" method="POST" action="sign_up_.php"
> onSubmit="checkemail(email.value);return false" >
>
> and when I click submit.. javascript is working but it is not going to the
> sign_up_ page ......How can I manage it?..
>
> thanks alot..
> by the way , by using javascript , I am checking if the email adress are
> written correctly ( '
' ...)..
>
> thanks
>
>
> meltem
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
but I also want to check
and . characters.. ...checking only if the email
field is empty or not is not what I want ....
meltem
----- Original Message -----
From: "Ferhat Can" <ferhatc
bilgi.edu.tr>
To: "Meltem Demirkus" <mdemirkus
momentum-dmt.com>;
<php-general
lists.php.net>
Sent: Friday, September 20, 2002 2:49 PM
Subject: Re: [PHP] about forms with php
> Hi Meltem,
> Since you place return false in the onSubmit code, you cannot submit
the
> form to the next page. What you need to do is that check if the email
field
> is empty, if yes return false; if not return true.
>
>
> ----- Original Message -----
> From: "Meltem Demirkus" <mdemirkus
momentum-dmt.com>
> To: <php-general
lists.php.net>
> Sent: Friday, September 20, 2002 2:44 PM
> Subject: [PHP] about forms with php
>
>
> > Hi,
> >
> > I want to learn if anyone tried to use both of javasccript and php
> together
> > ?Because when I tried to use them like this:
> >
> > <form name="sign" method="POST" action="sign_up_.php"
> > onSubmit="checkemail(email.value);return false" >
> >
> > and when I click submit.. javascript is working but it is not going to
the
> > sign_up_ page ......How can I manage it?..
> >
> > thanks alot..
> > by the way , by using javascript , I am checking if the email adress
are
> > written correctly ( '
' ...)..
> >
> > thanks
> >
> >
> > meltem
> >
> >
> > --
> > 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
>
>
attached mail follows:
by the way If I remove return false .. script is checking the correctness
but just after it is going to the page "sign_up_ page .php "..I just want
it to go to the page when the email is correct ..
Is it possible to manage ?
meltem
----- Original Message -----
From: "Jon Haworth" <jhaworth
witanjardine.co.uk>
To: <php-general
lists.php.net>
Sent: Friday, September 20, 2002 2:48 PM
Subject: FW: [PHP] about forms with php
> Hi,
>
> > <form name="sign" method="POST" action="sign_up_.php"
> > onSubmit="checkemail(email.value);return false" >
> >
> > and when I click submit.. javascript is working but
> > it is not going to the sign_up_ page ......
>
> It's because of the "return false": that means "after running the
checkemail
> function, cancel the form submission".
>
> I think you want to have your function return true or false depending on
> whether the email address is OK, and take the return out of the onsubmit
> handler.
>
> Don't forget to validate the email address on the server as well,
otherwise
> people who turn off Javascript will be able to submit dodgy data.
>
> Cheers
> Jon
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Hi,
> by the way If I remove return false .. script is
> checking the correctness but just after it is going
> to the page "sign_up_ page .php "..I just want
> it to go to the page when the email is correct ..
> Is it possible to manage ?
Yes. You need to have the "return true" or "return false" in the javascript
function that checks the email.
function checkEmail(email)
{
// do the check however you like
// create a variable called "check"
// that's either true or false,
// then do something like:
if (check) {
return true;
} else {
return false;
}
}
HTH
Cheers
Jon
attached mail follows:
> -----Original Message-----
> From: Meltem Demirkus [mailto:mdemirkus
momentum-dmt.com]
> Sent: 20 September 2002 13:03
>
> by the way If I remove return false .. script is checking
> the correctness
> but just after it is going to the page "sign_up_ page .php
> "..I just want
> it to go to the page when the email is correct ..
> Is it possible to manage ?
Two options:
(1) Leave your onSubmit as is, and put a form.submit in the checkemail
function once you've "validated" the address.
(2) Change the onSubmit to onSubmit="return checkemail(email.value)" and
have checkemail return true or return false according as it does or doesn't
"validate" the email.value passed.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford
lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
attached mail follows:
I have two fields of type date in a MySQL table called training:
start_date
end_date
I can format the date using a select, for example
SELECT
DATE_FORMAT(start_date, '%M %d, %Y') as start_date,
DATE_FORMAT(end_date, '%M %d, %Y') as end_date
FROM training
This produces the following:
start_date: September 16, 2002
end_date: Sepetember 20, 2001
Based on the above, I would like to echo out something like this:
You will be in training September 16 - 20, 2002.
Is this possible?
Thanks in advance,
Randy
attached mail follows:
> I have two fields of type date in a MySQL table called training:
>
> start_date
> end_date
>
> I can format the date using a select, for example
>
> SELECT
> DATE_FORMAT(start_date, '%M %d, %Y') as start_date,
> DATE_FORMAT(end_date, '%M %d, %Y') as end_date
> FROM training
>
> This produces the following:
>
> start_date: September 16, 2002
> end_date: Sepetember 20, 2001
>
> Based on the above, I would like to echo out something like this:
>
> You will be in training September 16 - 20, 2002.
SELECT
CONCAT(
'You will be training ',
DATE_FORMAT(start_date,'%M %d'),
' - ',
IF(MONTH(start_date)!=MONTH(end_date),
DATE_FORMAT(end_date,'%M %d'),
DATE_FORMAT(end_date,'%d')),
' ',
YEAR(end_date))
FROM training
Another option would be to just select out the individual month, day,
and year out of the database, instead of a formatted date. Or select out
a unix_timestamp and use date() to extract the individual parts and
create your string...
---John Holmes...
attached mail follows:
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
attached mail follows:
This little code snippet is from a login system that
I've made, which takes unconfirmed user-info out of a
mysql table, and places it into a confirmed table
(Uses email confirmation). Now, this has really got
me baffled, because it seemed to be working fine
yesterday. Can anyone please tell me what's wrong
with the following code? Your help will be greatly
appreciated.
//confirm and register new user, get info from
unconfirmed_user and put it in user, then delete from
unconfirmed_user
function confirmNewUser ($confirm_new_user) {
include '../config.php';
global $DB_INCLUDE;
include $DB_INCLUDE;
$user_wait = "select * from unconfirmed_user
where username='$confirm_new_user'";
$user_result = mysql_db_query ($database,
$user_wait, $link);
while ($user_row =
mysql_fetch_array($user_result)) {
$insert_user = "insert into user values ('
','$user_row[name]','$user_row[email_address]','$user_row[password]','$user_row[access]','$user_row[username]','$user_row[description]','$user_row[homepage]','$user_row[online]','$user_row[image]')";
if (mysql_db_query ($database,
$insert_user, $link)) {
$Query2 = "delete from
unconfirmed_user where user_id='$row[user_id]'";
if (mysql_db_query ($database,
$Query2, $link)) {
include
$SERVER_ROOT.'admin/email.php';
mail($row[email_address], "Welcome to
".$SITE_NAME."",$mail_content,"From: News
Bomber
".$SITE_DOMAIN ,"Reply-To: Auto Mailer");
print "<center>Registration
Complete<br /><br />\n";
print "Welcome to ".$SITE_NAME.",
".$row[name].". <br />To make a news post, you must
first <h4><a href=\"index.php\">Login</a></h4><br
/><br />A welcome email has been sent to your email
address.<br /> Check this out for info of interest
about News Bomber.\n";
}else{
print "<center>Registration
Failed</center>\n";
}
}else{
print "<center>Registration
Failed</center>\n";
}
}
}
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
attached mail follows:
Thank you.
TR
attached mail follows:
('binary' encoding is not supported, stored as-is) Monique,
By default Debian does not come come with a recent JVM, due
to the non-free-ness of Sun's license.
So first thing is to see if you have any Java installed at
all... When you type `java` at a shell it should give you
an error about missing parameters... if you get the following:
bash: java: command not found
then you need to install a Java package for PHP4 to work with.
The most useful Java package for Debian, is blackdown.org's
non-free port of Java, do the following to get it do the
following:
to /etc/apt/sources.list add:
# JDK -- mirrors
http://www.blackdown.org/java-linux/mirrors.html
deb http://www.mirror.ac.uk/sites/ftp.blackdown.org/ja va-linux/debian
woody non-free
then run:
apt-get update; apt-get install j2sdk1.3
Once you've installed Blackdown's port of Java, your java.home
var should be set (you may have to log-in again or reload your
profile to see it).
good luck,
-Garth
----- "Monique Y. Herman"
----- 19 Sep 2002 19:48:01 -0400
I'd like to play with using java classes from within php, as is
described in http://www.php.net/manual/en/ref.java.php ... I'm using the
apache and php4 packages from the debian testing distribution.
All of the documentation I've found on the web about installing the java
extension seems to be oriented toward windows, making me think that
maybe I don't need to specify an extension library on linux?
I tried simply using
ini_set ("java.home", "/usr/local/sun-j2sdk1.4.1");
$systemInfo = new Java("java.lang.System");
and got the following:
Fatal error: Cannot instantiate non-existent class: java
That seems fairly straightforward: My php doesn't know java from adam.
So my questions are: Do I need to get an extension library for this
functionality on linux? If not, does anyone know of a debian package of
php4 that will give me this capability? I rather like being able to use
packages wherever possible.
Thanks in advance for any insight!
-- monique
attached mail follows:
> -----Original Message-----
> From: Jon Haworth [mailto:jhaworth
witanjardine.co.uk]
> Sent: 19 September 2002 18:18
>
> What are peoples' thoughts on "one should always return a value from a
> function, even if it's always going to be true"?
Unprintable!!
There's no point in returning a value if there's no sensible value to return.
Confusion can arise because PHP uses "function" for what, in some other languages, are distinguished into "functions" (which must return a value) and "subroutines" (which cannot). Anyone insisting that a function must return a result have probably been exposed only (or primarily) to such languages ;-Z !!
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford
lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
attached mail follows:
Please can somebody help my, why i get this errormessage:
Warning: getimagesize: Unable to open '../images/2002/11/jpg/' for reading. in C:\Webverzeichnis\docs\living_sports\living_sports\lsadmin\includes\image.handling.inc.php on line 852
While the echo $name says winter.jpg f.x.:
echo $name;
$size = getimagesize($path_to_dir.$images.$year.$month.$source.$name);
if ($size[0] > $size[1]) {
$faktor = ($size[1]/120);
$newWidth = ($size[0]/$faktor);
$command = 'convert -size 120x'.$newWidth.' '.$path_to_dir.$images.$year.$month.$source.$name.' -resize 120x'.$newWidth.' +profile "*" '.$path_to_dir.$images.$year.$month.$thumbs.$name;
system($command);
$Query = "UPDATE bild_db SET thumb = '".$year.$month.$thumbs.$name."' WHERE bild_db.name = '".$name."'";
mysql_query($Query,$connect) or die(mysql_error());
} else {
$faktor = ($size[0]/120);
$newHeight = ($size[1]/$faktor);
$command = 'convert -size '.$newHeight.'x120 '.$path_to_dir.$images.$year.$month.$source.$name.' -resize '.$newHeight.'x120 +profile "*" '.$path_to_dir.$images.$year.$month.$thumbs.$name;
system($command);
$Query = "UPDATE bild_db SET thumb = '".$year.$month.$thumbs.$name."' WHERE bild_db.name = '".$name."'";
mysql_query($Query,$connect) or die(mysql_error());
}
Please gimme a hint
Sascha
attached mail follows:
I'm running a program using popen(), and I need to know when there's data to
be read from this program. feof() will never return true, even with no data
to be read. Is there any function that can set a timeout on a file descriptor
returned by popen()? Or a function like feof(), but to check if there's data
to be read from a popen() file descriptor?
What I'm doing here is running Crafty (a chess engine), from my PHP script,
and I need to get input from the user on stdin and from Crafty.
Any help is appreciated!
Thanks!
attached mail follows:
I found out, that always when my script ist executed,
one $HTTP_REQUEST_FILE is empty.
so the scripts writes the pics where I want it and
tries to convert one none existing file.
But why?
Sascha
attached mail follows:
nicos
php.net <mailto:nicos
php.net> scribbled;
>
> Hi,
>
> Can someone point me to the documentation to make the same search
> system as php.net like www.php.net/lala that will search on the
> manual.
>
http://www.php.net/urlhowto.php
attached mail follows:
nicos
php.net <mailto:nicos
php.net> scribbled;
>
> I found it at http://www.php.net/urlhowto.php
>
> Thanks anyway.
>
Crap I just sent this to the list, I need a better email client that
sorts by thread and not just subject :/
attached mail follows:
You have session_start() on the second page, too, right??
> -----Original Message-----
> From: Erwin [mailto:erwin
isiz.com]
> Sent: Friday, September 20, 2002 5:45 AM
> To: php-general
lists.php.net
> Subject: [PHP] Sessions
>
> Hi all,
>
> I'm having a problem with sessions. I use PHP version 4.2.2.
> The project I'm working on, only uses the global variables, $_GET,
$_POST
> and $_SESSION.
>
> When I store something in the $_SESSION variable, everything goes
well. I
> can print the contents of this array with print_r, and every variable
I
> stored is there. But when I leave the page with the header(...)
directive
> (or any other way), the session is empty!
>
> The session file contains no data (so it is created!), the $_SESSION
> variable is empty...
>
> Some extra information:
> - I've tried this on PHP 4.1.2, and that works OK
> - I've tried output_buffering (on and off)
> - I've tried registered_globals (on and off)
> - I've tried using "session_write_close()" before leaving the page
> - I've checked the "session_start()" statement (Yes, it's there :-) )
>
> I hope someone can help me with this...
>
> Thanks in advance,
>
> Erwin
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
John Holmes wrote:
> You have session_start() on the second page, too, right??
>
Yes...the session_start() statement is in a global include file, which is
included in all files which require it
Grtz Erwin
>> -----Original Message-----
>> From: Erwin [mailto:erwin
isiz.com]
>> Sent: Friday, September 20, 2002 5:45 AM
>> To: php-general
lists.php.net
>> Subject: [PHP] Sessions
>>
>> Hi all,
>>
>> I'm having a problem with sessions. I use PHP version 4.2.2.
>> The project I'm working on, only uses the global variables, $_GET,
> $_POST
>> and $_SESSION.
>>
>> When I store something in the $_SESSION variable, everything goes
> well. I
>> can print the contents of this array with print_r, and every variable
> I
>> stored is there. But when I leave the page with the header(...)
> directive
>> (or any other way), the session is empty!
>>
>> The session file contains no data (so it is created!), the $_SESSION
>> variable is empty...
>>
>> Some extra information:
>> - I've tried this on PHP 4.1.2, and that works OK
>> - I've tried output_buffering (on and off)
>> - I've tried registered_globals (on and off)
>> - I've tried using "session_write_close()" before leaving the page
>> - I've checked the "session_start()" statement (Yes, it's there :-) )
>>
>> I hope someone can help me with this...
>>
>> Thanks in advance,
>>
>> Erwin
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I've had the same problem, and I resolved it by using html tags instead of
headers, and the problem was resolved. there are some issues I still
haven't been able to work out though (I want it to use cookies instead of
SID's).
"John Holmes" <holmes072000
charter.net> wrote in message
news:001b01c260a7$cc6744c0$b402a8c0
mango...
> You have session_start() on the second page, too, right??
>
> > -----Original Message-----
> > From: Erwin [mailto:erwin
isiz.com]
> > Sent: Friday, September 20, 2002 5:45 AM
> > To: php-general
lists.php.net
> > Subject: [PHP] Sessions
> >
> > Hi all,
> >
> > I'm having a problem with sessions. I use PHP version 4.2.2.
> > The project I'm working on, only uses the global variables, $_GET,
> $_POST
> > and $_SESSION.
> >
> > When I store something in the $_SESSION variable, everything goes
> well. I
> > can print the contents of this array with print_r, and every variable
> I
> > stored is there. But when I leave the page with the header(...)
> directive
> > (or any other way), the session is empty!
> >
> > The session file contains no data (so it is created!), the $_SESSION
> > variable is empty...
> >
> > Some extra information:
> > - I've tried this on PHP 4.1.2, and that works OK
> > - I've tried output_buffering (on and off)
> > - I've tried registered_globals (on and off)
> > - I've tried using "session_write_close()" before leaving the page
> > - I've checked the "session_start()" statement (Yes, it's there :-) )
> >
> > I hope someone can help me with this...
> >
> > Thanks in advance,
> >
> > Erwin
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
tim tom <mailto:timtom752002
yahoo.com> scribbled;
>
> Dear Marek,
> Where do find that? I am no C programmer.
>
> --
> tim
>
> --- Marek Kilimajer <kilimajer
webglobe.sk> wrote:
>> It's a shell script, and your shell drops root privileges. Use a
>> shell that doesn't or use a C-wraper.
>>
Make yourfile.c and put this in:
main(argc,argv)
int argc;
char **argv;
{
execv("/your/program/here", argv);
}
then cc -o yourfile yourfile.c
chown root.root yourfile
chmod 4755 yourfile
this will make it rwsr-xr-x
-jesse
attached mail follows:
!!!WARNING - WARNING - WARNING - WARNING - WARNING!!!
This will mean ANYONE can run this program AS ROOT. Read up on SUID.
!!!WARNING - WARNING - WARNING - WARNING - WARNING!!!
> Make yourfile.c and put this in:
>
> main(argc,argv)
> int argc;
> char **argv;
> {
> execv("/your/program/here", argv);
> }
>
>
> then cc -o yourfile yourfile.c
>
> chown root.root yourfile
> chmod 4755 yourfile
>
> this will make it rwsr-xr-x
-- Dan Hardiker [dhardikerstaff.firstcreative.net] ADAM Software & Systems Engineer First Creative Ltd
attached mail follows:
Michael Geier schrieb:
> PHP Source code is only available on the server, and will never be shown to > the client (unless you create a tool to allow them to see the source; > see show_source() ); > > And you can always put your authentication data (username/passwords) in an > external include() file > > auth.inc: > <? > $username = "foo"; > $password = "bar"; > ?> > > page.php: > <? > include ('[secure directory outside of web tree]/auth.inc'); > mysql_connect("dbname",$username,$password); > ?> > > of course, if you are on a shared-host web server (multiple clients on the > same server), you are only as secure as the weakest idiot that > configures/administrates the server, IMHO.
Won't the server ask for authorization if the included PHP script is in an directory accessible with .htaccess-Authorization? Oliver
attached mail follows:
Oliver,
I think I see your question. You are wanting to know if people can see *your* PHP code (it sounded like you were asking if you could read PHP's source code, which is why people responded like they did).
I think another poster mentioned this, but the safest thing to do with your database access information is to store it in a separate PHP script outside of document root. This ensures that there is no way to access it from a URL. Then, you can use include() from your script(s) that need to connect to the database to include the access credentials.
I think your question is whether you can see the source of a *.php file from a Web browser somehow, right? I'm not aware of any type of vulnerability that can allow this, once your Web server is setup to recognize these scripts as PHP.
A possible source of your concern is that many people mistakenly store included modules under document root, name them *.inc, and don't configure the Web server to deny requests for a resource with a .inc extension.
The best solution, even for this case, is to store your included modules outside of document root. This way you don't depend on access restrictions implemented in the Web server, nor do you have to worry about people executing your modules out of context (a danger, possibly greater danger, that exists when you simply name your modules *.php as a quick fix).
Hopefully that explains some of this a bit more.
Chris
>>>On Thu, 19 Sep 2002 16:50:16 +0200
>>>oliverwitt
t-online.de (Oliver Witt) wrote:
>>>
>>>>Hi,
>>>>Is there any way to read php source code? I didn't think
>>>>
>>so until I
>>
>>
>>>>heard about people you have done that...
>>>>Kind regards,
>>>>Oliver
>>>>
>>>If you mean php's source, download it ;)
>>>
>>>
>>Well, but if I write a script with MySQl, there has to be my user name
>>and password in the source code. If anybody could read it,
>>anybody could
>>have access to my databases!
>>Oliver
>>
attached mail follows:
There's a perfect example in the manual: http://www.php.net/manual/en/function.preg-replace.php
HTH Justin
on 20/09/02 9:16 PM, SiTA WebMaster - VST (webmaster
sita.com.tr) wrote:
> Try to remove all strings starting with "<" and ending with ">". Be sure > not to remove "<A href ... ></A>"'s. Also you need to format line > endings via "\n" or "<BR>". > > it might seem a little bit hard, but any other solution won't work > rather than this. > > Tim Haynes wrote: > >> Does anybody know of a class or a solution to converting an HTML page to a >> text only page via PHP, but leaving in href links in and a certain degree of >> formatting. >> >> Cheers, >> >> Tim >> >> >>
attached mail follows:
strip_tags() is the easiest way to remove HTML tags. If he wants to replace them, then he can use ereg_replace or preg_replace().
--Nicos - CHAILLAN Nicolas nicos
php.net www.WorldAKT.com - Hébergement de sites Internet
"Justin French" <justin
indent.com.au> a écrit dans le message de news: B9B16A0C.11653%justin
indent.com.au... > There's a perfect example in the manual: > http://www.php.net/manual/en/function.preg-replace.php > > HTH > Justin > > > on 20/09/02 9:16 PM, SiTA WebMaster - VST (webmaster
sita.com.tr) wrote: > > > Try to remove all strings starting with "<" and ending with ">". Be sure > > not to remove "<A href ... ></A>"'s. Also you need to format line > > endings via "\n" or "<BR>". > > > > it might seem a little bit hard, but any other solution won't work > > rather than this. > > > > Tim Haynes wrote: > > > >> Does anybody know of a class or a solution to converting an HTML page to a > >> text only page via PHP, but leaving in href links in and a certain degree of > >> formatting. > >> > >> Cheers, > >> > >> Tim > >> > >> > >> >
attached mail follows:
He is going to want to strip stuff *inbetween* <script> tags for example, not just strip the tags themselves...
<script> somefunction { ... } </script>
strip tags would result in
somefunction { ... }
what he really needs is to completely remove <script>...</script>, plus many many other examples.
completely removing everything outside the body would be another option, perhaps saving the contents of <title>...</title>
Justin French
on 21/09/02 12:27 AM, nicos
php.net (nicos
php.net) wrote:
> strip_tags() is the easiest way to remove HTML tags. If he wants to replace
> them, then he can use ereg_replace or preg_replace().
>
> --
>
> Nicos - CHAILLAN Nicolas
> nicos
php.net
> www.WorldAKT.com - Hébergement de sites Internet
>
> "Justin French" <justin
indent.com.au> a écrit dans le message de news:
> B9B16A0C.11653%justin
indent.com.au...
>> There's a perfect example in the manual:
>> http://www.php.net/manual/en/function.preg-replace.php
>>
>> HTH
>> Justin
>>
>>
>> on 20/09/02 9:16 PM, SiTA WebMaster - VST (webmaster
sita.com.tr) wrote:
>>
>>> Try to remove all strings starting with "<" and ending with ">". Be sure
>>> not to remove "<A href ... ></A>"'s. Also you need to format line
>>> endings via "\n" or "<BR>".
>>>
>>> it might seem a little bit hard, but any other solution won't work
>>> rather than this.
>>>
>>> Tim Haynes wrote:
>>>
>>>> Does anybody know of a class or a solution to converting an HTML page
> to a
>>>> text only page via PHP, but leaving in href links in and a certain
> degree of
>>>> formatting.
>>>>
>>>> Cheers,
>>>>
>>>> Tim
>>>>
>>>>
>>>>
>>
>
>
attached mail follows:
All,
I have a page that displays results of a database search. The page contains a select dropdown box from which the user can pick different options including the ability to download an Excel or CSV file of the displayed results. Once the user selects an option from the dropdown, a Javascript onchange method will kick in, submit the form and process the selected option. If the option is one of the file download choices, then using Javascript a new, child window will be opened and the location of the child will be the PHP download script with the file to download. The script in the child window will force the browser's download dialog box to open up at which point the user can save, open, or cancel the file download. The issue that I have is that some browsers (IE6) will automatically close the child window when the user has made a selection from the download dialog box while other browsers (Mozilla) will leave the child window remaining open. I need to either come up with a way to close the child window once the user has finsished with the download dialog or force the download script to not run in a child window. I've thought about applying a timer somewhere but this isn't reliable because of the unknowns of file download time and user response time to the download dialog. I don't have a preference as to whether the solution is all PHP based, all Javascript, or a mix of both -- I just need a solution to close this child window when complete.
Code is below. As usual, thanks in advance.
Dave Merritt
dave.merritt
arvinmeritor.com
Javascript code from the parent search results window opening the child window & calling the PHP download script:
... <SCRIPT type= "text/javascript" language="JavaScript"> <!-- DownloadWindow = window.open("../functions/download.php/?Filename=<?echo $Filename?>", "Download", "toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, copyhistory=0, width=200, height=200"); //--> </SCRIPT> ...
download.php:
if (isset($_GET['Filename'])) { if ( $_GET['Filename'] != '' ) { $Filename = $_GET['Filename']; header("Content-Disposition: inline; filename=" . basename($Filename)); header("Content-Type: application/octet-stream"); header("Content-Type: application/force-download"); header("Content-Type: application/download"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . filesize($Filename)); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); readfile("$Filename"); } } ************************************************************************************************** Any views, opinions or authorizations contained in this email are solely those of the author and do not necessarily represent those of ArvinMeritor, Inc. If you are not familiar with the corporate authority of the author, please obtain confirmation in writing of the content of this email prior to taking any action on the basis of the information. If you are not the intended recipient, you are hereby notified that any disclosure, copying or distribution of the information enclosed is strictly prohibited. **************************************************************************************************
attached mail follows:
I'm building a new server and would like to use: php4 apache 2.xxx mod_ssl MySQL mod_perl
Is there any major hurdle?
Thanks
Pierre B. Samson CAMBAR
attached mail follows:
Yeah, apache 2.0 and php don't like each other.
Adam
On Fri, 20 Sep 2002, pierre.samson wrote:
> I'm building a new server and would like to use: > php4 > apache 2.xxx > mod_ssl > MySQL > mod_perl > > Is there any major hurdle? > > Thanks > > Pierre B. Samson > CAMBAR > > > >
attached mail follows:
Any particular reason... future plans or is apache2 is not worthy?
"Adam Williams" <awilliam
mdah.state.ms.us> wrote in message
news:Pine.LNX.4.33L2.0209201007260.3854-100000
roark.mdah.state.ms.us...
> Yeah, apache 2.0 and php don't like each other.
>
> Adam
>
> On Fri, 20 Sep 2002, pierre.samson wrote:
>
> > I'm building a new server and would like to use:
> > php4
> > apache 2.xxx
> > mod_ssl
> > MySQL
> > mod_perl
> >
> > Is there any major hurdle?
> >
> > Thanks
> >
> > Pierre B. Samson
> > CAMBAR
> >
> >
> >
> >
>
attached mail follows:
The PHP coders are still working to have full compatability with apache 2.0. I know for example posting one variable in a form messes up, but posting 2 or more variables works fine. There is a entry n the bug database about this, so hopefully it will be fixed soon.
Adam
On Fri, 20 Sep 2002, pierre.samson wrote:
> Any particular reason... future plans or is apache2 is not worthy?
> "Adam Williams" <awilliam
mdah.state.ms.us> wrote in message
> news:Pine.LNX.4.33L2.0209201007260.3854-100000
roark.mdah.state.ms.us...
> > Yeah, apache 2.0 and php don't like each other.
> >
> > Adam
> >
> > On Fri, 20 Sep 2002, pierre.samson wrote:
> >
> > > I'm building a new server and would like to use:
> > > php4
> > > apache 2.xxx
> > > mod_ssl
> > > MySQL
> > > mod_perl
> > >
> > > Is there any major hurdle?
> > >
> > > Thanks
> > >
> > > Pierre B. Samson
> > > CAMBAR
> > >
> > >
> > >
> > >
> >
>
>
>
>
attached mail follows:
Apache 2 isn't officially supported yet. If you get the latest version of both then you shouldn't hit to many hurdles but you should know that you'll get no official support and it isn't recommended for production environments.
If you need Apache2 then you'll know why - if you don't know what the advantages are, you'll probably be better off with Apache 1.3.26 anyway.
Danny.
----- Original Message -----
From: "pierre.samson" <psamson
cambarsoft.com>
To: <php-general
lists.php.net>
Sent: Friday, September 20, 2002 4:00 PM
Subject: Re: [PHP] Why isn't there much info on apache2?
> Any particular reason... future plans or is apache2 is not worthy?
> "Adam Williams" <awilliam
mdah.state.ms.us> wrote in message
> news:Pine.LNX.4.33L2.0209201007260.3854-100000
roark.mdah.state.ms.us...
> > Yeah, apache 2.0 and php don't like each other.
> >
> > Adam
> >
> > On Fri, 20 Sep 2002, pierre.samson wrote:
> >
> > > I'm building a new server and would like to use:
> > > php4
> > > apache 2.xxx
> > > mod_ssl
> > > MySQL
> > > mod_perl
> > >
> > > Is there any major hurdle?
> > >
> > > Thanks
> > >
> > > Pierre B. Samson
> > > CAMBAR
> > >
> > >
> > >
> > >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
> "Adam Williams" <awilliam
mdah.state.ms.us> wrote in message
> news:Pine.LNX.4.33L2.0209201007260.3854-100000
roark.mdah.stat
> e.ms.us...
>> Yeah, apache 2.0 and php don't like each other.
>>
>> Adam
>>
>> On Fri, 20 Sep 2002, pierre.samson wrote:
>>
>>> I'm building a new server and would like to use:
>>> php4
>>> apache 2.xxx
>>> mod_ssl
>>> MySQL
>>> mod_perl
>>>
>>> Is there any major hurdle?
>>>
mod_ssl is also incompatible with apache 2.x according to www.modssl.org
Well, unless they hide the 2.x compatible version.
Plus mod_perl as far as I know has completely changed, so if you have old mod_perl scripts they gotta convert. Start here: http://perl.apache.org/docs/2.0/user/overview/overview.html
-jesse
attached mail follows:
Mod_ssl is part of the standard Apache2 distro now.
----- Original Message -----
From: "Jesse Cablek" <php
list.everchanging.org>
To: <php-general
lists.php.net>
Sent: Friday, September 20, 2002 4:22 PM
Subject: RE: [PHP] Why isn't there much info on apache2?
> "Adam Williams" <awilliam
mdah.state.ms.us> wrote in message
> news:Pine.LNX.4.33L2.0209201007260.3854-100000
roark.mdah.stat
> e.ms.us...
>> Yeah, apache 2.0 and php don't like each other.
>>
>> Adam
>>
>> On Fri, 20 Sep 2002, pierre.samson wrote:
>>
>>> I'm building a new server and would like to use:
>>> php4
>>> apache 2.xxx
>>> mod_ssl
>>> MySQL
>>> mod_perl
>>>
>>> Is there any major hurdle?
>>>
mod_ssl is also incompatible with apache 2.x according to www.modssl.org
Well, unless they hide the 2.x compatible version.
Plus mod_perl as far as I know has completely changed, so if you have old mod_perl scripts they gotta convert. Start here: http://perl.apache.org/docs/2.0/user/overview/overview.html
-jesse
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Danny Shepherd <mailto:danny
kyboshed.com> scribbled;
>
> Mod_ssl is part of the standard Apache2 distro now.
>
Ah, then it IS hidden ;)
-jesse
attached mail follows:
Well, I'm in no hurry, so I'll try to make it work. It just seemed to me that with ssl and mpm's incorporated it worth the upgrade.
I was not sure if there was a held back on the use of apache2...
Pierre
"Danny Shepherd" <danny
kyboshed.com> wrote in message
news:001201c260b9$7ebb8530$a201a8c0
DANNYS...
> Apache 2 isn't officially supported yet. If you get the latest version of
> both then you shouldn't hit to many hurdles but you should know that
you'll
> get no official support and it isn't recommended for production
> environments.
>
> If you need Apache2 then you'll know why - if you don't know what the
> advantages are, you'll probably be better off with Apache 1.3.26 anyway.
>
> Danny.
>
> ----- Original Message -----
> From: "pierre.samson" <psamson
cambarsoft.com>
> To: <php-general
lists.php.net>
> Sent: Friday, September 20, 2002 4:00 PM
> Subject: Re: [PHP] Why isn't there much info on apache2?
>
>
> > Any particular reason... future plans or is apache2 is not worthy?
> > "Adam Williams" <awilliam
mdah.state.ms.us> wrote in message
> > news:Pine.LNX.4.33L2.0209201007260.3854-100000
roark.mdah.state.ms.us...
> > > Yeah, apache 2.0 and php don't like each other.
> > >
> > > Adam
> > >
> > > On Fri, 20 Sep 2002, pierre.samson wrote:
> > >
> > > > I'm building a new server and would like to use:
> > > > php4
> > > > apache 2.xxx
> > > > mod_ssl
> > > > MySQL
> > > > mod_perl
> > > >
> > > > Is there any major hurdle?
> > > >
> > > > Thanks
> > > >
> > > > Pierre B. Samson
> > > > CAMBAR
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
attached mail follows:
At 11:35 AM 9/20/02 -0400, pierre.samson wrote: >Well, I'm in no hurry, so I'll try to make it work. >It just seemed to me that with ssl and mpm's incorporated it worth the >upgrade.
From today's Apache week newsletter:
"the Apache 2.0 interface is still undergoing steady change, "
Don't expect to see a stable PHP for Apache 2 until the interfaces stop changing with almost every version. There is great work being done on PHP for Apache 2, but it seems to need to be updated with every new version of Apache, and they are coming out fast and furious.
Rick
attached mail follows:
Howdy all!
I've built a page in Dreamweaver MX that uses PHP for scripting. I can get data out of my mysql database but I need to be able to search for wildcards. currently it only matches 100% exact queries. Below is the code that is at the beggining of the PHP page. ----------- $varSort_search1 = "%"; if (isset($HTTP_POST_VARS["Sort"])) { $varSort_search1 = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS["Sort"] : addslashes($HTTP_POST_VARS["Sort"]); } $varText_search1 = "%"; if (isset($HTTP_POST_VARS["Text"])) { $varText_search1 = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS["Text"] : addslashes($HTTP_POST_VARS["Text"]); } mysql_select_db($database_CATCH, $CATCH); $query_search1 = sprintf("SELECT * FROM secureworks WHERE %s LIKE '%s'", $varSort_search1,$varText_search1); $search1 = mysql_query($query_search1, $CATCH) or die(mysql_error()); $row_search1 = mysql_fetch_assoc($search1); $totalRows_search1 = mysql_num_rows($search1);
-------------
Does anyone have any ideas?
Thanks, John Cole, TCISA
attached mail follows:
wildcard in SQL is %, so your query looks like:
$query_search1 = "SELECT * FROM secureworks WHERE $varSort_search1 LIKE '%$varText_search1%'";
jcole
lgefcu.org wrote:
>Howdy all! > >I've built a page in Dreamweaver MX that uses PHP for scripting. I >can get >data out of my mysql database but I need to be able to search for >wildcards. >currently it only matches 100% exact queries. >Below is the code that is at the beggining of the PHP page. >----------- >$varSort_search1 = "%"; >if (isset($HTTP_POST_VARS["Sort"])) { > $varSort_search1 = (get_magic_quotes_gpc()) ? >$HTTP_POST_VARS["Sort"] : >addslashes($HTTP_POST_VARS["Sort"]); >} >$varText_search1 = "%"; >if (isset($HTTP_POST_VARS["Text"])) { > $varText_search1 = (get_magic_quotes_gpc()) ? >$HTTP_POST_VARS["Text"] : >addslashes($HTTP_POST_VARS["Text"]); >} >mysql_select_db($database_CATCH, $CATCH); >$query_search1 = sprintf("SELECT * FROM secureworks WHERE %s LIKE >'%s'", >$varSort_search1,$varText_search1); >$search1 = mysql_query($query_search1, $CATCH) or die(mysql_error()); >$row_search1 = mysql_fetch_assoc($search1); >$totalRows_search1 = mysql_num_rows($search1); > >------------- > >Does anyone have any ideas? > >Thanks, >John Cole, TCISA > > > >
attached mail follows:
> The admin users will need to run long processes that take about > 5-15 minutes each. They cannot timeout and they must be done throughout the day > while general users are working in the application as well. Is > there a big problem with this? What steps should I take to ensure > these long processes complete and do not timeout.
What about turning these long processes into perl scripts or C programs that can be exec()ed? They'll probably run faster, and they won't time out.
I've never done this myself. It's just a suggestion -- does it make sense to do it this way?
Beau
attached mail follows:
Beau Hartshorne wrote: > > > The admin users will need to run long processes that take about > > 5-15 minutes each. They cannot timeout and they must be done > throughout the day > > while general users are working in the application as well. Is > > there a big problem with this? What steps should I take to ensure > > these long processes complete and do not timeout. > > What about turning these long processes into perl scripts or C programs > that can be exec()ed? They'll probably run faster, and they won't time > out. > > I've never done this myself. It's just a suggestion -- does it make > sense to do it this way?
Best would be a PHP extension since it wouldn't need to be constantly reloaded :)
Cheers, Rob.
-- .-----------------. | Robert Cummings | :-----------------`----------------------------. | Webdeployer - Chief PHP and Java Programmer | :----------------------------------------------: | Mail : mailto:robert.cummingswebmotion.com | | Phone : (613) 731-4046 x.109 | :----------------------------------------------: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `----------------------------------------------'
attached mail follows:
I don't know if this is possible, but in VB (I'd like to find something similar in php) I would open a record set, and then filter / unfilter it for similar issues (in a loop). I'm assuming you could use a similar approach somehow in php.
"Robert Cummings" <robert.cummings
webmotion.com> wrote in message
news:3D8B3D41.CB2C1D66
webmotion.com...
> Beau Hartshorne wrote:
> >
> > > The admin users will need to run long processes that take about
> > > 5-15 minutes each. They cannot timeout and they must be done
> > throughout the day
> > > while general users are working in the application as well. Is
> > > there a big problem with this? What steps should I take to ensure
> > > these long processes complete and do not timeout.
> >
> > What about turning these long processes into perl scripts or C programs
> > that can be exec()ed? They'll probably run faster, and they won't time
> > out.
> >
> > I've never done this myself. It's just a suggestion -- does it make
> > sense to do it this way?
>
> Best would be a PHP extension since it wouldn't need to be constantly
reloaded :)
>
> Cheers,
> Rob.
> --
> .-----------------.
> | Robert Cummings |
> :-----------------`----------------------------.
> | Webdeployer - Chief PHP and Java Programmer |
> :----------------------------------------------:
> | Mail : mailto:robert.cummings
webmotion.com |
> | Phone : (613) 731-4046 x.109 |
> :----------------------------------------------:
> | Website : http://www.webmotion.com |
> | Fax : (613) 260-9545 |
> `----------------------------------------------'
attached mail follows:
Jeff Bluemel wrote: > > I don't know if this is possible, but in VB (I'd like to find something > similar in php) I would open a record set, and then filter / unfilter it for > similar issues (in a loop). I'm assuming you could use a similar approach > somehow in php.
Sounds like a DB issue. Select your entries from your DB then loop through the result set with the same filtering mechanism.
HTH, Rob.
-- .-----------------. | Robert Cummings | :-----------------`----------------------------. | Webdeployer - Chief PHP and Java Programmer | :----------------------------------------------: | Mail : mailto:robert.cummingswebmotion.com | | Phone : (613) 731-4046 x.109 | :----------------------------------------------: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `----------------------------------------------'
attached mail follows:
> I don't know if this is possible, but in VB (I'd like to find something > similar in php) I would open a record set, and then filter / unfilter it > for > similar issues (in a loop). I'm assuming you could use a similar approach > somehow in php.
Seems like a waste of resources. Why not do the filtering with the SQL query? Why are you selecting out more than you need?
---John Holmes...
attached mail follows:
Hi Fellas!
I'm a little bit confused as to why does this not work right! It had to do with the odbc_fetch_row() function. When there is two or more rows, the odbc_fetch_row() return a True. When there's no row, the odbc_fetch_row() return a False. What so odd about it is when there is one row, odbc_fetch_row() return a False. It should return a True. This doesn't make sense. Is this a bug? Have anyone encountered this problem?? What is the workaround to it?
Thanks!
--clip-- $cid = odbc_connect('blah blah'); $ask7 = "SELECT * FROM INQUIRIES"; $R7 = odbc_exec($cid,$ask7); $result = odbc_result($R7,1);
while (odbc_fetch_row($R7)) { odbc_fetch_into($R7,$inquiry,$inq_c); echo $inquiry[0], $inquiry[1]; } --cilp--
attached mail follows:
Found the workaround to the problem.
It had to be a PHP bug because odbc_fetch_row() should return true if there is 1 row, not false. I also file a PHP bug at bugs.php.net, the bug number is 19528.
Here's the workaround I made, I added "$bug_workaround" to the script.
--clip-- $cid = odbc_connect('blah blah blah'); $ask7 = "SELECT * FROM INQUIRIES WHERE USER_ID = '38SCK3'"; $R7 = odbc_exec($cid,$ask7); $result = odbc_result($R7,1);
echo "Result or No Result??? --> ".odbc_fetch_row($R7);
$bug_workaround=0;
//while (odbc_fetch_row($R7))
while (odbc_fetch_row($R7,++$bug_workaround))
{
odbc_fetch_into($R7,$inquiry,$inq_c);
echo $inquiry[0], $inquiry[1];
}
--clip--"Scott Fletcher" <scott
abcoa.com> wrote in message
news:20020920160040.75550.qmail
pb1.pair.com...
> Hi Fellas!
>
> I'm a little bit confused as to why does this not work right! It had to
do
> with the odbc_fetch_row() function. When there is two or more rows, the
> odbc_fetch_row() return a True. When there's no row, the odbc_fetch_row()
> return a False. What so odd about it is when there is one row,
> odbc_fetch_row() return a False. It should return a True. This doesn't
> make sense. Is this a bug? Have anyone encountered this problem?? What
is
> the workaround to it?
>
> Thanks!
>
> --clip--
> $cid = odbc_connect('blah blah');
> $ask7 = "SELECT * FROM INQUIRIES";
> $R7 = odbc_exec($cid,$ask7);
> $result = odbc_result($R7,1);
>
> while (odbc_fetch_row($R7))
> {
> odbc_fetch_into($R7,$inquiry,$inq_c);
> echo $inquiry[0], $inquiry[1];
> }
> --cilp--
>
>
attached mail follows:
Hello!
I'm fairly new to PHP and absolutely new to this mailing list.
I subscribed and I'm writing because I observed some strange behavior with array_merge_recursive(). I'm using PHP version 4.1.2. Please look at the following code:
$a = array('k' => array('a1')); $b = array('k' => array('b1')); $r = array_merge_recursive($a, $b); echo count($a['k']), '<br>'; echo count($b['k']), '<br>';
This will print 2 1
Apparently $a['k'] has been merged with $b['k'] and $a['k'] has been set to the resulting two-element array. I did not expect this behavior: I expected the function to make a new array, which contains both 'a1' and 'b1'. Only $r['k'] should refer to this new array.
Otherwise, in my opinion, array_merge_recursive should not return a value, just modify the first argument.
Should I file a bug report about this?
Thank you,
Michiel van Wessem
Network Administrator
attached mail follows:
Worked fine for me.. <?phpecho "<pre>";print_r($r);echo "</pre>";?>-----------Array ( [k] => Array ( [0] => a1 [1] => b1 )
) -----------Access the merged array with with $r['k']; with values at $r['k'][0] and $r['k'][1]. Is this not what you wanted? -Kevin
----- Original Message -----
From: "Michiel van Wessem" <jmvw
wwwcomm.com>
To: <php-general
lists.php.net>
Sent: Friday, September 20, 2002 10:14 AM
Subject: [PHP] array_merge_recursive
> Hello! > > I'm fairly new to PHP and absolutely new to this mailing list. > > I subscribed and I'm writing because I observed some strange behavior with > array_merge_recursive(). I'm using PHP version 4.1.2. Please look at the > following code: > > $a = array('k' => array('a1')); > $b = array('k' => array('b1')); > $r = array_merge_recursive($a, $b); > echo count($a['k']), '<br>'; > echo count($b['k']), '<br>'; > > This will print > 2 > 1 > > Apparently $a['k'] has been merged with $b['k'] and $a['k'] has been set to > the resulting two-element array. I did not expect this behavior: I expected > the function to make a new array, which contains both 'a1' and 'b1'. Only > $r['k'] should refer to this new array. > > Otherwise, in my opinion, array_merge_recursive should not return a value, > just modify the first argument. > > Should I file a bug report about this? > > Thank you, > > Michiel van Wessem > > > Network Administrator > >
----------------------------------------------------------------------------
----> -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hello Kevin,
Yes, and that's the good part. The bad part is that $a is affected (try print_r($a)). I don't think it should be.
Michiel
At 12:41 PM 9/20/2002, Kevin Stone wrote:
>Worked fine for me..
><?phpecho "<pre>";print_r($r);echo "</pre>";?>-----------Array
>(
> [k] => Array
> (
> [0] => a1
> [1] => b1
> )
>
>)
>-----------Access the merged array with with $r['k']; with values at
>$r['k'][0] and $r['k'][1]. Is this not what you wanted?
>-Kevin
>
>----- Original Message -----
>From: "Michiel van Wessem" <jmvw
wwwcomm.com>
>To: <php-general
lists.php.net>
>Sent: Friday, September 20, 2002 10:14 AM
>Subject: [PHP] array_merge_recursive
>
>
> > Hello!
> >
> > I'm fairly new to PHP and absolutely new to this mailing list.
> >
> > I subscribed and I'm writing because I observed some strange behavior with
> > array_merge_recursive(). I'm using PHP version 4.1.2. Please look at the
> > following code:
> >
> > $a = array('k' => array('a1'));
> > $b = array('k' => array('b1'));
> > $r = array_merge_recursive($a, $b);
> > echo count($a['k']), '<br>';
> > echo count($b['k']), '<br>';
> >
> > This will print
> > 2
> > 1
> >
> > Apparently $a['k'] has been merged with $b['k'] and $a['k'] has been set
>to
> > the resulting two-element array. I did not expect this behavior: I
>expected
> > the function to make a new array, which contains both 'a1' and 'b1'. Only
> > $r['k'] should refer to this new array.
> >
> > Otherwise, in my opinion, array_merge_recursive should not return a value,
> > just modify the first argument.
> >
> > Should I file a bug report about this?
> >
> > Thank you,
> >
> > Michiel van Wessem
> >
> >
> > Network Administrator
> >
> >
>
>
>----------------------------------------------------------------------------
>----
>
>
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.385 / Virus Database: 217 - Release Date: 9/4/2002
Network Administrator
attached mail follows:
Ahh I see what you mean. Yes that doesn't seem right does it. The function is passing the parameters by reference and affecting them as well as the return value. I don't have a solution for this apart from just being conscious of it and setting the unmodified arrays to new variables before using the function.. or rolling your own merger function. :-\ -Kevin
----- Original Message -----
From: "Michiel van Wessem" <jmvw
wwwcomm.com>
To: "Kevin Stone" <kevin
helpelf.com>; <php-general
lists.php.net>
Sent: Friday, September 20, 2002 10:52 AM
Subject: Re: [PHP] array_merge_recursive
> Hello Kevin,
>
> Yes, and that's the good part. The bad part is that $a is affected (try
> print_r($a)). I don't think it should be.
>
> Michiel
>
> At 12:41 PM 9/20/2002, Kevin Stone wrote:
>
> >Worked fine for me..
> ><?phpecho "<pre>";print_r($r);echo "</pre>";?>-----------Array
> >(
> > [k] => Array
> > (
> > [0] => a1
> > [1] => b1
> > )
> >
> >)
> >-----------Access the merged array with with $r['k']; with values at
> >$r['k'][0] and $r['k'][1]. Is this not what you wanted?
> >-Kevin
> >
> >----- Original Message -----
> >From: "Michiel van Wessem" <jmvw
wwwcomm.com>
> >To: <php-general
lists.php.net>
> >Sent: Friday, September 20, 2002 10:14 AM
> >Subject: [PHP] array_merge_recursive
> >
> >
> > > Hello!
> > >
> > > I'm fairly new to PHP and absolutely new to this mailing list.
> > >
> > > I subscribed and I'm writing because I observed some strange behavior
with
> > > array_merge_recursive(). I'm using PHP version 4.1.2. Please look at
the
> > > following code:
> > >
> > > $a = array('k' => array('a1'));
> > > $b = array('k' => array('b1'));
> > > $r = array_merge_recursive($a, $b);
> > > echo count($a['k']), '<br>';
> > > echo count($b['k']), '<br>';
> > >
> > > This will print
> > > 2
> > > 1
> > >
> > > Apparently $a['k'] has been merged with $b['k'] and $a['k'] has been
set
> >to
> > > the resulting two-element array. I did not expect this behavior: I
> >expected
> > > the function to make a new array, which contains both 'a1' and 'b1'.
Only
> > > $r['k'] should refer to this new array.
> > >
> > > Otherwise, in my opinion, array_merge_recursive should not return a
value,
> > > just modify the first argument.
> > >
> > > Should I file a bug report about this?
> > >
> > > Thank you,
> > >
> > > Michiel van Wessem
> > >
> > >
> > > Network Administrator
> > >
> > >
> >
> >
>
>---------------------------------------------------------------------------
-
> >----
> >
> >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> >
> >---
> >Incoming mail is certified Virus Free.
> >Checked by AVG anti-virus system (http://www.grisoft.com).
> >Version: 6.0.385 / Virus Database: 217 - Release Date: 9/4/2002
>
> Network Administrator
>
attached mail follows:
I'm working with the socket_* function (--enable-sockets) and have been seeing some wierd issues. I'm guessing it has to do with socket_recvfrom/sendto etc not being binary safe. This is 4.2.3 on FreeBSD 4.6.2.
My question is: what functions, specifically socket_* functions, are binary safe? How can I tell? When will they be?
And, while we're on the subject, in general, are PHP functions binary safe? Should I assume functions aren't binary safe unless noted otherwise - or should I assume the inverse?
If anyone could shed some light on this, I'd appreciate it.
Hans
__________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com
attached mail follows:
Don't assume either way, especially since sockets are currently experimental. If you're worried it isn't binary safe, you could base64_encode() and base64_decode everything... Extra bandwidth, but at least it will work.
On Friday 20 September 2002 10:10, Hans Zaunere wrote: > I'm working with the socket_* function (--enable-sockets) and have been > seeing some wierd issues. I'm guessing it has to do with > socket_recvfrom/sendto etc not being binary safe. This is 4.2.3 on > FreeBSD 4.6.2. > > My question is: what functions, specifically socket_* functions, are > binary safe? How can I tell? When will they be? > > And, while we're on the subject, in general, are PHP functions binary > safe? Should I assume functions aren't binary safe unless noted > otherwise - or should I assume the inverse? > > If anyone could shed some light on this, I'd appreciate it. > > Hans > > > > __________________________________________________ > Do you Yahoo!? > New DSL Internet Access from SBC & Yahoo! > http://sbc.yahoo.com
attached mail follows:
Hrmm...
Well the base64_* bit would work for the payload, but I'm working with raw sockets (ICMP at the moment) and of course the header needs to be really binary.
Are the socket_*() planned on being binary safe in the near future? Anyone do traceroute/ping in PHP yet?
Hans
--- Evan Nemerson <evan
coeus-group.com> wrote:
> Don't assume either way, especially since sockets are currently
> experimental.
> If you're worried it isn't binary safe, you could base64_encode() and
>
> base64_decode everything... Extra bandwidth, but at least it will
> work.
>
>
>
> On Friday 20 September 2002 10:10, Hans Zaunere wrote:
> > I'm working with the socket_* function (--enable-sockets) and have
> been
> > seeing some wierd issues. I'm guessing it has to do with
> > socket_recvfrom/sendto etc not being binary safe. This is 4.2.3 on
> > FreeBSD 4.6.2.
> >
> > My question is: what functions, specifically socket_* functions,
> are
> > binary safe? How can I tell? When will they be?
> >
> > And, while we're on the subject, in general, are PHP functions
> binary
> > safe? Should I assume functions aren't binary safe unless noted
> > otherwise - or should I assume the inverse?
> >
> > If anyone could shed some light on this, I'd appreciate it.
> >
> > Hans
> >
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > New DSL Internet Access from SBC & Yahoo!
> > http://sbc.yahoo.com
>
__________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com
attached mail follows:
Hi!
I got this problem getting my uploaded pictures listed in a table 3 by 3. The script below works fine and make a nice listing vetically...
Now, how the heck do I script so that I get 3 pictures in a row, in separat colums and adding a new row so next 3 pictures get the same formatting?
I looked into array_chunk() but I cant figure out how to use it? should i split $pic_out and use a foreach on that array? or just $nr=count($pic_out); and then run an if-statment to see if I get it out...well I hope u can give me some help cuz this is driving me mad
reg: cleaner
<TABLE ALIGN="left" BORDER=1 CELLSPACING=0 CELLPADDING=0 WIDTH="100"> <? $sql="SELECT namn,sokvag,id FROM data ORDER by 'id' DESC"; $query=mysql_query($sql)or die(mysql_error());
while($pic_out=mysql_fetch_array($query)){
$name=$pic_out['name']; $id=$pic_out['id']; $path=$pic_out['sokvag'];
$img_source=$path.$name;
?> <tr> <? echo "<TD> <IMG SRC='$img_source' height='100' BORDER='0'><TD>"; }//end While ?> </tr> </table>
attached mail follows:
can anyone tell me where my false conf. in php.ini ?
when i change the page it makes a new session ... instead of the first one ... cannot remember the first session data ... here is my infophp:
Session Support enabled
Directive Local Value Master Value session.auto_start Off Off session.cache_expire 180 180 session.cache_limiter nocache nocache session.cookie_domain no value no value session.cookie_lifetime -1 -1 session.cookie_path ./ ./ session.cookie_secure Off Off session.entropy_file no value no value session.entropy_length 0 0 session.gc_maxlifetime 1440 1440 session.gc_probability 1 1 session.name PHPSESSID PHPSESSID session.referer_check no value no value session.save_handler files files session.save_path c:/php/sessions c:/php/sessions session.serialize_handler php php session.use_cookies Off Off session.use_trans_sid 0 0
attached mail follows:
I had the problem a few days ago.
Here's some software that makes it easy as clicking a button -> http://www.convert-in.com/sql2acc.htm
Be warned though, it's only free to copy table structure. It requires registration to copy data.
"Christian Calloway" <dcminds
yahoo.com> wrote in message
news:20020920073910.18666.qmail
pb1.pair.com...
> Can anyone suggest a strategy for importing data from MySQL to Access (it
> sucks I know, but I have to do it for my work). I was thinking of using a
> text-delimited file as an intermediate, but I am not quite sure on the
> logistics.
>
>
attached mail follows:
Thanks.
That's fine, it's either $55 for this or a couple of hundred to pay someone to do it manually.
Go figure ;-)
Cheers, Liam
----- Original Message -----
From: "M1tch" <m1tch101
hotmail.com>
To: <php-general
lists.php.net>
Sent: Saturday, September 21, 2002 3:51 AM
Subject: [PHP] Re: MySQL > Access
I had the problem a few days ago.
Here's some software that makes it easy as clicking a button -> http://www.convert-in.com/sql2acc.htm
Be warned though, it's only free to copy table structure. It requires registration to copy data.
"Christian Calloway" <dcminds
yahoo.com> wrote in message
news:20020920073910.18666.qmail
pb1.pair.com...
> Can anyone suggest a strategy for importing data from MySQL to Access (it
> sucks I know, but I have to do it for my work). I was thinking of using a
> text-delimited file as an intermediate, but I am not quite sure on the
> logistics.
>
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi everyone,
I'm using php 4.2.3 and putting the code that prevents caching. But this works in php4.1 but in 4.2.3 doesn't. I don't know if this is because I must change some directive in php.ini or if is someone that we can't change in php 4.2.3.
Thanks in advance
Rapha
attached mail follows:
I am posting this message to the php.general newsgroup because I used php to construct the dynamic portion of our site and because I value the opinions of many people who frequently post here. I hope that this will not be viewed as off-topic --if it is, I will take it elsewhere.
At affero we are beginning to think in terms of publishing certain data to whomsoever might wish to use it for whatever reason. Here's a first cut attempt to provide such a service:
http://pws.affero.net/hof/topPatrons
returns an HTML <table> ... </table> structure suitable for use as, say, a server side include.
Another kind of data which we might publish is what we refer to as a 'dense reputation' or a 'reputation summary'. For an example of a dense reputation you can point a browser at this URL
http://svcs.affero.net/user-history.php?u=Poole
the dense reputation appears highlighted after the user id on the top line of the page.
One of the things that concerns me lately is how to make data such as these available as widely as possible.
I have looked in to RSS for a few days and, while I am somewhat confused, I have begun to come more or less to the conclusion that RSS is employed mainly for syndicated news feeds and probably is not appropriate for publishing tabular data and short strings.
Maybe some kind of procedure call mechanism, eh? SOAP and XML-RPC seem to be competing technologies, though. If we support one of them, how many sites will be excluded from accessing the data which we wish to make available? Should we support both?
XML seems attractive because it can be styled into so many different kind of presentations, but I just can't tell if this would be appropriate.
I was wondering if anyone might be able to share thoughts or opinions or experience related to such issues.
-lee
--
attached mail follows:
Each evening I distribute a newsletter to approx 500 subscribers, and I want to stamp each copy I send with the name, email address and subscriber number of the recipient. I've not done any programmatic PDF manipulation, but could this be done using PDFlib? I receive the newsletter as a PDF from the publisher, it's not generated on my system. I envision it running as follows:
Have fetched all this information from the database, while processing the result set .. Open a copy of todays_news.pdf Write the desired information to a certain block/watermark Save it
Create the mail message & attach PDF Send it
Delete the copy Repeat
Regards - Miles Thompson
attached mail follows:
I'm having problems with headers being sent out that cause generated images to become garbled, Does anypone have any ideas on how to stop certain headers, such as Connection, Keep-Alive and Transfer-Encoding from going out to the browser, or filtering them out of the output?
Im running apache 1.3.26 on red hat with mod_headers installed and i have already set it to unset all of the headers in httpd.conf but that didn;t get rid of them, so I think php is causing the problem.
Any Ideas/Tips/help on changing my config of php or filtering out headers would be appreciated
attached mail follows:
Hello,
I am wondering how it would be possible to generate an html response email via a PHP script. I have tried and all that has happened is the html source code appears in the message body as plain text. I believe this is happening because the email needs an additional header stating the email needs to be parsed as html not plain text (or both).
I am using the mail command.
Can someone shed some light on the subject for me???
Thanks so much in advance! Mike Dunlop
attached mail follows:
Mike Dunlop <mailto:webmaster
awn.com> scribbled;
>
> Hello,
>
> I am wondering how it would be possible to generate an html response
> email via a PHP script. I have tried and all that has happened is the
> html source code appears in the message body as plain text. I believe
> this is happening because the email needs an additional header
> stating the email needs to be parsed as html not plain text (or both).
>
You can try sending Content-Type: text/html\r\n to see if that helps, otehrwise the mail client may be set for text-only.
-jesse
attached mail follows:
Try this class: http://phpclasses.websapp.com/browse.html/package/9.html
Regards, Daniel Kushner _________________________________________ Need hosting? http://thehostingcompany.us
> -----Original Message-----
> From: Mike Dunlop [mailto:webmaster
awn.com]
> Sent: Friday, September 20, 2002 4:46 PM
> To: php-general
lists.php.net
> Subject: [PHP] Dynamic HTML Email
>
>
> Hello,
>
> I am wondering how it would be possible to generate an html response
> email via a PHP script. I have tried and all that has happened is the
> html source code appears in the message body as plain text. I believe
> this is happening because the email needs an additional header
> stating the email needs to be parsed as html not plain text (or both).
>
> I am using the mail command.
>
> Can someone shed some light on the subject for me???
>
> Thanks so much in advance!
> Mike Dunlop
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
$header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: text/html; charset=iso-8859-1\r\n"; $header .= "From: $sender_email\r\n";
mail("$rcpt_email", "$subject", "$msg", $header);
This works it is what I use.
-----Original Message-----
From: Mike Dunlop [mailto:webmaster
awn.com]
Sent: Friday, September 20, 2002 2:46 PM
To: php-general
lists.php.net
Subject: [PHP] Dynamic HTML Email
Hello,
I am wondering how it would be possible to generate an html response email via a PHP script. I have tried and all that has happened is the html source code appears in the message body as plain text. I believe this is happening because the email needs an additional header stating the email needs to be parsed as html not plain text (or both).
I am using the mail command.
Can someone shed some light on the subject for me???
Thanks so much in advance! Mike Dunlop
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hello, I am trying to find a string in another string with mysql. Normally, this would work.
select 'foo' REGEXP ('foo');
And that would simply return 1, since it found it. But, my strings are more complicated than that. One good random example is something like this..Ya i know, its wierd but go with me on this.
ok/2.0 (hah 3.0; BAM oh 5.1; .hi CLR 1.0.4725)
so you would do a select like..
select 'ok/2.0 (hah 3.0; BAM oh 5.1; .hi CLR 1.0.4725)' REGEXP ('ok/2.0 (hah 3.0; BAM oh 5.1; .hi CLR 1.0.4725)');
That of course doesnt work. All of the () 's, and /'s, and .'s, mess it all up. And suggestion on what to do? any function to convert all of the special regexp characters ()[];.^*$ etc to work correctly?
Thank You, Taylor York
attached mail follows:
Not that familiar with MySQL's flavor of RegEx (and the documentation seems to be extremely bad ... or at least I can't seem to find any with casually searching) but have you tried escaping the RegEx special characters? eg
REGEXP ('ok\/2.0 \(hah 3\.0; BAM oh 5\.1; \.hi CLR 1\.0\.4725\)');
-Peter
> -----Original Message-----
> From: Taylor York [mailto:taylor
dreamstargroup.com]
> Sent: Saturday, September 21, 2002 00:17
> To: php-general
lists.php.net
> Subject: [PHP] Reg Exp issue
>
>
> Hello, I am trying to find a string in another string with
> mysql. Normally,
> this would work.
>
> select 'foo' REGEXP ('foo');
>
> And that would simply return 1, since it found it. But, my
> strings are more
> complicated than that.
> One good random example is something like this..Ya i know,
> its wierd but go
> with me on this.
>
> ok/2.0 (hah 3.0; BAM oh 5.1; .hi CLR 1.0.4725)
>
> so you would do a select like..
>
> select 'ok/2.0 (hah 3.0; BAM oh 5.1; .hi CLR 1.0.4725)'
> REGEXP ('ok/2.0 (hah
> 3.0; BAM oh 5.1; .hi CLR 1.0.4725)');
>
> That of course doesnt work. All of the () 's, and /'s, and
> .'s, mess it all
> up. And suggestion on what to do? any function to convert all of the
> special regexp characters ()[];.^*$ etc to work correctly?
>
> Thank You,
> Taylor York
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Even though I have no record in my MySQL DB with that has "005" in the ID field, the following statement always reverts to Record Found, or True, no matter what ID I use. What's wrong? I'm using PHP 4.2.2. Has something changed that makes this work differently? Thanks.
--------
$query = "SELECT id FROM member WHERE id = 005"; $connect = mysql_pconnect("localhost", "dbname", "password"); $result = mysql_query( $query, $connect ); // Query DB. if ( !empty($result) ) { echo "RECORD FOUND"; } else { echo "RECORD NOT FOUND"; }
attached mail follows:
Could be wrong, but the fact that $result isn't empty doesn't mean there are rows... it would be better to say:
if ( !empty($result) ) { echo "VALID QUERY"; } else { echo "INVALID QUERY"; }
Although you should probably check $result against TRUE and FALSE instead.
If you want to know how many rows have been returned use mysql_num_rows() (or something very close to that).
good luck!
On Fri, 20 Sep 2002, Monty wrote:
> Even though I have no record in my MySQL DB with that has "005" in the ID > field, the following statement always reverts to Record Found, or True, no > matter what ID I use. What's wrong? I'm using PHP 4.2.2. Has something > changed that makes this work differently? Thanks. > > -------- > > $query = "SELECT id FROM member WHERE id = 005"; > $connect = mysql_pconnect("localhost", "dbname", "password"); > $result = mysql_query( $query, $connect ); // Query DB. > > if ( !empty($result) ) { > echo "RECORD FOUND"; > } else { > echo "RECORD NOT FOUND"; > } > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
you should use mysql_num_rows() to check for records returned instead of using mysql_query().
this is because if $query is a valid $sql statement, mysql_query() will always return a resource link. which evaluates to true.
so this will work for you:
if (mysql_num_rows($result)) echo "record found"; else echo "record not found";
--lance
Monty wrote: > Even though I have no record in my MySQL DB with that has "005" in the ID > field, the following statement always reverts to Record Found, or True, no > matter what ID I use. What's wrong? I'm using PHP 4.2.2. Has something > changed that makes this work differently? Thanks. > > -------- > > $query = "SELECT id FROM member WHERE id = 005"; > $connect = mysql_pconnect("localhost", "dbname", "password"); > $result = mysql_query( $query, $connect ); // Query DB. > > if ( !empty($result) ) { > echo "RECORD FOUND"; > } else { > echo "RECORD NOT FOUND"; > } > >
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]