php-general Digest 6 Feb 2002 08:35:33 -0000 Issue 1155
Topics (messages 83631 through 83684):
Duplicate e-mails
83631 by: Anthony Rodriguez
83633 by: Analysis and Solutions
Books on PHP
83632 by: Ronald D Wahlen
83634 by: Kevin Stone
83641 by: LaserJetter
83646 by: Manuel Lemos
Re: whic OS is under?
83635 by: LaserJetter
83638 by: Lars Torben Wilson
File Upload -- File Trailer Partial
83636 by: Richard Lynch
83640 by: Michael Kimsal
POST to SSL Server without CURL?
83637 by: Gabriel Richards
Curl Support Not Compiling
83639 by: Gabriel Richards
Re: 72dpi with gdlibrary2?
83642 by: Andrew Chase
Re: Changes in Sessions (PHP Versions)
83643 by: Yasuo Ohgaki
mktime() problem
83644 by: toni baker
How do I display variables in text boxes when the value of a drop down menu changes?
83645 by: Don
83648 by: Martin Towell
date(), time() different to system time
83647 by: Anth Courtney
83655 by: DL Neil
83662 by: Anth Courtney
MySQL selecting the maximum value from a column
83649 by: Melanie Gann
83650 by: Martin Towell
83652 by: Lars Torben Wilson
Re: Can anyone jog my memory on HTTP_REFERER & Javascript " location:replace"?
83651 by: Lazor, Ed
How do I keep form inputs from being cleared - Please Help!
83653 by: SpamSucks86
83656 by: Miles Thompson
Re: Problem...header already sent by
83654 by: Ryan F. Bayhonan
safe mode/mkdir problem - HELP!
83657 by: Roberto P.Martins Jr
Dynamic Dropdown menu question.
83658 by: Michael O'Neal
83659 by: Lars Torben Wilson
83660 by: Jeff Sheltren
83661 by: bvr
83665 by: jtjohnston
RePOST: Sessions and Classes
83663 by: PHP-List
<< Previous n Articles
83664 by: jtjohnston
83669 by: Jason Wong
83670 by: jtjohnston
83671 by: Jason Wong
autoindex
83666 by: jtjohnston
modDb Contribution
83667 by: Vincent - D. Ertner
Convert 24hr to 12hr
83668 by: Gary
83672 by: Lars Torben Wilson
Checkboxe problem
83673 by: Gaylen Fraley
83675 by: Niklas Lampén
83679 by: Mike Maltese
Re: breaking out of two loops
83674 by: Lars Torben Wilson
Using strings in switches
83676 by: phantom
83677 by: Justin Garrett
Re: why !^ in email?
83678 by: nina
Mysql
83680 by: Roman Duriancik
Sessions and Classes
83681 by: PHP-List
83684 by: Wolfram Kriesing
Re: mysql fails
83682 by: val petruchek
show something
83683 by: val petruchek
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 ---
The following php script sends two (2) e-mails to each addressee. Why?
<?php
$connection=mysql_connect("localhost","wagner","XXX") or die ("No
connection!");
$db=mysql_select_db("sbwresearch",$connection) or die ("No database!");
$message=" Dear consumer,\n
The following are the online surveys ... etc.\n";
$qry_1="select * from con_inf";
$result_1=mysql_query($qry_1,$connection) or die ("No query # 1!");
while ($row_1=mysql_fetch_array($result_1, MYSQL_ASSOC))
{
$e_mail=$row_1["e_mail"];
mail("$e_mail",
"News from SBW Research",
"$message",
"From:SBW Research <[EMAIL PROTECTED]>\n");
};
mysql_free_result($result_1);
mysql_close($connection);
header ("location:done.htm");
exit;
?>
Anthony Rodriguez
([EMAIL PROTECTED])
--- End Message ---
--- Begin Message ---
Hi Anthony:
Anthony Rodriguez wrote:
>
> The following php script sends two (2) e-mails to each addressee. Why?
I'll bet the email addresses in question are listed in the table twice. Open
up a MySQL command line prompt and enter "select * from con_inf;" to make
sure. To keep this from happening, you can delete the duplicates then add a
unique index on the "e_mail" field in the MySQL table definition.
> $qry_1="select * from con_inf";
Side Issue 1: why are you selecting everything (via "*") rather than just
"e_mail", since that's all you're using in the script?
> $result_1=mysql_query($qry_1,$connection) or die ("No query # 1!");
>
> while ($row_1=mysql_fetch_array($result_1, MYSQL_ASSOC))
>
> {
> $e_mail=$row_1["e_mail"];
> mail("$e_mail",
Side Note 2: You can combiune those two lines into one:
mail($row_1['e_mail'],
> mysql_free_result($result_1);
> mysql_close($connection);
Side Note 3: You don't worry about these commands in scripts you're about to
exit anyway.
Enjoy,
--Dan
--
PHP scripts that make your job easier
http://www.analysisandsolutions.com/code/
SQL Solution | Layout Solution | Form Solution
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Ave, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409
--- End Message ---
--- Begin Message ---
Hello,
I am new to PHP and was wondering if anyone can point me the right direction
with
PHP urls and books to learn how to develop web sites using PHP. I read some
of the information on www.php.net web site and have the PHP Bible.
Thanks,
Ron
--- End Message ---
--- Begin Message ---
I got started with a book called, "PHP and MySQL Web Development" by
Luke Welling and Laura Thomson, published by SAMS. This book is
clearly written with the "self-taught" programmer in mind, tearing apart
numerous real-world examples and explaining relevant concepts in depth.
It does not go into theory or advanced topics making it a terrible book
for the experienced programmer. It is also not a good function
reference. But far as reference goes, I say forget the books. Nothing
can beat the function search at www.php.net.
--
Kevin Stone
[EMAIL PROTECTED]
www.helpelf.com
> -----Original Message-----
> From: Ronald D Wahlen [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 05, 2002 2:07 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Books on PHP
>
> Hello,
>
> I am new to PHP and was wondering if anyone can point me the right
> direction
> with
> PHP urls and books to learn how to develop web sites using PHP. I read
> some
> of the information on www.php.net web site and have the PHP Bible.
>
> Thanks,
> Ron
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I'll second that comment on the documentation with PHP.
I bought the Definitive HTML Reference a few years back as an HTML reference
because there was no single place where you could get a high quality
refernce for all the HTML, CSS and JavaScript commands.
The online documentation is pretty good, but I feel nothing can beat the
Windows HTML-Help version: Its speedy, has an excellent search and it saves
connecting to the net just to look something up.
LJ
"Kevin Stone" <[EMAIL PROTECTED]> wrote in message
000001c1ae8d$8d8b8f80$6401a8c0@kevin">news:000001c1ae8d$8d8b8f80$6401a8c0@kevin...
> I got started with a book called, "PHP and MySQL Web Development" by
> Luke Welling and Laura Thomson, published by SAMS. This book is
> clearly written with the "self-taught" programmer in mind, tearing apart
> numerous real-world examples and explaining relevant concepts in depth.
> It does not go into theory or advanced topics making it a terrible book
> for the experienced programmer. It is also not a good function
> reference. But far as reference goes, I say forget the books. Nothing
> can beat the function search at www.php.net.
>
> --
> Kevin Stone
> [EMAIL PROTECTED]
> www.helpelf.com
>
> > -----Original Message-----
> > From: Ronald D Wahlen [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 05, 2002 2:07 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Books on PHP
> >
> > Hello,
> >
> > I am new to PHP and was wondering if anyone can point me the right
> > direction
> > with
> > PHP urls and books to learn how to develop web sites using PHP. I read
> > some
> > of the information on www.php.net web site and have the PHP Bible.
> >
> > Thanks,
> > Ron
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--- End Message ---
--- Begin Message ---
Hello,
Ronald D Wahlen wrote:
>
> Hello,
>
> I am new to PHP and was wondering if anyone can point me the right direction
> with
> PHP urls and books to learn how to develop web sites using PHP. I read some
> of the information on www.php.net web site and have the PHP Bible.
Look here for a long list of books with some reviewed.
http://phpclasses.UpperDesign.com/products.html
Regards,
Manuel Lemos
--- End Message ---
--- Begin Message ---
There is something. Its one of the enironment vars I think. Look for UNAME
or U something.
I'm not sure if this gives the current OS or the OS on which PHP was
compiled though.
"Ivo Stoykov" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi group:
>
> Is there a way to guess which OS the script is running? I couldn't find
> anything in the manual about this.
>
> Thank you
>
> Ivo
>
>
--- End Message ---
--- Begin Message ---
On Mon, 2002-02-04 at 05:45, Ivo Stoykov wrote:
> Hi group:
>
> Is there a way to guess which OS the script is running? I couldn't find
> anything in the manual about this.
>
> Thank you
>
> Ivo
The constant PHP_OS will tell you. For a list of all currently
defined constants, try http://www.php.net/get_defined_constants.
Hope this helps,
Torben
--
Torben Wilson <[EMAIL PROTECTED]>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506
--- End Message ---
--- Begin Message ---
Please Cc: me -- I can't keep up with anything like the full volume
of PHP-General any more and have only lurked for quite some time :-(
I'm consistently seeing file uploads get only the trailing N bytes of
the file if the file is over a certain size.
This is on applications that worked flawlessly under previous
versions on the "old" ISP, but I had to start using
http://php.net/move_uploaded_file and working around/through safe
mode on the new ISP.
The limit does *NOT* seem to be a constant, but perhaps the ISP's
attempt to alter the File Upload Limit has affected this over time...
I guess I'm seeking reassurance that:
A) File upload not known to be broken
B) move_uploaded_file completely finishes and CLOSES a file before returning
The variance in the amount of data succesfully acquired "feels" like
move_uploaded_file is leaving the file open, and then I fopen() it,
and get the latter half of the file due to file-pointer cross-wiring
or something.
Here is the top bit of phpinfo():
PHP Version 4.2.0-dev
System OpenBSD o2 2.9 conf#0 i386
Build Date Jan 29 2002 15:56:06
Configure Command './configure'
'--with-apache=../apache_1.3.22'
'--with-config-file-path=/var/www/conf' '--enable-trans-sid'
'--enable-ftp' '--enable-sockets' '--with-openssl' '--with-gd'
'--with-jpeg-dir=/usr/local/lib' '--with-png-dir=/usr/local/lib'
'--with-tiff-dir=/usr/local/lib' '--with-zlib-dir=/usr/include'
'--with-mysql' '--with-pdflib' '--with-mcrypt'
'--with-pgsql=/usr/local'
Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /var/www/conf/php.ini
ZEND_DEBUG disabled
Thread Safety disabled
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.2.0, Copyright (c) 1998-2002 Zend Technologies
--
Got Music? http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Richard Lynch wrote:
> Please Cc: me -- I can't keep up with anything like the full volume of
> PHP-General any more and have only lurked for quite some time :-(
<snip>
> I guess I'm seeking reassurance that:
>
> A) File upload not known to be broken
> B) move_uploaded_file completely finishes and CLOSES a file before
> returning
>
> Here is the top bit of phpinfo():
> PHP Version 4.2.0-dev
>
Perhaps it's because it's a 'dev' version? Did you see this in 4.1? Or
below?
--- End Message ---
--- Begin Message ---
Thank you for your very helpful guidance to this point!
My host doesn't have the CURL module installed and it is unlikely they will
do it (PHP running on NT).
Apparently I can't just fsockopen("www.ups.com", 443); ???
Is there another way?
Gabe
--- End Message ---
--- Begin Message ---
I'm trying to get PHP to compile with CURL support (on my Linux server), but
it's not working and I'm not getting an error message.
I've installed curl correctly I think. /usr/local/include/curl contains
curl.h easy.h and other header files. /usr/local/lib has libcurl.a.
I said ./configure --with-curl=/usr/local (also tried /usr/local/lib and
/usr/local/include)
No errors for ./configure, no errors for make or make install. But I get
"call to undefined function curl_init()"
Help is appreciated!
Gabe
--- End Message ---
--- Begin Message ---
IANAGE (I Am Not A GD Expert), but as far as I know the GD functions dealing
with image size don't concern themselves with the resolution of an image in
terms of dots per inch, just with the number of pixels.
Since most uses of the GD library functions in PHP will have to do with
creating/manipulating images to send to the browser, it should be safe to
assume that any image created with PHP will be 72 DPI.
If you're talking about resizing a much larger image (for instance, a 3.5
inch by 5 inch JPEG created at 300 DPI), you just need to do some math to
figure out how much to shrink it.
If your source resolution is 300 DPI and your target resolution is 72 DPI,
you need to multiply the number of pixels in the width and height of the 300
DPI original by a factor of 72/300, which equals .24.
Or to put it another way:
5 inches at 300 DPI = 1500 pixels.
5 inches at 72 DPI = 360 pixels.
1500 pixels * .24 = 360 pixels.
I hope that wasn't utterly confusing, but IANAMT (I Am Not A Math Teacher),
either. :P
You'll probably want to take a look at the imagecopyresized and
imagecopyresampled functions:
http://www.php.net/manual/en/function.imagecopyresized.php
http://www.php.net/manual/en/function.imagecopyresampled.php
(Imagecopyresampled produces much nicer results, but it's only available in
4.06 and later.)
-Andy
> -----Original Message-----
> From: Andy [mailto:[EMAIL PROTECTED]]
>
> I would like to create images with 72 dpi with gdlibrary2.01
>
> Is this possible?
--- End Message ---
--- Begin Message ---
Trun off "register_globals", then it should work with track vars.
--
Yasuo Ohgaki
Travis Simpson wrote:
> Hey,
>
> I changed it from:
>
> $HTTP_SESSION_VARS["$key"] = $value;
>
> To:
>
> session_register("$key");
> $key = $value;
>
> And now it works fine.
>
> At first, when I wrote the $key = $value... It made no sense... I was
> just doing it because I didn't know what else to try. And it actually
> works ;) I figured it would set the variable $key to the value of
> $value. But it didn't. It created a new variable. Naming it the value of
> $key. And giving that new variable the value of $value.
>
> Does this confuse anybody else?? ;)
>
> Thanks for all your help,
> -Travis
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
How can I make sure the user enters a date in format
mm/dd/yyyy and the date must be between the year 1600
and 2038.
The script below meets the criterion above, except
mktime() or strtotime() does not validate year 1600
dates. Any suggestions? Thanks
$dateparts = explode('/', $Date);
$month = $dateparts[0];
$day = $dateparts[1];
$year = $dateparts[2];
$date1 = date ("m/d/Y", mktime
(0,0,0,$month,$day,$year));
if (!$Date) {
$submit = 0;
$Date = "<B>Date Required</B>";
}
elseif (!checkdate($month,$day,$year)) {
$submit = 0;
$Date = "<B>Invalid Date</B>";
}
elseif ($Date != $date1) {
$submit = 0;
$Date = "<B>Invalid Date</B>";
}
elseif ($year < 1600 || $year > 2030) {
$submit = 0;
$Date = "<B>Invalid Date</B>";
}
__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
--- End Message ---
--- Begin Message ---
Hi,
I have a PHP script that displays a form. On one section of the form, there is a drop
down menu followed by a few text boxes. I'd like to alter the values of the text
boxes when the user changes the selection in the dropdown menu.
What I've done is create 10 arrays (the drop down menu has 10 items hence one array
per item). Each time the user changes the selection in the drop down menu, I figure
I'd:
a) save the current variables to the array corfresponding to the old selection
b) fill the text boxes with vales of the array corresponding to the new selection
Is this possible using PHP? I figure that since PHP is server side, I will have to
use JavaScript to provide some of the functionality I require but how do I set and
access PHP variables from JavaScript?
If the above is not workable, Is there another way I can accomplish this?
Thanks in advance,
Don
--- End Message ---
--- Begin Message ---
to "access" php var in javascript, you'll need to set up javascript vars
with the values of the php vars you want to use.
eg.
<?
$foobar = "testing";
?>
<script>
alert(foobar); // will display nothing - not set yet
foobar = "<?= $foobar; ?>";
alert(foobar); // now will display "testing"
</script>
remember, to get the vars back to php, you'll need to make a request to the
server using one of serveral methods
hope that helps
Martin
-----Original Message-----
From: Don [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 06, 2002 9:00 AM
To: php list
Subject: [PHP] How do I display variables in text boxes when the value
of a drop down menu changes?
Hi,
I have a PHP script that displays a form. On one section of the form, there
is a drop down menu followed by a few text boxes. I'd like to alter the
values of the text boxes when the user changes the selection in the dropdown
menu.
What I've done is create 10 arrays (the drop down menu has 10 items hence
one array per item). Each time the user changes the selection in the drop
down menu, I figure I'd:
a) save the current variables to the array corfresponding to the old
selection
b) fill the text boxes with vales of the array corresponding to the new
selection
Is this possible using PHP? I figure that since PHP is server side, I will
have to use JavaScript to provide some of the functionality I require but
how do I set and access PHP variables from JavaScript?
If the above is not workable, Is there another way I can accomplish this?
Thanks in advance,
Don
--- End Message ---
--- Begin Message ---
Hey guys,
I'm running a RH7.2 box with apache 1.3.20 installed and php-4.1.1
installed as a DSO.
Everything is working fine, except that the output from any date() or
time() references is 16 hours behind the system time (and hwtime) on the
machine.
The machine gets its time from an ntp server which is correct; this setup
is similar for other boxes on the network which have no problems with the
date or time in php being correct.
If I output date('T') then the correct timezone (EST...I'm in Aus) is
displayed, but any time or dates are 16 hours behind.
Where does php read the time/date values from? Is there something I can
tweak or something that I should look at to correct this? I know I could
kludge around it in users php code by tacking an extra 16 hours onto each
value but obviously that's not a good solution for a box which will be
used by others!
Any thoughts / headsup would be appreciated.
cheers,
Anth
------------------------------------------------------
Anth Courtney - Systems Administrator / Programmer
[EMAIL PROTECTED] - PLANET NETCOM - www.pnc.com.au
------------------------------------------------------
--- End Message ---
--- Begin Message ---
Hey Anth,
> Hey guys,
=some of the better-looking amongst us are not guys (and then some of us are...)
> I'm running a RH7.2 box with apache 1.3.20 installed and php-4.1.1
> installed as a DSO.
>
> Everything is working fine, except that the output from any date() or
> time() references is 16 hours behind the system time (and hwtime) on the
> machine.
>
> The machine gets its time from an ntp server which is correct; this setup
> is similar for other boxes on the network which have no problems with the
> date or time in php being correct.
>
> If I output date('T') then the correct timezone (EST...I'm in Aus) is
> displayed, but any time or dates are 16 hours behind.
>
> Where does php read the time/date values from? Is there something I can
> tweak or something that I should look at to correct this? I know I could
> kludge around it in users php code by tacking an extra 16 hours onto each
> value but obviously that's not a good solution for a box which will be
> used by others!
>
> Any thoughts / headsup would be appreciated.
Check out the meaning of "EST".
Sixteen hours behind NSW, Australian time would make it New York time wouldn't it?
Rather than the three-character codes, check out the +or-nnnn settings in the date
functions to check that you
and your server are in the same time zone.
=dn
--- End Message ---
--- Begin Message ---
On Tue, 5 Feb 2002, DL Neil wrote:
Hello DL,
> =some of the better-looking amongst us are not guys (and then some of us are...)
Sorry! :)
> Check out the meaning of "EST".
> Sixteen hours behind NSW, Australian time would make it New York time wouldn't it?
*trumpet fanfare*
Thanks for that. Problem is now fixed after adjusting the system time so
that it is /now/ correct.
cheers,
Anth
------------------------------------------------------
Anth Courtney - Systems Administrator / Programmer
[EMAIL PROTECTED] - PLANET NETCOM - www.pnc.com.au
------------------------------------------------------
--- End Message ---
--- Begin Message ---
Thank you all you listeners out there. I'll try to be respectful of your
time and patience, and apoligize in advance for my "greeness" - I am 2
weeks into PHP/MySQL.
I am trying to select the higest value from the column Thought_Num below.
But it returns nothing.
<?PHP
$db = mysql_connect("localhost", "root");
mysql_select_db("DynaSite",$db);
$result = mysql_query("SELECT MAX(Thought_Num) FROM quotes",$db);
$myrow = mysql_fetch_array($result);
print "the result is $myrow[Thought_Num]";
?>
If I change my select to something that without the MAX (e.g. Select from
quotes where DocID=1), the code works fine.
Thanks in advance for your help.
Regards,
Melanie
Second Street Web Design
http://www.second-street.com
--- End Message ---
--- Begin Message ---
what happens if you do this?
$result = mysql_query("SELECT MAX(Thought_Num) as Thought_Num FROM
quotes",$db);
I'm thinking that the column name in your original query is being called
"MAX(Thought_Num)" and not "Thought_Num".
Martin
-----Original Message-----
From: Melanie Gann [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 06, 2002 10:12 AM
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL selecting the maximum value from a column
Thank you all you listeners out there. I'll try to be respectful of your
time and patience, and apoligize in advance for my "greeness" - I am 2
weeks into PHP/MySQL.
I am trying to select the higest value from the column Thought_Num below.
But it returns nothing.
<?PHP
$db = mysql_connect("localhost", "root");
mysql_select_db("DynaSite",$db);
$result = mysql_query("SELECT MAX(Thought_Num) FROM quotes",$db);
$myrow = mysql_fetch_array($result);
print "the result is $myrow[Thought_Num]";
?>
If I change my select to something that without the MAX (e.g. Select from
quotes where DocID=1), the code works fine.
Thanks in advance for your help.
Regards,
Melanie
Second Street Web Design
http://www.second-street.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Tue, 2002-02-05 at 15:12, Melanie Gann wrote:
> Thank you all you listeners out there. I'll try to be respectful of your
> time and patience, and apoligize in advance for my "greeness" - I am 2
> weeks into PHP/MySQL.
>
> I am trying to select the higest value from the column Thought_Num below.
> But it returns nothing.
>
> <?PHP
> $db = mysql_connect("localhost", "root");
> mysql_select_db("DynaSite",$db);
> $result = mysql_query("SELECT MAX(Thought_Num) FROM quotes",$db);
> $myrow = mysql_fetch_array($result);
> print "the result is $myrow[Thought_Num]";
> ?>
>
> If I change my select to something that without the MAX (e.g. Select from
> quotes where DocID=1), the code works fine.
>
> Thanks in advance for your help.
Essentially, your problem here is that your query 'SELECT
MAX(Thought_Num) FROM quotes' will return a column named
'MAX(Though_Num)'--so you either need to do this:
print "the result is $myrow[MAX(Thought_Num)]";
Or, much preferably, explicitly name the column in the query:
SELECT max(Thought_Num) as Thought_Num FROM QUOTES
...and then access it as you had before.
> Regards,
> Melanie
Hope this helps,
Torben
--
Torben Wilson <[EMAIL PROTECTED]>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506
--- End Message ---
--- Begin Message ---
If I understand what I think you're asking, you're trying to access the
results in Javascript of something the PHP script processed... use your php
script to spit out some javascript. For example:
print "<script language='javascript'>\n";
print "$Result = ".$Results.";\n";
print "</script>";
-----Original Message-----
From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 2:09 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Can anyone jog my memory on HTTP_REFERER & Javascript
"location:replace"?
Hi!
I had found a way around the problem and it work, but when I enabled the
web security features, it messed up. So, with some debugging and I found
the problem and I'm not sure how to find a way around it. You see ....
I use page1.php to do certain features but the problem is that PHP
execution get done before the file (non-PHP programming) in passthru('...')
get done later. So, I can't get the result before PHP finish executing.
There, I came up with the Javascript where the non-PHP scripting can spit
out the Javascript code and the Javascript take care of it. It work so
well. To my dismay, the PHP pick up the HTTP_REFERER doesn't work because
HTTP_REFERER was all blank when Javascript use "location.replace('');" code.
So, it messed up the webpage. Is there a way to get the HTTP_REFERER code?
Or a different Javascript code? I mean there's no way to get the PHP
execution to pause while the non-PHP programming get done first. Is there?
Thanks,
Scott
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
****************************************************************************
This message is intended for the sole use of the individual and entity to
whom it is addressed, and may contain information that is privileged,
confidential and exempt from disclosure under applicable law. If you are
not the intended addressee, nor authorized to receive for the intended
addressee, you are hereby notified that you may not use, copy, disclose or
distribute to anyone the message or any information contained in the
message. If you have received this message in error, please immediately
advise the sender by reply email and delete the message. Thank you very
much.
--- End Message ---
--- Begin Message ---
I have a registration form and if a user enters bad information and the
php script generates an error, I want the user to be able to hit back
and have his inputs still there. Most websites I've ever used do this,
but for some reason, my form loses all its data when the back button is
pushed. This doesn't seem like something unique to PHP, but I thought
maybe you guys could shed some light. Maybe a header which instructs the
browser to cache it? Btw, I plan on having the script reprint the form
with the old values anyway, but for reference I'd really like to know
because I haven't been able to figure it out. Thanks for any help! =)
-Me
--- End Message ---
--- Begin Message ---
http://www.thickbook.com
choose the tutorial for a form with custom error messages.
Miles Thompson
At 06:40 PM 2/5/2002 -0500, SpamSucks86 wrote:
>I have a registration form and if a user enters bad information and the
>php script generates an error, I want the user to be able to hit back
>and have his inputs still there. Most websites I've ever used do this,
>but for some reason, my form loses all its data when the back button is
>pushed. This doesn't seem like something unique to PHP, but I thought
>maybe you guys could shed some light. Maybe a header which instructs the
>browser to cache it? Btw, I plan on having the script reprint the form
>with the old values anyway, but for reference I'd really like to know
>because I haven't been able to figure it out. Thanks for any help! =)
>
>-Me
--- End Message ---
--- Begin Message ---
Hello again Peter,
I describe my reply below.
> I must run it as Apache module. Can someone tell me how do I change
> the setting to run as an APACHE module instead?
I'll be replying to this question in a Windows Operating System setting. You
have 2 option in installing PHP as in Win OS, either to use the executable
installer less than 1MB file size or to use the zip file almost 4MB file
size (I recommend to use the zip file installer since its more complete
interms of modules and othre dlls).
Unzipped the zip file into any directory you want then just read and follow
the instruction found on the install.txt file. The install.txt file also
indicated how to install PHP as a module on Apache, a minor changes on the
httpd.conf must be made. The install.txt file will tell you how.
Until then....
Regards,
Ryan F. Bayhonan
--- End Message ---
--- Begin Message ---
Hello!
I'm trying to create a directory, let's say: /some/dir. My script
(create_dir.cgi) is located at the cgi-bin directory and begins with
#!/usr/bin/php. So it's like any other script, isn't it?
The problem is: running php in safe mode with the script permissions:
rwxr-xr-x 8 root root 1234 Nov 14 12:28 create_dir.cgi
I got:
Warning: MkDir failed (Permission denied) in
/var/www/cgi-bin/create_dir.cgi on line xxx
When executing the instruction: mkdir('/some/dir', 0755);
But /some permissions are:
drwxr-xr-x 8 root root 4096 Nov 14 12:28 /some
Running in safe mode, I thought that I could use mkdir() to create it,
because the ownerships are the same! Am I wrong? Safe mode only give
access when the ownerships are the same.
When I change the ownership to /some
to the uid/gid apache is running (apache(48)/apache(48)), I get:
Warning: SAFE MODE Restriction in effect. The script whose uid is 0 is
not allowed to access /some/dir owned by uid 48 in
/var/www/cgi-bin/create_dir.cgi on line xxx
And another doubt is: running my script as a cgi, with the php binary
outside the webserver tree, it runs like any other script (as written in
the manual). I should be able to run it is setuid flags and get complete
access, but even in this case the uid/gid that my script runs is always
the webserver process uid/gid (apache/apache)
I'm running RedHat Linux 7.2 with apache 1.3.22 and php 4.0.6. The php
package includes the php apache module and the php binary.
Thanks in advance,
Roberto
--- End Message ---
--- Begin Message ---
Hi.
I'm working on an "edit" page where the pull down menu is populated from a
database. I can't figure out how to print "selected" when that particular
record is the one associated with the current ID. Can anyone help?
Here's my current code:
<!-- Dynamic Career Menu-->
<?php
include("common.inc");
$connection = @mysql_connect("$db_host","$db_user","$db_pass") or
die("Couldn't Connect.");
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select
database.");
$sql ="SELECT job_id,category,description,job_id AS my_job_id FROM
$cat_table_name";
$result = @mysql_query($sql, $connection) or die("Error #". mysql_errno() .
": " . mysql_error());
while ($row = mysql_fetch_array($result)) {
$job_id=$row['job_id'];
$category=$row['category'];
$description=$row['description'];
$my_job_id=$row['my_job_id'];
echo "<option value=\"$job_id\" ";
if ($job_id == '$my_job_id') {
echo " selected ";
}
echo " >$title</option>";
}
$num = @mysql_num_rows($result);
?>
<!-- /Dynamic Career Menu-->
This is about the 5th iteration of this menu I've been working on. If
anyone has any ideas, please email me at [EMAIL PROTECTED] as I am on the
digest.
Thanks,
mto
--
Michael O'Neal
Web Producer
---------------------
M A N G O
B O U L D E R
---------------------
http://www.thinkmango.com
e- [EMAIL PROTECTED]
p- 303.442.1821
f- 303.938.8507
--- End Message ---
--- Begin Message ---
On Tue, 2002-02-05 at 16:23, Michael O'Neal wrote:
> Hi.
>
> I'm working on an "edit" page where the pull down menu is populated from a
> database. I can't figure out how to print "selected" when that particular
> record is the one associated with the current ID. Can anyone help?
>
> Here's my current code:
>
> <!-- Dynamic Career Menu-->
>
> <?php
>
> include("common.inc");
>
>
> $connection = @mysql_connect("$db_host","$db_user","$db_pass") or
This isn't your problem, but you do not really need to quote the above
variables.
> die("Couldn't Connect.");
> $db = @mysql_select_db($db_name, $connection) or die("Couldn't select
> database.");
>
>
> $sql ="SELECT job_id,category,description,job_id AS my_job_id FROM
> $cat_table_name";
> $result = @mysql_query($sql, $connection) or die("Error #". mysql_errno() .
> ": " . mysql_error());
>
> while ($row = mysql_fetch_array($result)) {
>
> $job_id=$row['job_id'];
> $category=$row['category'];
> $description=$row['description'];
> $my_job_id=$row['my_job_id'];
>
>
> echo "<option value=\"$job_id\" ";
>
> if ($job_id == '$my_job_id') {
^^^^^^^^^^^^
This is your problem: remove the quotes. PHP does not interpolate
single-quoted strings:
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single
[snip]
Hope this helps,
Torben
> --
>
> Michael O'Neal
> Web Producer
--
Torben Wilson <[EMAIL PROTECTED]>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506
--- End Message ---
--- Begin Message ---
Hi, looking at your sql statement, it seems like you are always setting
my_job_id and job_id to the same value for each row in the table. "select
job_id AS my_job_id" is just putting the value of job_id in a variable
called my_job_id. Could you tell us the structure of your mysql table please?
Jeff
At 05:23 PM 2/5/2002 -0700, Michael O'Neal wrote:
>Hi.
>
>I'm working on an "edit" page where the pull down menu is populated from a
>database. I can't figure out how to print "selected" when that particular
>record is the one associated with the current ID. Can anyone help?
>
>Here's my current code:
>
><!-- Dynamic Career Menu-->
>
><?php
>
>include("common.inc");
>
>
>$connection = @mysql_connect("$db_host","$db_user","$db_pass") or
>die("Couldn't Connect.");
>$db = @mysql_select_db($db_name, $connection) or die("Couldn't select
>database.");
>
>
>$sql ="SELECT job_id,category,description,job_id AS my_job_id FROM
>$cat_table_name";
>$result = @mysql_query($sql, $connection) or die("Error #". mysql_errno() .
>": " . mysql_error());
>
>while ($row = mysql_fetch_array($result)) {
>
>$job_id=$row['job_id'];
>$category=$row['category'];
>$description=$row['description'];
>$my_job_id=$row['my_job_id'];
>
>
>echo "<option value=\"$job_id\" ";
>
> if ($job_id == '$my_job_id') {
>
> echo " selected ";
> }
>
>echo " >$title</option>";
>
>
>}
>
>$num = @mysql_num_rows($result);
>
>
>?>
><!-- /Dynamic Career Menu-->
>
>
>This is about the 5th iteration of this menu I've been working on. If
>anyone has any ideas, please email me at [EMAIL PROTECTED] as I am on the
>digest.
>
>Thanks,
>
>mto
>
>--
>
>Michael O'Neal
>Web Producer
>---------------------
> M A N G O
>B O U L D E R
>---------------------
>http://www.thinkmango.com
>e- [EMAIL PROTECTED]
>p- 303.442.1821
>f- 303.938.8507
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Lose the single quotes, quoting a single variable is nonsense.
Quotes are used to define strings, it is a feature (called substitution)
of PHP that allows you to use a variable within a string.
The reason it doesn't work is that this subtitution is only performed on
strings enclosed in "'s (double quotes).
bvr.
On Tue, 05 Feb 2002 17:23:06 -0700, Michael O'Neal wrote:
> if ($job_id == '$my_job_id') {
>
> echo " selected ";
> }
>
--- End Message ---
--- Begin Message ---
Michael,
I think you're trying to kill yourself coding. here's what I do for myself:
<select name="from">
<option value="" SELECTED>Select Someone</option>
<?php
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query("select * from $table ORDER by LastName asc");
while ($mydata = mysql_fetch_object($news))
{
echo"<option value=\"".$mydata->EM."\">".$mydata->FirstName."
".$mydata->LastName."</option>\n";
}
mysql_close($myconnection);
?>
</select>
--- End Message ---
--- Begin Message ---
What is the proper way to transfer class properties through-out my pages...
let's say i have a ShoppingCart Class and i have methods like
addToCart(id, qty) and deleteFromCart(id)
also i have properties like CartItems("id" => array(), "qty"=> array())
this is what i do...
//when the user enters my site, i do some...
-------------
if (!session_is_registered("myCart")){
$myCart = new ShoppingCart();
.... (some other stuffs...)
session_register("myCart");
}
else {
$myCart = new ShoppingCart();
}
--------------
if the object in the session is not present
i would create an instance and then register
it to the session.
else if it is present, i would just reconstruct it...
because if i don't, even though it is in the
sessions, the properties and methods are
not constructed (no handler, i don't know how
to call it).
my code works, but is there any other way
to do this, because i think it's kinda slow....
another question, is it ok to have a database-driven
shopping cart? i make use of the database to as the
actual cart holder?
i need your opinions on these....
thanks!
Brian Feliciano
-------
i lost my connection to the list for a while, so
i have never heard your answers, please post it again or
email it to me directly..
thanks...
--- End Message ---
--- Begin Message ---
I'm using this code to create a "Next n Articles >>" on my index.page
from my mysql database.
I worked most of it out myself. Then I got some help. It works. I
thought I understood my own code enough to be able to construct a "<<
Previous n Articles". I guess not. My coding skills need help.
So how do I reverse my code to construct the previous n articles from my
sql database.
if(!$offset)
{
$offset = 0;
}
$limit = 5;
$num_rows = 13;#I get this from a mysql operation
#####################################################
$new_offset = $offset + $limit;
$disp = $limit;
if ($new_offset + $limit > $num_rows)
{
$disp = $num_rows - $new_offset;
}
if ($disp > 0)
{
$nextinsert = " <font face=\"arial\" size=2><A
HREF=\"index.html?offset=".$new_offset."\">Next ".$disp." Articles
>></a></font>\n";
}
<g> Thanks if you have a second.
John
--- End Message ---
--- Begin Message ---
On Wednesday 06 February 2002 09:59, jtjohnston wrote:
> I'm using this code to create a "Next n Articles >>" on my index.page
> from my mysql database.
> I worked most of it out myself. Then I got some help. It works. I
> thought I understood my own code enough to be able to construct a "<<
> Previous n Articles". I guess not. My coding skills need help.
> So how do I reverse my code to construct the previous n articles from my
> sql database.
>
> if(!$offset)
> {
> $offset = 0;
> }
> $limit = 5;
> $num_rows = 13;#I get this from a mysql operation
>
> #####################################################
> $new_offset = $offset + $limit;
> $disp = $limit;
> if ($new_offset + $limit > $num_rows)
> {
> $disp = $num_rows - $new_offset;
> }
> if ($disp > 0)
> {
> $nextinsert = " <font face=\"arial\" size=2><A
> HREF=\"index.html?offset=".$new_offset."\">Next ".$disp." Articles
> >></a></font>\n";
> }
>
Something like:
$previous = $offset - $limit;
if ($previous < 0) { $previous = 0; }
then incorporate $previous into your previous link in a similar fashion to
the next link.
hth
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
Random, n.:
As in number, predictable. As in memory access, unpredictable.
*/
--- End Message ---
--- Begin Message ---
Jason,
I'm not ssure I follow.
$offset is the number i read in in my <a href>
$limit is the number displayed.
$num_rows is the number of rows in my database.
What are you doing with $previous? $previous would be my string, not the
previous offset?
Could you show me again?
> > if(!$offset)
> > {
> > $offset = 0;
> > }
> > $limit = 5;
> > $num_rows = 13;#I get this from a mysql operation
> >
> > #####################################################
> > $new_offset = $offset + $limit;
> > $disp = $limit;
> > if ($new_offset + $limit > $num_rows)
> > {
> > $disp = $num_rows - $new_offset;
> > }
> > if ($disp > 0)
> > {
> > $nextinsert = " <font face=\"arial\" size=2><A
> HREF=\"index.html?offset=".$new_offset."\">Next ".$disp." Articles
> >></a></font>\n";
> > }
> >
>
> Something like:
>
> $previous = $offset - $limit;
> if ($previous < 0) { $previous = 0; }
>
> then incorporate $previous into your previous link in a similar fashion to
> the next link.
--- End Message ---
--- Begin Message ---
On Wednesday 06 February 2002 12:02, jtjohnston wrote:
> Jason,
>
> I'm not ssure I follow.
> $offset is the number i read in in my <a href>
> $limit is the number displayed.
> $num_rows is the number of rows in my database.
Correct.
> What are you doing with $previous? $previous would be my string, not the
> previous offset?
> Could you show me again?
OK, you're stepping through your results and displaying $limit number of
records each time.
$offset holds your current place inside that set of results.
To get to your next set of results you're adding $limit to $offset each time.
So how do you get the previous set of results? Subtract $limit from $offset!
> > > if(!$offset)
> > > {
> > > $offset = 0;
> > > }
> > > $limit = 5;
> > > $num_rows = 13;#I get this from a mysql operation
> > >
> > > #####################################################
> > > $new_offset = $offset + $limit;
> > > $disp = $limit;
> > > if ($new_offset + $limit > $num_rows)
> > > {
> > > $disp = $num_rows - $new_offset;
> > > }
> > > if ($disp > 0)
> > > {
> > > $nextinsert = " <font face=\"arial\" size=2><A
> >
> > HREF=\"index.html?offset=".$new_offset."\">Next ".$disp." Articles
> > >></a></font>\n";
> >
> > > }
> >
> > Something like:
> >
> > $previous = $offset - $limit;
> > if ($previous < 0) { $previous = 0; }
> >
> > then incorporate $previous into your previous link in a similar fashion
> > to the next link.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
A fail-safe circuit will destroy others.
-- Klipstein
*/
--- End Message ---
--- Begin Message ---
I want to reset the autoindex in a mysql table using php if I can.
I found this. Can anyone help?
http://www.mysql.com/doc/m/y/myisamchk_other_options.html
J
--- End Message ---
--- Begin Message ---
Hi PHPers,
in late 2001 I had a customer that was interested in a kind of
universal (my)SQL module for PHPNuke / phpWebsite. Thus I ordered the
development and - as fair as life is - the customer went straight into
bankruptcy.
Now I have a first beta of "modDb" - as we call it - and almost no
need to push it further. At least - kind fellows - the programmers
offered to do some additional work on modDb.
Now ... to keep a long story short ... which is the best way to bring
this to a kind of happy end? Where could I contribute it? On the one
hand I would love to contribute it under GPL - on the other hand it
cost something ...
Please let me in on your thoughts about this matter! Thanx in advance
...
--
Cheers,
Vince
'''
ô¿ô
-
--- End Message ---
--- Begin Message ---
Hello All,
Can someone please RTFM me so I can convert MySQL 24 hour time to 12
hour time.
TIA
gary
--- End Message ---
--- Begin Message ---
On Tue, 2002-02-05 at 18:44, Gary wrote:
> Hello All,
> Can someone please RTFM me so I can convert MySQL 24 hour time to 12
> hour time.
> TIA
> gary
Use MySQL's date_format() function with the %r specifier in your query:
shanna% mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2401 to server version: 3.22.32-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> select date_format(now(), '%T');
+--------------------------+
| date_format(now(), '%T') |
+--------------------------+
| 20:17:30 |
+--------------------------+
1 row in set (0.00 sec)
mysql> select date_format(now(), '%r');
+--------------------------+
| date_format(now(), '%r') |
+--------------------------+
| 08:17:39 PM |
+--------------------------+
1 row in set (0.00 sec)
mysql> quit
Bye
shanna%
This is documented at:
http://www.mysql.com/doc/D/a/Date_and_time_functions.html
Your query would then be something like the following, assuming a table
named my_table and a date/time column named my_column:
select date_format(my_column, '%r') from my_table
Alternatively, select the date as a timestamp and feed it to strftime():
http://www.php.net/strftime
Hope this helps,
Torben
--
Torben Wilson <[EMAIL PROTECTED]>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506
--- End Message ---
--- Begin Message ---
I have a form with 1 checkbox and have coded it like this:
<input type=checkbox name=private>
When the form is submitted, $HTTP_POST_VARS[private] only exists IF checkbox
is checked. It doesn't exist otherwise, which is causing a problem because
there are several other elements before and after. What happens is the
value AFTER "private" is actually populating "private" if "private" is empty
(not checked). I am, no doubt, missing something small, but critical here.
Can someone point out the error of my ways and explain how to get the
checkbox key/value pair into the post vars array when the value is not
checked?
TIA,
--
Gaylen
PHP KISGB v3.22 Guest Book http://www.gaylenandmargie.com/phpwebsite/
--- End Message ---
--- Begin Message ---
There is no way. How would you then know if the checkbox was checked or
not?
I use 'em like this
<input type=checkbox name="private" value="myValue">
and then check if $private is "myValue" or not.
If you really have to get some data thru, use hidden inputs.
Niklas
-----Original Message-----
From: Gaylen Fraley [mailto:[EMAIL PROTECTED]]
Sent: 6. helmikuuta 2002 6:41
To: [EMAIL PROTECTED]
Subject: [PHP] Checkboxe problem
I have a form with 1 checkbox and have coded it like this:
<input type=checkbox name=private>
When the form is submitted, $HTTP_POST_VARS[private] only exists IF
checkbox is checked. It doesn't exist otherwise, which is causing a
problem because there are several other elements before and after. What
happens is the value AFTER "private" is actually populating "private" if
"private" is empty (not checked). I am, no doubt, missing something
small, but critical here. Can someone point out the error of my ways and
explain how to get the checkbox key/value pair into the post vars array
when the value is not checked?
TIA,
--
Gaylen
PHP KISGB v3.22 Guest Book http://www.gaylenandmargie.com/phpwebsite/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
just use iseet();
if(isset($private)){
//do stuff
}
----- Original Message -----
From: "Gaylen Fraley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 05, 2002 8:41 PM
Subject: [PHP] Checkboxe problem
> I have a form with 1 checkbox and have coded it like this:
>
> <input type=checkbox name=private>
>
> When the form is submitted, $HTTP_POST_VARS[private] only exists IF
checkbox
> is checked. It doesn't exist otherwise, which is causing a problem
because
> there are several other elements before and after. What happens is the
> value AFTER "private" is actually populating "private" if "private" is
empty
> (not checked). I am, no doubt, missing something small, but critical
here.
> Can someone point out the error of my ways and explain how to get the
> checkbox key/value pair into the post vars array when the value is not
> checked?
>
> TIA,
>
> --
> Gaylen
> PHP KISGB v3.22 Guest Book http://www.gaylenandmargie.com/phpwebsite/
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
On Mon, 2002-02-04 at 20:19, Daniel Grace wrote:
> "Lars Torben Wilson" <[EMAIL PROTECTED]> wrote in message
> >
> > From the manual:
> >
> > break accepts an optional numeric argument which tells it how
> > many nested enclosing structures are to be broken out of
> >
> > You can find this at http://www.php.net/break (which will take you
> > to http://www.php.net/manual/en/control-structures.break.php).
> >
> >
> > Hope this helps,
> >
> > Torben
>
> That being said, break only breaks out of looping constructs. A break placed
> within an if-block will break out of the loop around it. There isn't a
> direct way to break out of an if-block alone (if that's your intent), though
> this will work:
Not true, as break works on switch() as well; switch() would be fairly
useless without it. :) You are correct that it does not consider an if()
block to be an enclosing loop, though.
Torben
> do {
> if(condition) {
> ...
> ...
> ...
> break;
> }
> } while(0);
>
> -- Daniel Grace
--
Torben Wilson <[EMAIL PROTECTED]>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506
--- End Message ---
--- Begin Message ---
The manual shows that you can use switches with numeric values but is it
also possible to use strings? Is this possible? If not, what can I
do? Just a bunch of if statements?
<?
if (isset($Name)) {
switch ($Name)
case Homer Simpson:
echo "DO'H!!!!<p>";
break;
case Fred Flinstone:
echo "Yabba Dabba Do<p>";
break;
default:
echo "Do not know you<p>";
break;
}
}
?>
--- End Message ---
--- Begin Message ---
Try it.
But to answer your question, yes. Don't forget to put quotes around your
strings in the case statements.
switch($name){
case "beesly":
break;
}
"Phantom" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The manual shows that you can use switches with numeric values but is it
> also possible to use strings? Is this possible? If not, what can I
> do? Just a bunch of if statements?
>
> <?
> if (isset($Name)) {
> switch ($Name)
> case Homer Simpson:
> echo "DO'H!!!!<p>";
> break;
> case Fred Flinstone:
> echo "Yabba Dabba Do<p>";
> break;
> default:
> echo "Do not know you<p>";
> break;
> }
> }
> ?>
>
--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "YY" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Wednesday, February 06, 2002 1:29 PM
Subject: why !^ in email?
> why appear !^ in email when I send HTML email with mail() function? It
works
> w/ those HTML codes, but I've no idea why there are some "!" signs appear
in
> the email. Can anyone help?
>
>
>
--- End Message ---
--- Begin Message ---
Pleae help me !
I need delete record from table user.mysql in mysql database, i log on in
mysql like root and I log on on linux server like root. But when I write
command : delete from user where user='....'; mysql send me error message :
ERROR 1036 Table 'user; is read only !
Thans for you helps...
roman
--- End Message ---
--- Begin Message ---
What is the proper way to transfer class properties through-out my pages...
let's say i have a ShoppingCart Class and i have methods like
addToCart(id, qty) and deleteFromCart(id)
also i have properties like CartItems("id" => array(), "qty"=> array())
this is what i do...
//when the user enters my site, i do some...
-------------
if (!session_is_registered("myCart")){
$myCart = new ShoppingCart();
.... (some other stuffs...)
session_register("myCart");
}
else {
$myCart = new ShoppingCart();
}
--------------
if the object in the session is not present
i would create an instance and then register
it to the session.
else if it is present, i would just reconstruct it...
because if i don't, even though it is in the
sessions, the properties and methods are
not constructed (no handler, i don't know how
to call it).
my code works, but is there any other way
to do this, because i think it's kinda slow....
another question, is it ok to have a database-driven
shopping cart? i make use of the database to as the
actual cart holder?
i need your opinions on these....
thanks!
Brian Feliciano
-------
i lost my connection to the list for a while, so
i have never heard your answers, please post it again or
email it to me directly..
thanks...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
> What is the proper way to transfer class properties through-out my
> pages...
>
> if (!session_is_registered("myCart")){
> $myCart = new ShoppingCart();
> .... (some other stuffs...)
> session_register("myCart");
> }
you dont need to do this,
> else {
> $myCart = new ShoppingCart();
> }
as far as i have experienced.
the type of the session variable is saved in the session too, so php
automatically realizes that "myCart" is an instance of
"ShoppingCart", you only need to be sure to have the class
"ShoppingCart" defined before you start the session, if i remember
right
that's at least how i do it and it works already for quite a while
very well :-)
--
Wolfram
--- End Message ---
--- Begin Message ---
> Suppress the error message:
> $result = @mysql_query("sql statement",$db);
DL Neil, thank you: INSERT IGNORE is exactly what i need. You helped me
greatly!
Matt, thaks you for help too, but my non-perfect english doesn't allow me to
express my thoughts correctly.
Thanks!
Valentin Petruchek (aki Zliy Pes)
*** Cut the beginning ***
http://zliypes.com.ua
mailto:[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Hello, list!
I've php script that works for seveeral minutes (3-5) - it indexes my site
and when page is indexed it echoes a one-row table (page bla.bla.bla
indexed). But browser shows it only when it gets all the page.
I want it to show line by line... I know it can be done in perl
(www.tracert.com)
How can this be done in php: sending to a browser parts of html generated?
Valentin Petruchek (aki Zliy Pes)
*** Cut the beginning ***
http://zliypes.com.ua
mailto:[EMAIL PROTECTED]
--- End Message ---