|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: php-general-digest-help
lists.php.netDate: Mon Mar 19 2001 - 21:47:17 CST
php-general Digest 20 Mar 2001 03:47:17 -0000 Issue 577
Topics (messages 44567 through 44680):
Searching multiple tables
44567 by: Clayton Dukes
Re: Problems with Linux PHP
44568 by: Liam Gibbs
44611 by: Christian Reiniger
PHP vs Servlet
44569 by: Jesper Blomström
44632 by: Jesper Blomström
Re: first three characters
44570 by: Johnson, Kirk
Re: [PHP-DB] Re: [PHP] Query - Grouping Results
44571 by: Darryl Friesen
Re: use strict alternative
44572 by: Johnson, Kirk
Re: how do i get a variable type? - not that simple
44573 by: Johnson, Kirk
44656 by: Mahmoud Abu-Wardeh
Re: [PHP-DB] Query - Grouping Results
44574 by: Mario Henrique Cruz Torres
Re: submission of 1..N variables
44575 by: Chris Lee
Re: Source Protection
44576 by: Chris Lee
44585 by: rui.websolut.net
Re: Variables problem
44577 by: Chris Lee
Re: Change POST for GET
44578 by: Chris Lee
44580 by: Altunergil, Oktay
Re: FileUpload problematic
44579 by: Chris Lee
44586 by: ben.2.edwards.bt.com
Re: With all this talk about editors ...
44581 by: Chris Lee
removing element from array
44582 by: Alexander Gräf
44583 by: Chris Lee
44587 by: Jack Dempsey
Re: MS SQL databse connecting
44584 by: Michael Kimsal
44590 by: Yoshi Melrose
44593 by: Andrew Hill
44594 by: Andrew Hill
44598 by: Yoshi Melrose
44599 by: Yoshi Melrose
mime mail class (Sascha & Tobias) - msWORD doc attachment not working
44588 by: Jen Hall
Re: Problems with multiple query
44589 by: Nuno Silva
HELP insert still dosn't work
44591 by: Rudolf Frint
44651 by: David Robley
44659 by: ben
SETUP PHP , MYSQL, APACHE
44592 by: Luis
"deleted" cookie
44595 by: Nikolai Vladychevski
managing scripts on different domains
44596 by: Thomas Schneider
Re: site root variable (for Generic Unix and Windows)
44597 by: Harshdeep S Jawanda
44614 by: Harshdeep S Jawanda
44615 by: Harshdeep S Jawanda
Add commas to 1188889 so--> 1,188,889
44600 by: Karl J. Stubsjoen
44601 by: Egon Schmid (.work)
44603 by: Reuben D Budiardja
unlink failed message in page but files are removed!
44602 by: Tom Beidler
Re: pulldown population not getting the last value
44604 by: Tom Beidler
PHP hosts?
44605 by: Good Fella
44607 by: Jeff Oien
44610 by: postmaster-vs
PHP Webhosting
44606 by: Angerer, Chad
44609 by: support
44618 by: Aviv Revach
OOP question regarding class extension
44608 by: John Guynn
44613 by: Altunergil, Oktay
44621 by: Matt McClanahan
webhosts
44612 by: postmaster-vs
posix_pwnam with shadow passwords
44616 by: Liam Gibbs
Remember my username & password
44617 by: Batis
44619 by: Pierre-Yves Lemaire
44625 by: Miles Thompson
Reversing htmlspecialchars()
44620 by: Yev
44622 by: Egon Schmid (.work)
Re: Checking if a web, a url really exists ?
44623 by: Geoff Caplan
Re: Automatic documentation: call for help with C++
44624 by: Geoff Caplan
Re: PHP & MYSQL BOOKS
44626 by: YoBro
44627 by: Kurth Bemis
44630 by: Jeff Oien
Reading one line, and no more.
44628 by: Richard
44629 by: Altunergil, Oktay
44631 by: Miles Thompson
Re: weeks revisited
44633 by: Chris Worth
Help with array creation
44634 by: Chris Carbaugh
PHP Install Problem
44635 by: Joseph Koenig
Script to convert # of seconds to HH:mm
44636 by: Yoshi Melrose
44637 by: mjriding.wcoil.com
44639 by: Phillip Bow
44640 by: Javier Muniz
44641 by: Phillip Bow
44642 by: Yoshi Melrose
44646 by: Phillip Bow
44662 by: Stephan Ahonen
get_meta_tags bug?
44638 by: Paul Rees
Re: Zend?
44643 by: Richard Lynch
Re: php editors
44644 by: Richard Lynch
44647 by: Altunergil, Oktay
Re: \"deleted\" cookie
44645 by: Nikolai Vladychevski
math query
44648 by: Peter Houchin
44650 by: Johnson, Kirk
PHP w/ Oracle OCI8 - how stable?
44649 by: Hardy Merrill
(HELP) Reading a file sent through HTTP
44652 by: Fabian Raygosa
44653 by: Rasmus Lerdorf
44654 by: Fabian Raygosa
44655 by: Rasmus Lerdorf
44657 by: Fabian Raygosa
44658 by: Jason Brooke
44660 by: Fabian Raygosa
Hey Everyone
44661 by: WebMaster
dl()-function
44663 by: Jochen Kaechelin
Using php4.02 on IIS5
44664 by: James Cox
Simple PHP 4 and MySQL question about query
44665 by: SED
44666 by: Mark
44669 by: David Robley
44670 by: Peter Houchin
[Q] double quote(") is auto-transformed into (\")!
44667 by: Chung Ha-Nyung
44668 by: Jack Dempsey
44671 by: Konrad Wojas
44672 by: David Robley
get name of file
44673 by: Matthew Delmarter
44674 by: Jack Dempsey
44675 by: John LYC
44677 by: Thor M. Steindorsson
Re: Sessions and CHECKBOXES :(
44676 by: karakedi
Re: Tables with scroll in HTML?
44678 by: karakedi
checboxex and sessions
44679 by: karakedi
Re: Simple PHP 4 and MySQL question about query - Problem solved!
44680 by: SED
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:
I'm having a hard time chasing down a bug.
I have themes installed on my website, the color choices are stored in the database.
I need to search all tables within the database for the word "red"
how can I do this?
Thanks :-)
Clayton Dukes
attached mail follows:
<<I'm having a couple of problems while porting some software from Lynx OS
to Linux. Here they are:
1. The encryption method seems to be different. Does anyone know the salt to
use in the crypt() function in Linux?
2. Also, I seem to not be able to popen() in Linux. I get a file pointer
which is blank. Does anybody know why???
To add a little info to my post, I've found out something about my problem.
I'm getting the error message "popen("chmod 700 session", "r+") - Invalid
argument in file.php3 on line ###". The line that gives this command is:
if($fp = popen($command, "r+")) {
The $command is "chmod 700 session". This problem shows up in Linux 2.2.12,
but this command works fine in LynxOS 3.0.1.
I found some information that says that popen doesn't work with some
versions of Linux because the kernel is broken on those versions. Is there a
way around this that is used by both (and all other Unix) OSs? Am I stuck?
Thanks in advance again,
Liam
attached mail follows:
On Monday 19 March 2001 15:28, you wrote:
> I'm having a couple of problems while porting some software from Lynx
> OS to Linux. Here they are:
>
> 1. The encryption method seems to be different. Does anyone know the
> salt to use in the crypt() function in Linux?
Depends on the distribution you're using and (sometimes) on what you
selected during installation of the distro.
Have a look at the manual page for crypt(PHP). It says something about
constants being defined depending on which encryption modes are available.
-- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/)CPU not found. retry, abort, ignore?
attached mail follows:
Hi!
I am sure you have a solution to this...
How shall I communicate with a servlet from PHP? I have a servlet which makes a DB-query and returns the result.
Thanks!
/ Jeppe
-- Jesper Blomström jeppepartitur.se Arbete: 08-566 280 08 Hem: 08-669 23 10 Mobil: 070-30 24 911
attached mail follows:
I found out how to do it.
Thx anyway
/ J
Jesper Blomström <jeppe
partitur.se> skrev i
diskussionsgruppsmeddelandet:3AB6293B.688FFF3A
partitur.se...
> Hi!
>
> I am sure you have a solution to this...
>
> How shall I communicate with a servlet from PHP?
> I have a servlet which makes a DB-query and returns the
> result.
>
> Thanks!
>
>
>
> / Jeppe
>
>
>
> --
> Jesper Blomström
> jeppe
partitur.se
> Arbete: 08-566 280 08
> Hem: 08-669 23 10
> Mobil: 070-30 24 911
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
substr()
http://www.php.net/manual/en/function.substr.php
Kirk
> -----Original Message-----
> From: Rahul Bhide [mailto:rabhide
ptc.com]
> Sent: Sunday, March 18, 2001 11:02 PM
> To: php-general
lists.php.net
> Subject: [PHP] first three characters
>
>
> Gurus,
> How do I extract the first n characters out of a word . I
> have this-
>
attached mail follows:
> Doesn't seem to work, how would I print that out with PHP?
The results will come back sorted by name, then time. While processing each row, you'll need to keep track of when the username changes, something like this (this is just rough code, not quite valid PHP):
$username = ''; while ($data = fetchrow) { if ($username != $data['name']) { $username = $data['name']; print "Logins for " . $username . "\n\n"; } print $login . "\n"; }
Keep track of the current user. As you examine each record, check if it's different than the current one. If it is, save it as the current username, and print the login info. If it's the same, just print the login info.
- Darryl
----------------------------------------------------------------------
Darryl Friesen, B.Sc., Programmer/Analyst Darryl.Friesen
usask.ca
Education & Research Technology Services, http://gollum.usask.ca/
Department of Computing Services,
University of Saskatchewan
----------------------------------------------------------------------
"Go not to the Elves for counsel, for they will say both no and yes"
attached mail follows:
I think there is an error_level you can set that will warn about using *undefined* variables before they have been assigned a value. Don't recall the details offhand.
Kirk
> -----Original Message-----
> From: Christian Reiniger [mailto:creinig
mayn.de]
> Sent: Monday, March 19, 2001 5:37 AM
> To: 'php-general
lists.php.net'
> Subject: Re: [PHP] use strict alternative
> "use strict" forces you to declare variables before you use > them. AFAIK > there's no such thing in PHP (unfortunately).
attached mail follows:
Jim,
Thanks for sharing all your hard work. Have you seen checkdate()? http://www.php.net/manual/en/function.checkdate.php
Kirk
> -----Original Message-----
> From: Ide, Jim [mailto:jide
lgb-inc.com]
> Sent: Monday, March 19, 2001 6:38 AM
> To: 'phpman'; php-general
lists.php.net
> Subject: RE: [PHP] how do i get a variable type? - not that simple
>
>
> These are the functions I use to determine if
> a string value is a valid integer, real, date, etc.
> Hope this helps.
>
> ps - please let me know if you find any errors. thanx.
>
> <?php
>
> function IsValidBoolean($p) {
> if ( isset($p) ) {
> if ((strtolower($p) == "true") or (strtolower($p) ==
> "false")) return TRUE;
> }
> return FALSE;
> }
>
> function IsValidMemo($p) {
>
> // If $p contains any characters other than printable ascii,
> // or \r or \n, return FALSE.
>
> if (trim($p) == "") return TRUE;
> if ( ereg("[^\r\n\x20-\x7E]", $p) ) return FALSE;
> return TRUE;
> }
>
> function IsValidString($p) {
>
> // If $p contains any characters other than printable ascii,
> // return FALSE.
>
> if (trim($p) == "") return TRUE;
> if ( ereg("[^\x20-\x7E]", $p) ) return FALSE;
> return TRUE;
> }
>
> function IsValidInteger($p) {
>
> // return TRUE if:
> // 1. $p is not equal to ""
> // 2. $p consists of 1 or more digits, optionally preceded by a
> minus sign
>
> if ( isset($p) ) return ereg("^\-?[0-9]+$",$p);
> return FALSE;
> }
>
> function IsValidReal($p) {
>
> // return TRUE if:
> // 1. $p is not equal to ""
> // 2. $p begins with optional minus sign, followed by 1 or more
> digits, followed by a decimal point,
> // followed by 1 or more digits
> // 3. $p can be optionally preceded by a minus sign
>
> if ( isset($p) ) return ereg("^\-?[0-9]+\.[0-9]+$",$p);
> return FALSE;
> }
>
> function IsLeapYear($y) {
> if ( (($y % 4) == 0) && (($y % 100) != 0) || (($y % 400) == 0))
> return TRUE;
> return FALSE;
> }
>
> function IsValidDate($p) {
>
> // return TRUE if:
> // 1. $p is not equal to ""
> // 2. $p consists of 4 digits followed by minus sign,
> followed by 2
> digits, followed by
> // minus sign, followed by 2 digits
> // example 1995-02-03
>
> if ( ! isset($p) )
> return FALSE;
> if ( ! ereg("^([0-9]{4})\-([0-9]{2})\-([0-9]{2})$",$p) )
> return FALSE;
>
> $t = explode("-",$p);
> if ( count($t) != 3 ) return FALSE;
> $y = $t[0];
> $m = $t[1];
> $d = $t[2];
>
> return IsValidDate2($y,$m,$d);
> }
>
> function IsValidDate2($y,$m,$d) {
>
> if ( ($m < 1) or ($m > 12) ) return FALSE;
> if ( ($d < 1) or ($d > 31) ) return FALSE;
>
> // 30 days has sept, apr, jun, and nov (all the rest
> have 31 [except
> for feb])
> // 9 4 6 11
>
> if ( ($m == 4) or ($m == 6) or ($m == 9) or ($m == 11) ) {
> if ($d > 30) return FALSE;
> } elseif ($m == 2) {
> if ( IsLeapYear($y) ) {
> if ( $d > 29 ) return FALSE;
> } else {
> if ( $d > 28 ) return FALSE;
> }
> }
> return TRUE;
> }
>
> function IsValidTime($p) {
>
> // return TRUE if:
> // 1. $p is not equal to ""
> // 2. $p consists of 2 digits in the range 00 to 23,
> // followed by a colon,
> // followed by 2 digits in the range 00 to 59,
> // followed by a colon,
> // followed by 2 digits in the range 00 to 59.
> // example 14:45:02
>
> if ( ! isset($p) )
> return FALSE;
> if ( ! ereg("^([0-9]{2})\:([0-9]{2})\:([0-9]{2})$",$p) )
> return FALSE;
>
> $t = explode(":",$p);
> if ( count($t) != 3 ) return FALSE;
> $h = $t[0];
> $m = $t[1];
> $s = $t[2];
>
> return IsValidTime2($h,$m,$s);
> }
>
> function IsValidTime2($h,$m,$s) {
>
> if ( ($h < 0) or ($h > 23) ) return FALSE;
> if ( ($m < 0) or ($m > 59) ) return FALSE;
> if ( ($s < 0) or ($s > 59) ) return FALSE;
>
> return TRUE;
> }
>
> function IsValidDateTime($p) {
>
> // return TRUE if:
> // 1. $p is not equal to ""
> // 2. $p consists of a valid date (validated by
> IsValidDate() above)
> // followed by a space
> // followed by a valid time (validated by
> IsValidTime() above)
> // example: 1998-04-21 22:01:34
>
> if ( ! isset($p) ) return FALSE;
>
> $temp = explode(" ",$p);
> if ( count($temp) != 2 ) return FALSE;
> $d = $temp[0];
> $t = $temp[1];
> if ( ! IsValidDate($d) ) return FALSE;
> if ( ! IsValidTime($t) ) return FALSE;
>
> return TRUE;
> }
>
> function IsValidTimeStamp($p) {
>
> // return TRUE if:
> // 1. $p is not equal to ""
> // 2. $p consists of a datetime in YYYYMMDDHHMMSS format
> // example: 19980421220134
>
> if ( ! isset($p) ) return FALSE;
> if ( ! ereg("^([0-9]{14})$",$p) ) return FALSE;
>
> $y = substr($p,0,4);
> $m = substr($p,4,2);
> $d = substr($p,6,2);
> $h = substr($p,8,2);
> $min = substr($p,10,2);
> $s = substr($p,12,2);
>
> if ( ! IsValidDate2($y,$m,$d) ) return FALSE;
> if ( ! IsValidTime2($h,$min,$s) ) return FALSE;
>
> return TRUE;
> }
>
> function TestVF($type,$fn,$v,$p) {
>
> // TestVF = TestValidationFunction
>
> // example 1:
> TestVF("integer","IsValidInteger",TRUE,"15"); //
> ok, 15 is a valid integer, so print nothing
> // example 2:
> TestVF("integer","IsValidInteger",FALSE,"15"); //
> error, 15 *is* a valid integer, so print error
> // example 3:
> TestVF("integer","IsValidInteger",FALSE,"abc"); //
> ok, "abc" is NOT a valid integer, so print nothing
> // example 4:
> TestVF("integer","IsValidInteger",TRUE,"abc"); //
> error, "abc" is NOT a valid integer, so print error
>
> $IsValid = $fn($p);
> if ( $v ) {
> if ( $IsValid ) return;
> echo "error, is NOT a valid $type: " . $p . "<BR>\n";
> } else {
> if ( ! $IsValid ) return;
> echo "error, *is* a valid $type: " . $p . "<BR>\n";
> }
> }
>
> function TestDatesNumbers() {
>
> echo "The test is sucessful if nothing else gets printed below
> this.<BR>\n";
>
> // x1F = cc
> // x20 = space
> // x21 = !
> // ...
> // x7D = }
> // x7E = ~
> // x7F = cc
>
> TestVF("string","IsValidString",TRUE, "");
> TestVF("string","IsValidString",TRUE, "asdfasdf");
> TestVF("string","IsValidString",FALSE, "asdf\nasdf");
> // contains \n
> TestVF("string","IsValidString",FALSE, "abcd" . chr(0)
> . "asdf");
> // contains chr(0)
> TestVF("string","IsValidString",FALSE, "abcd\x1Fasdf");
> // contains cc
> TestVF("string","IsValidString",TRUE, "abcd asdf");
> TestVF("string","IsValidString",TRUE, "abcd~asdf");
> TestVF("string","IsValidString",FALSE, "abcd\x7Fasdf");
> // contains cc
>
> TestVF("memo","IsValidMemo",TRUE, "");
> TestVF("memo","IsValidMemo",TRUE, "asdfasdf");
> TestVF("memo","IsValidMemo",TRUE, "asdf\nasdf");
> TestVF("memo","IsValidMemo",TRUE, "asdf\rasdf");
> TestVF("memo","IsValidMemo",TRUE, "asdf\r\nnasdf");
> TestVF("memo","IsValidMemo",FALSE, "abcd" . chr(0)
> . "asdf");
> // contains chr(0)
> TestVF("memo","IsValidMemo",FALSE, "abcd\x1Fasdf");
> // contains cc
> TestVF("memo","IsValidMemo",TRUE, "abcd asdf");
> TestVF("memo","IsValidMemo",TRUE, "abcd~asdf");
> TestVF("memo","IsValidMemo",FALSE, "abcd\x7Fasdf");
> // contains cc
>
> // digits / 0-9 :
>
> TestVF("integer","IsValidInteger",FALSE, "");
> //
> blank
> TestVF("integer","IsValidInteger",TRUE, "0");
> TestVF("integer","IsValidInteger",FALSE, " 0");
> //
> leading space not allowed
> TestVF("integer","IsValidInteger",FALSE, "+0");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",TRUE, "-0");
> TestVF("integer","IsValidInteger",FALSE, "0+");
> //
> trailing plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "0-");
> //
> trailing minus sign not allowed
> TestVF("integer","IsValidInteger",TRUE, "1");
> TestVF("integer","IsValidInteger",FALSE, "+1");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",TRUE, "-1");
> TestVF("integer","IsValidInteger",FALSE, "1+");
> //
> trailing plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "1-");
> //
> trailing minus sign not allowed
> TestVF("integer","IsValidInteger",TRUE, "11");
> TestVF("integer","IsValidInteger",FALSE, "+11");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",TRUE, "-11");
> TestVF("integer","IsValidInteger",FALSE, "11+");
> //
> trailing plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "11-");
> //
> trailing minus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "+-1");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "-+1");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "1+-");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "1-+");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "1+1");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "1-1");
> //
> minus sign must be leftmost character
> TestVF("integer","IsValidInteger",FALSE, "1o1");
> // o
> not allowed
> TestVF("integer","IsValidInteger",TRUE,
> "243095230982340982360923460972362356236");
> TestVF("integer","IsValidInteger",TRUE,
> "-243095230982340982360923460972362356236");
> TestVF("integer","IsValidInteger",FALSE, "
> -243095230982340982360923460972362356236"); // leading
> space not allowed
> TestVF("integer","IsValidInteger",FALSE,
> "3214532.43"); //
> decimal point not allowed in an integer
> TestVF("integer","IsValidInteger",FALSE, "/32");
> //
> contains /
> TestVF("integer","IsValidInteger",TRUE, "0");
> TestVF("integer","IsValidInteger",TRUE, "9");
> TestVF("integer","IsValidInteger",FALSE, ":");
> //
> contains :
>
> TestVF("real","IsValidReal",FALSE, ""); // blank
> TestVF("real","IsValidReal",FALSE, "0"); // no
> decimal point
> TestVF("real","IsValidReal",FALSE, "1"); // no
> decimal point
> TestVF("real","IsValidReal",TRUE, "1.1");
> TestVF("real","IsValidReal",FALSE, "1.");
> // no digit
> to the right of decimal point
> TestVF("real","IsValidReal",FALSE, ".1");
> // no digit
> to the left of decimal point
> TestVF("real","IsValidReal",FALSE, "-1"); // no
> decimal point
> TestVF("real","IsValidReal",TRUE, "-1.1");
> TestVF("real","IsValidReal",FALSE, " -1.1");
> // leading
> space not allowed
>
> TestVF("date","IsValidDate",FALSE, ""); // blank
> TestVF("date","IsValidDate",TRUE, "2000-05-24");
> TestVF("date","IsValidDate",FALSE, "sdghsdh");
> // contains
> alpha characters
> TestVF("date","IsValidDate",FALSE, "4/5/98");
> // contains
> slashes
> TestVF("date","IsValidDate",FALSE, "2000-9-7"); // not
> YYYY-MM-DD format
> TestVF("date","IsValidDate",TRUE, "2000-09-07");
> TestVF("date","IsValidDate",FALSE, "2000-09-31");
> // 30 days
> has september
> TestVF("date","IsValidDate",FALSE, "2000-09-00");
> // day must
> be 01 thru 31
> TestVF("date","IsValidDate",FALSE, "2000-19-07"); // month
> must be 01 thru 12
> TestVF("date","IsValidDate",FALSE, "2000-00-00");
> // non-valid
> month and day
> TestVF("date","IsValidDate",FALSE, "2000-01-32");
> // day must
> be 01 thru 31
> TestVF("date","IsValidDate",TRUE, "2000-02-28");
> TestVF("date","IsValidDate",TRUE, "2000-02-29");
> TestVF("date","IsValidDate",FALSE, "2000-02-30");
> // days in
> feb must be 01 thru 29
> TestVF("date","IsValidDate",TRUE, "1999-02-28");
> TestVF("date","IsValidDate",FALSE, "1999-02-29");
> // 1999 was
> not a leap year
> TestVF("date","IsValidDate",FALSE, "1999-02-30");
> // days in
> feb must be 01 thru 29
>
> TestVF("time","IsValidTime",FALSE, ""); // blank
> TestVF("time","IsValidTime",TRUE, "20:05:24");
> TestVF("time","IsValidTime",FALSE, "sdghsdh");
> // contains
> alpha characters
> TestVF("time","IsValidTime",FALSE, "4/5/98");
> // contains
> slashes
> TestVF("time","IsValidTime",FALSE, "20:9:7"); // not
> HH:MM:SS format
> TestVF("time","IsValidTime",TRUE, "20:09:07");
> TestVF("time","IsValidTime",FALSE, "24:09:07");
> // hour must
> be 00 thru 23
> TestVF("time","IsValidTime",FALSE, "20:60:07");
> // minute
> must be 00 thru 59
> TestVF("time","IsValidTime",FALSE, "20:07:60");
> // second
> must be 00 thru 59
>
> TestVF("datetime","IsValidDateTime",FALSE, "");
> // blank
> TestVF("datetime","IsValidDateTime",TRUE, "2000-06-06
> 20:05:24");
> TestVF("datetime","IsValidDateTime",FALSE, "2000-06-06
> 20:05:24"); // 2 spaces between date and time
> TestVF("datetime","IsValidDateTime",FALSE,
> "2000-06-0620:05:24"); // 0 spaces between
> date and time
> TestVF("datetime","IsValidDateTime",FALSE, "2000-06-6
> 20:05:24"); // non-valid date format
> TestVF("datetime","IsValidDateTime",FALSE, "2000-06-06
> 20:5:24"); // non-valid time format
> TestVF("datetime","IsValidDateTime",FALSE, "2000-06-06");
> // time missing
> TestVF("datetime","IsValidDateTime",FALSE, "20:05:24");
> // date missing
> TestVF("datetime","IsValidDateTime",FALSE, "20:05:24
> 2000-06-06"); // date and time order reversed
>
> TestVF("timestamp","IsValidTimeStamp",FALSE, "");
> // blank
> TestVF("timestamp","IsValidTimeStamp",TRUE,
> "20000606200524");
> TestVF("timestamp","IsValidTimeStamp",FALSE,
> "2000066200524");
> // non-valid date format
> TestVF("timestamp","IsValidTimeStamp",FALSE,
> "2000060620524");
> // non-valid time format
> TestVF("timestamp","IsValidTimeStamp",FALSE, "20000606");
> // time missing
> TestVF("timestamp","IsValidTimeStamp",FALSE, "200524");
> // date missing
> TestVF("timestamp","IsValidTimeStamp",FALSE,
> "20052420000606");
> // date and time order reversed
>
> TestVF("boolean","IsValidBoolean",FALSE, "");
> //
> blank
> TestVF("boolean","IsValidBoolean",TRUE, "true");
> TestVF("boolean","IsValidBoolean",TRUE, "false");
> TestVF("boolean","IsValidBoolean",TRUE, "TRUE");
> TestVF("boolean","IsValidBoolean",TRUE, "FALSE");
> TestVF("boolean","IsValidBoolean",FALSE, "t");
> //
> must be 'true' or 'false'
> TestVF("boolean","IsValidBoolean",FALSE, "f");
> //
> ditto
> TestVF("boolean","IsValidBoolean",FALSE, "0");
> //
> ditto
> TestVF("boolean","IsValidBoolean",FALSE, "1");
> //
> ditto
>
> // uncomment the next 2 to test TestVF()
> // TestVF("boolean","IsValidBoolean",TRUE, "1");
> //
> ditto
> // TestVF("boolean","IsValidBoolean",FALSE,
> "true"); //
> ditto
>
> echo "done testing.\n";
> }
>
> TestDatesNumbers();
>
> ?>
>
>
>
> -----Original Message-----
> From: phpman [mailto:info
graphicon.nu]
> Sent: Sunday, March 18, 2001 1:44 PM
> To: php-general
lists.php.net
> Subject: [PHP] how do i get a variable type? - not that simple
>
>
> No guys. that doesn't work. Take this code for example...
>
> $a="3";
> echo(gettype($a));
>
> this returns string
> i need to find it as an integer or real or float for the sql.
> which by the
> way is MySQL.
>
> thank you for responding, but I already know that gettype and
> all the other
> is_* don't work for this.
>
>
>
> ""phpman"" <info
graphicon.nu> wrote in message
> news:99132e$ol8$1
toye.p.sourceforge.net...
> > hello all,
> >
> > let's say i have this:
> > $a="varone=hello world|vartwo=2.44|varthree=100|";
> >
> > now i do this:
> >
> > $b=explode('|',$a);
> > $z=count($b);
> > for ($x=0;$x<$z;$x++) {
> > $tmp=explode('=',$b[$x]);
> > ....
> >
> > and i want to find out if $tmp[1] is a string or an integer (that's
> really
> > all I need to determine so i can put
> > together an SQL statement that puts single quotes around
> strings and none
> > around integers). Obviously
> > i won't know at design time all of the variables and their
> values. Thank
> > you.
> >
> > -dave
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail: php-general-help
lists.php.net
> > To contact the list administrators, e-mail:
> php-list-admin
lists.php.net
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin
lists.php.net
>
attached mail follows:
You could take advantage of the type conversion performed by php as demonstrated in this snippet (the trick is in multiplying $value by 1). if you need to distinguish further between doubles and floats you can do a regex on $value once you've established it's type:
<?php
$a[] = "1234"; $a[] = "1234.567"; $a[] = "1.234e-8"; $a[] = "3oranges";
foreach($a as $value) { print($value.": "); if(is_numeric($value)) { $tmp = 1 * $value; printf("is %s<BR>\n", gettype($tmp)); } else print("is not a number"); }
?>
Moody
-----Original Message-----
From: Johnson, Kirk [mailto:kjohnson
zootweb.com]
Sent: 19 March 2001 15:55
To: php-general
lists.php.net
Subject: RE: [PHP] how do i get a variable type? - not that simple
Jim,
Thanks for sharing all your hard work. Have you seen checkdate()? http://www.php.net/manual/en/function.checkdate.php
Kirk
> -----Original Message-----
> From: Ide, Jim [mailto:jide
lgb-inc.com]
> Sent: Monday, March 19, 2001 6:38 AM
> To: 'phpman'; php-general
lists.php.net
> Subject: RE: [PHP] how do i get a variable type? - not that simple
>
>
> These are the functions I use to determine if
> a string value is a valid integer, real, date, etc.
> Hope this helps.
>
> ps - please let me know if you find any errors. thanx.
>
> <?php
>
> function IsValidBoolean($p) {
> if ( isset($p) ) {
> if ((strtolower($p) == "true") or (strtolower($p) ==
> "false")) return TRUE;
> }
> return FALSE;
> }
>
> function IsValidMemo($p) {
>
> // If $p contains any characters other than printable ascii,
> // or \r or \n, return FALSE.
>
> if (trim($p) == "") return TRUE;
> if ( ereg("[^\r\n\x20-\x7E]", $p) ) return FALSE;
> return TRUE;
> }
>
> function IsValidString($p) {
>
> // If $p contains any characters other than printable ascii,
> // return FALSE.
>
> if (trim($p) == "") return TRUE;
> if ( ereg("[^\x20-\x7E]", $p) ) return FALSE;
> return TRUE;
> }
>
> function IsValidInteger($p) {
>
> // return TRUE if:
> // 1. $p is not equal to ""
> // 2. $p consists of 1 or more digits, optionally preceded by a
> minus sign
>
> if ( isset($p) ) return ereg("^\-?[0-9]+$",$p);
> return FALSE;
> }
>
> function IsValidReal($p) {
>
> // return TRUE if:
> // 1. $p is not equal to ""
> // 2. $p begins with optional minus sign, followed by 1 or more
> digits, followed by a decimal point,
> // followed by 1 or more digits
> // 3. $p can be optionally preceded by a minus sign
>
> if ( isset($p) ) return ereg("^\-?[0-9]+\.[0-9]+$",$p);
> return FALSE;
> }
>
> function IsLeapYear($y) {
> if ( (($y % 4) == 0) && (($y % 100) != 0) || (($y % 400) == 0))
> return TRUE;
> return FALSE;
> }
>
> function IsValidDate($p) {
>
> // return TRUE if:
> // 1. $p is not equal to ""
> // 2. $p consists of 4 digits followed by minus sign,
> followed by 2
> digits, followed by
> // minus sign, followed by 2 digits
> // example 1995-02-03
>
> if ( ! isset($p) )
> return FALSE;
> if ( ! ereg("^([0-9]{4})\-([0-9]{2})\-([0-9]{2})$",$p) )
> return FALSE;
>
> $t = explode("-",$p);
> if ( count($t) != 3 ) return FALSE;
> $y = $t[0];
> $m = $t[1];
> $d = $t[2];
>
> return IsValidDate2($y,$m,$d);
> }
>
> function IsValidDate2($y,$m,$d) {
>
> if ( ($m < 1) or ($m > 12) ) return FALSE;
> if ( ($d < 1) or ($d > 31) ) return FALSE;
>
> // 30 days has sept, apr, jun, and nov (all the rest
> have 31 [except
> for feb])
> // 9 4 6 11
>
> if ( ($m == 4) or ($m == 6) or ($m == 9) or ($m == 11) ) {
> if ($d > 30) return FALSE;
> } elseif ($m == 2) {
> if ( IsLeapYear($y) ) {
> if ( $d > 29 ) return FALSE;
> } else {
> if ( $d > 28 ) return FALSE;
> }
> }
> return TRUE;
> }
>
> function IsValidTime($p) {
>
> // return TRUE if:
> // 1. $p is not equal to ""
> // 2. $p consists of 2 digits in the range 00 to 23,
> // followed by a colon,
> // followed by 2 digits in the range 00 to 59,
> // followed by a colon,
> // followed by 2 digits in the range 00 to 59.
> // example 14:45:02
>
> if ( ! isset($p) )
> return FALSE;
> if ( ! ereg("^([0-9]{2})\:([0-9]{2})\:([0-9]{2})$",$p) )
> return FALSE;
>
> $t = explode(":",$p);
> if ( count($t) != 3 ) return FALSE;
> $h = $t[0];
> $m = $t[1];
> $s = $t[2];
>
> return IsValidTime2($h,$m,$s);
> }
>
> function IsValidTime2($h,$m,$s) {
>
> if ( ($h < 0) or ($h > 23) ) return FALSE;
> if ( ($m < 0) or ($m > 59) ) return FALSE;
> if ( ($s < 0) or ($s > 59) ) return FALSE;
>
> return TRUE;
> }
>
> function IsValidDateTime($p) {
>
> // return TRUE if:
> // 1. $p is not equal to ""
> // 2. $p consists of a valid date (validated by
> IsValidDate() above)
> // followed by a space
> // followed by a valid time (validated by
> IsValidTime() above)
> // example: 1998-04-21 22:01:34
>
> if ( ! isset($p) ) return FALSE;
>
> $temp = explode(" ",$p);
> if ( count($temp) != 2 ) return FALSE;
> $d = $temp[0];
> $t = $temp[1];
> if ( ! IsValidDate($d) ) return FALSE;
> if ( ! IsValidTime($t) ) return FALSE;
>
> return TRUE;
> }
>
> function IsValidTimeStamp($p) {
>
> // return TRUE if:
> // 1. $p is not equal to ""
> // 2. $p consists of a datetime in YYYYMMDDHHMMSS format
> // example: 19980421220134
>
> if ( ! isset($p) ) return FALSE;
> if ( ! ereg("^([0-9]{14})$",$p) ) return FALSE;
>
> $y = substr($p,0,4);
> $m = substr($p,4,2);
> $d = substr($p,6,2);
> $h = substr($p,8,2);
> $min = substr($p,10,2);
> $s = substr($p,12,2);
>
> if ( ! IsValidDate2($y,$m,$d) ) return FALSE;
> if ( ! IsValidTime2($h,$min,$s) ) return FALSE;
>
> return TRUE;
> }
>
> function TestVF($type,$fn,$v,$p) {
>
> // TestVF = TestValidationFunction
>
> // example 1:
> TestVF("integer","IsValidInteger",TRUE,"15"); //
> ok, 15 is a valid integer, so print nothing
> // example 2:
> TestVF("integer","IsValidInteger",FALSE,"15"); //
> error, 15 *is* a valid integer, so print error
> // example 3:
> TestVF("integer","IsValidInteger",FALSE,"abc"); //
> ok, "abc" is NOT a valid integer, so print nothing
> // example 4:
> TestVF("integer","IsValidInteger",TRUE,"abc"); //
> error, "abc" is NOT a valid integer, so print error
>
> $IsValid = $fn($p);
> if ( $v ) {
> if ( $IsValid ) return;
> echo "error, is NOT a valid $type: " . $p . "<BR>\n";
> } else {
> if ( ! $IsValid ) return;
> echo "error, *is* a valid $type: " . $p . "<BR>\n";
> }
> }
>
> function TestDatesNumbers() {
>
> echo "The test is sucessful if nothing else gets printed below
> this.<BR>\n";
>
> // x1F = cc
> // x20 = space
> // x21 = !
> // ...
> // x7D = }
> // x7E = ~
> // x7F = cc
>
> TestVF("string","IsValidString",TRUE, "");
> TestVF("string","IsValidString",TRUE, "asdfasdf");
> TestVF("string","IsValidString",FALSE, "asdf\nasdf");
> // contains \n
> TestVF("string","IsValidString",FALSE, "abcd" . chr(0)
> . "asdf");
> // contains chr(0)
> TestVF("string","IsValidString",FALSE, "abcd\x1Fasdf");
> // contains cc
> TestVF("string","IsValidString",TRUE, "abcd asdf");
> TestVF("string","IsValidString",TRUE, "abcd~asdf");
> TestVF("string","IsValidString",FALSE, "abcd\x7Fasdf");
> // contains cc
>
> TestVF("memo","IsValidMemo",TRUE, "");
> TestVF("memo","IsValidMemo",TRUE, "asdfasdf");
> TestVF("memo","IsValidMemo",TRUE, "asdf\nasdf");
> TestVF("memo","IsValidMemo",TRUE, "asdf\rasdf");
> TestVF("memo","IsValidMemo",TRUE, "asdf\r\nnasdf");
> TestVF("memo","IsValidMemo",FALSE, "abcd" . chr(0)
> . "asdf");
> // contains chr(0)
> TestVF("memo","IsValidMemo",FALSE, "abcd\x1Fasdf");
> // contains cc
> TestVF("memo","IsValidMemo",TRUE, "abcd asdf");
> TestVF("memo","IsValidMemo",TRUE, "abcd~asdf");
> TestVF("memo","IsValidMemo",FALSE, "abcd\x7Fasdf");
> // contains cc
>
> // digits / 0-9 :
>
> TestVF("integer","IsValidInteger",FALSE, "");
> //
> blank
> TestVF("integer","IsValidInteger",TRUE, "0");
> TestVF("integer","IsValidInteger",FALSE, " 0");
> //
> leading space not allowed
> TestVF("integer","IsValidInteger",FALSE, "+0");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",TRUE, "-0");
> TestVF("integer","IsValidInteger",FALSE, "0+");
> //
> trailing plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "0-");
> //
> trailing minus sign not allowed
> TestVF("integer","IsValidInteger",TRUE, "1");
> TestVF("integer","IsValidInteger",FALSE, "+1");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",TRUE, "-1");
> TestVF("integer","IsValidInteger",FALSE, "1+");
> //
> trailing plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "1-");
> //
> trailing minus sign not allowed
> TestVF("integer","IsValidInteger",TRUE, "11");
> TestVF("integer","IsValidInteger",FALSE, "+11");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",TRUE, "-11");
> TestVF("integer","IsValidInteger",FALSE, "11+");
> //
> trailing plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "11-");
> //
> trailing minus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "+-1");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "-+1");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "1+-");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "1-+");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "1+1");
> //
> plus sign not allowed
> TestVF("integer","IsValidInteger",FALSE, "1-1");
> //
> minus sign must be leftmost character
> TestVF("integer","IsValidInteger",FALSE, "1o1");
> // o
> not allowed
> TestVF("integer","IsValidInteger",TRUE,
> "243095230982340982360923460972362356236");
> TestVF("integer","IsValidInteger",TRUE,
> "-243095230982340982360923460972362356236");
> TestVF("integer","IsValidInteger",FALSE, "
> -243095230982340982360923460972362356236"); // leading
> space not allowed
> TestVF("integer","IsValidInteger",FALSE,
> "3214532.43"); //
> decimal point not allowed in an integer
> TestVF("integer","IsValidInteger",FALSE, "/32");
> //
> contains /
> TestVF("integer","IsValidInteger",TRUE, "0");
> TestVF("integer","IsValidInteger",TRUE, "9");
> TestVF("integer","IsValidInteger",FALSE, ":");
> //
> contains :
>
> TestVF("real","IsValidReal",FALSE, ""); // blank
> TestVF("real","IsValidReal",FALSE, "0"); // no
> decimal point
> TestVF("real","IsValidReal",FALSE, "1"); // no
> decimal point
> TestVF("real","IsValidReal",TRUE, "1.1");
> TestVF("real","IsValidReal",FALSE, "1.");
> // no digit
> to the right of decimal point
> TestVF("real","IsValidReal",FALSE, ".1");
> // no digit
> to the left of decimal point
> TestVF("real","IsValidReal",FALSE, "-1"); // no
> decimal point
> TestVF("real","IsValidReal",TRUE, "-1.1");
> TestVF("real","IsValidReal",FALSE, " -1.1");
> // leading
> space not allowed
>
> TestVF("date","IsValidDate",FALSE, ""); // blank
> TestVF("date","IsValidDate",TRUE, "2000-05-24");
> TestVF("date","IsValidDate",FALSE, "sdghsdh");
> // contains
> alpha characters
> TestVF("date","IsValidDate",FALSE, "4/5/98");
> // contains
> slashes
> TestVF("date","IsValidDate",FALSE, "2000-9-7"); // not
> YYYY-MM-DD format
> TestVF("date","IsValidDate",TRUE, "2000-09-07");
> TestVF("date","IsValidDate",FALSE, "2000-09-31");
> // 30 days
> has september
> TestVF("date","IsValidDate",FALSE, "2000-09-00");
> // day must
> be 01 thru 31
> TestVF("date","IsValidDate",FALSE, "2000-19-07"); // month
> must be 01 thru 12
> TestVF("date","IsValidDate",FALSE, "2000-00-00");
> // non-valid
> month and day
> TestVF("date","IsValidDate",FALSE, "2000-01-32");
> // day must
> be 01 thru 31
> TestVF("date","IsValidDate",TRUE, "2000-02-28");
> TestVF("date","IsValidDate",TRUE, "2000-02-29");
> TestVF("date","IsValidDate",FALSE, "2000-02-30");
> // days in
> feb must be 01 thru 29
> TestVF("date","IsValidDate",TRUE, "1999-02-28");
> TestVF("date","IsValidDate",FALSE, "1999-02-29");
> // 1999 was
> not a leap year
> TestVF("date","IsValidDate",FALSE, "1999-02-30");
> // days in
> feb must be 01 thru 29
>
> TestVF("time","IsValidTime",FALSE, ""); // blank
> TestVF("time","IsValidTime",TRUE, "20:05:24");
> TestVF("time","IsValidTime",FALSE, "sdghsdh");
> // contains
> alpha characters
> TestVF("time","IsValidTime",FALSE, "4/5/98");
> // contains
> slashes
> TestVF("time","IsValidTime",FALSE, "20:9:7"); // not
> HH:MM:SS format
> TestVF("time","IsValidTime",TRUE, "20:09:07");
> TestVF("time","IsValidTime",FALSE, "24:09:07");
> // hour must
> be 00 thru 23
> TestVF("time","IsValidTime",FALSE, "20:60:07");
> // minute
> must be 00 thru 59
> TestVF("time","IsValidTime",FALSE, "20:07:60");
> // second
> must be 00 thru 59
>
> TestVF("datetime","IsValidDateTime",FALSE, "");
> // blank
> TestVF("datetime","IsValidDateTime",TRUE, "2000-06-06
> 20:05:24");
> TestVF("datetime","IsValidDateTime",FALSE, "2000-06-06
> 20:05:24"); // 2 spaces between date and time
> TestVF("datetime","IsValidDateTime",FALSE,
> "2000-06-0620:05:24"); // 0 spaces between
> date and time
> TestVF("datetime","IsValidDateTime",FALSE, "2000-06-6
> 20:05:24"); // non-valid date format
> TestVF("datetime","IsValidDateTime",FALSE, "2000-06-06
> 20:5:24"); // non-valid time format
> TestVF("datetime","IsValidDateTime",FALSE, "2000-06-06");
> // time missing
> TestVF("datetime","IsValidDateTime",FALSE, "20:05:24");
> // date missing
> TestVF("datetime","IsValidDateTime",FALSE, "20:05:24
> 2000-06-06"); // date and time order reversed
>
> TestVF("timestamp","IsValidTimeStamp",FALSE, "");
> // blank
> TestVF("timestamp","IsValidTimeStamp",TRUE,
> "20000606200524");
> TestVF("timestamp","IsValidTimeStamp",FALSE,
> "2000066200524");
> // non-valid date format
> TestVF("timestamp","IsValidTimeStamp",FALSE,
> "2000060620524");
> // non-valid time format
> TestVF("timestamp","IsValidTimeStamp",FALSE, "20000606");
> // time missing
> TestVF("timestamp","IsValidTimeStamp",FALSE, "200524");
> // date missing
> TestVF("timestamp","IsValidTimeStamp",FALSE,
> "20052420000606");
> // date and time order reversed
>
> TestVF("boolean","IsValidBoolean",FALSE, "");
> //
> blank
> TestVF("boolean","IsValidBoolean",TRUE, "true");
> TestVF("boolean","IsValidBoolean",TRUE, "false");
> TestVF("boolean","IsValidBoolean",TRUE, "TRUE");
> TestVF("boolean","IsValidBoolean",TRUE, "FALSE");
> TestVF("boolean","IsValidBoolean",FALSE, "t");
> //
> must be 'true' or 'false'
> TestVF("boolean","IsValidBoolean",FALSE, "f");
> //
> ditto
> TestVF("boolean","IsValidBoolean",FALSE, "0");
> //
> ditto
> TestVF("boolean","IsValidBoolean",FALSE, "1");
> //
> ditto
>
> // uncomment the next 2 to test TestVF()
> // TestVF("boolean","IsValidBoolean",TRUE, "1");
> //
> ditto
> // TestVF("boolean","IsValidBoolean",FALSE,
> "true"); //
> ditto
>
> echo "done testing.\n";
> }
>
> TestDatesNumbers();
>
> ?>
>
>
>
> -----Original Message-----
> From: phpman [mailto:info
graphicon.nu]
> Sent: Sunday, March 18, 2001 1:44 PM
> To: php-general
lists.php.net
> Subject: [PHP] how do i get a variable type? - not that simple
>
>
> No guys. that doesn't work. Take this code for example...
>
> $a="3";
> echo(gettype($a));
>
> this returns string
> i need to find it as an integer or real or float for the sql.
> which by the
> way is MySQL.
>
> thank you for responding, but I already know that gettype and
> all the other
> is_* don't work for this.
>
>
>
> ""phpman"" <info
graphicon.nu> wrote in message
> news:99132e$ol8$1
toye.p.sourceforge.net...
> > hello all,
> >
> > let's say i have this:
> > $a="varone=hello world|vartwo=2.44|varthree=100|";
> >
> > now i do this:
> >
> > $b=explode('|',$a);
> > $z=count($b);
> > for ($x=0;$x<$z;$x++) {
> > $tmp=explode('=',$b[$x]);
> > ....
> >
> > and i want to find out if $tmp[1] is a string or an integer (that's
> really
> > all I need to determine so i can put
> > together an SQL statement that puts single quotes around
> strings and none
> > around integers). Obviously
> > i won't know at design time all of the variables and their
> values. Thank
> > you.
> >
> > -dave
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail: php-general-help
lists.php.net
> > To contact the list administrators, e-mail:
> php-list-admin
lists.php.net
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin
lists.php.net
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
You can put this : SELECT users.name AS name, user_logins.ip AS ip, UNIX_TIMESTAMP(user_logins.time) AS time FROM users, user_logins WHERE user_logins.user_id = users.id ORDER BY time ASC GROUP BY users.name
See the GROUP BY statement at mysql docs.
Mario H.C.T.
Jordan Elver wrote:
> Hi,
> I've got a table like:
>
> id user_id ip time
> 1 2 127.0.0.1 20010316105018
>
> Etc, etc.
>
> I do a join on the this table and the users table to get the coresponding
> username to user_id like this:
>
> SELECT users.name AS name, user_logins.ip AS ip,
> UNIX_TIMESTAMP(user_logins.time) AS time FROM users, user_logins WHERE
> user_logins.user_id = users.id ORDER BY time ASC
>
> How can I display the results grouped by username?
>
> So, I want to be able to display:
>
> Logins for John
>
> Thursday 10th
> Friday 12th
> Monday 23rd
>
> Logins for Bob
>
> Monday 1st
> Tuesday 2nd
> Saturday 31st
>
> Thanks for any help,
>
> Jord
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe
lists.php.net
> For additional commands, e-mail: php-db-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
I'll show you how you want, but will recommend using arrays.
<?php
$A0 = '0'; $A1 = '1'; $A2 = '2'; $A3 = '3'; if (isset($A1)) { $i = 0; $var_name = "A$i"; while(isset($$var_name)) { // do something
$i++; $var_name = "A$i"; } } ?>
heres what you should be doing.
<?php
$A[] = '0'; $A[] = '1'; $A[] = '2'; $A[] = '3'; if (isset($A)) foreach($A as $pos => $val) // do something ?>
alot simpler, expandible and easier to read. Im sure its probably faster too...
--Chris Lee lee
mediawaveonline.com
"Ekkard Gerlach" <mlp_gerlach
nikocity.de> wrote in message news:3AB54F48.BCED62FC
nikocity.de... Hi,
n variables reach my php-programm by submission:
A0 A1 ... An
Depending on Ai is set I want to run some actions.
How can I evaluate Ai ??
if (isset (A1) then # entrance { i=0; while( isset($Ai)) { /* Of course $Ai is not working !!! */ { $B= $Ai ... action ... } }
I tried a lot with eval , with backticks, ... but no suceess.
Anybody an Idea?
tia Ekkard
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
In defence of zend technologies and open source. Is your php code being used for profit? then purchase the encoder. Is your code being used for non-profit? then release it as open source for the community to use.
--Chris Lee lee
mediawaveonline.com
""Chris Anderson"" <chrisderson
ameritech.net> wrote in message news:001901c0b026$6dd9a5c0$bf1412d1
s3e8p3... After realizing that The Zend Encoder is 2000$ I've decided that wont work for a college student(me). Is there any other way to protect source in my components?
attached mail follows:
I Agree with that, Take the same atitude as mysql. AFAIK, zend encoder is not only for hidding code, but (they say) it optimizes php processing, if that is true, it is a good and enough reason to release it for free for users that do open source projects. you can still publish the original source code, and also, if you like, compile php for production environments where the load could be high.
if the optimization thing is bogus, then i say stay whith you nice compiler, congratulations, but you guys have a principle of a compiler within the php code distribution, so it's not difficult to see the php source, take the zend engine main things and make a compiler because all the parsing is done there and execution (zend_compile.c and zend_execute.c).
i'm not a real good c programmer, soh making this alon would take a while, but one of my goals was make a free php compiler (IF zend wouldn't release it for non comercial use).
any help would be apreciated of course.
my best wishes.
On 19-Mar-2001 Chris Lee wrote:
> In defence of zend technologies and open source. Is your php code being used
> for profit? then purchase the encoder. Is your code being used for
> non-profit? then release it as open source for the community to use.
>
>
> --
>
> Chris Lee
> lee
mediawaveonline.com
>
>
>
>
> ""Chris Anderson"" <chrisderson
ameritech.net> wrote in message
> news:001901c0b026$6dd9a5c0$bf1412d1
s3e8p3...
> After realizing that The Zend Encoder is 2000$ I've decided that wont work
> for a college student(me). Is there any other way to protect source in my
> components?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
Rui Barreiros Software Developer
WEBSOLUT - Soluįões Internet
Emailto: rui
websolut.net
Personal Info: http://websolut.net/people/rui.html
As informaįões contidas neste email são confidenciais e destinam-se apenas ā(s) pessoa(s) a quem foi enviado: http://websolut.net/confidencialidade-responsabilidade.html
attached mail follows:
I dont know how good of an idea it is to have 180 variable variable names. oi, headache. but the question you asked was this.
" $q = 'tar1-1' how do I access the variable $tar1-1 "
no problem
echo $$q;
--Chris Lee lee
mediawaveonline.com
""Per Kallin"" <per
kallin.nu> wrote in message news:98va5j$3lp$1
toye.p.sourceforge.net... Hi! I have a quite big form to fill out a calendar. The form has six fields for every day in a month to make it possible to set up tree apointments (the target of the meeting and Locataion), this makes a total of about ~180 fields so I created them with a for-loop. Now I got this 180 fields named tar1-1, loc1-1, tar2-1, loc2-1 a.s.o. where the first tree letters tells what information it is, the 4th witch meeting it is (1-3) and the digits after the minus-sign tells the day of the month (1-31)
The problem is to get the value out of the variable so i can store it in my mySQL database. it no problem to create a variable that holds the name of the variable that contains the data, but then??? The value of the variable $q is 'tar1-1' and I want to access the variable $tar1-1.....
I can't find any way to solve this, can you? Someone most have created a calendar like this before...
Please respond to per
kallin.nu
/Per Kallin
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
sessions do not allow pages to be cached, when sessions are being used th no-cache header is set.
GET and POST are very differnt in some areas and very alike in others. obviously the two biggest changes is that all the variables and their values are in the url bar. I beleive most browsers have a 1024 limit for data in the url bar, I could be wrong. the other thing is you'll find spaces suck in url bars.
http://www.mediawaveonline.com/index.php?name=Chris Lee <?php
echo $name;
?>
will echo
Chris
thats all. the space ends all. you'll have to convert all spaces to %20 or +
http://www.mediawaveonline.com/index.php?name=Chris%20Lee http://www.mediawaveonline.com/index.php?name=Chris+Lee
--Chris Lee lee
mediawaveonline.com
""Jorge Alvarez"" <alvarezje
hotmail.com> wrote in message news:98u7rj$4nf$1
toye.p.sourceforge.net... Hi there,
I was using POST method on all my forms but I had to change them to GET because of "expired page" errors (I noticed this as soon as I began using PHP4 sessions).
It seems that GET works well so far, but I wonder if there's something else I should be aware of. Are both methods equivalent?
TIA,
Jorge Alvarez
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
You can use urlencode() to preserve the spaces. You don't have to any manual conversions from space to + or something else.
-----Original Message-----
From: Chris Lee [mailto:lee
mediawaveonline.com]
Sent: Monday, March 19, 2001 9:35 AM
To: php-general
lists.php.net
Subject: Re: [PHP] Change POST for GET
sessions do not allow pages to be cached, when sessions are being used th no-cache header is set.
GET and POST are very differnt in some areas and very alike in others. obviously the two biggest changes is that all the variables and their values are in the url bar. I beleive most browsers have a 1024 limit for data in the url bar, I could be wrong. the other thing is you'll find spaces suck in url bars.
http://www.mediawaveonline.com/index.php?name=Chris Lee <?php
echo $name;
?>
will echo
Chris
thats all. the space ends all. you'll have to convert all spaces to %20 or +
http://www.mediawaveonline.com/index.php?name=Chris%20Lee http://www.mediawaveonline.com/index.php?name=Chris+Lee
--Chris Lee lee
mediawaveonline.com
""Jorge Alvarez"" <alvarezje
hotmail.com> wrote in message news:98u7rj$4nf$1
toye.p.sourceforge.net... Hi there,
I was using POST method on all my forms but I had to change them to GET because of "expired page" errors (I noticed this as soon as I began using PHP4 sessions).
It seems that GET works well so far, but I wonder if there's something else I should be aware of. Are both methods equivalent?
TIA,
Jorge Alvarez
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
everything is working as it should. php handels its own garbage collection, when the script is over the file is deleted. you will have to copy or move the file somewhere. or just do something with it and allow php todo its ob and delete it when your done the script.
ecec("cp $file /somewhere/$file_name");
--Chris Lee lee
mediawaveonline.com
""Thalis A. Kalfigopoulos"" <thalis
cs.pitt.edu> wrote in message news:Pine.LNX.4.21.0103161556530.1486-100000
arsenic.cs.pitt.edu... Helloppl, a problem with a file_upload form :-( Here is what I've done so far:
File test.php which has the form is this: <HTML> <BODY> <?php include("handle_upload.php"); ?> <FORM ENCTYPE="multipart/form-data" ACTION="<?php print $PHP_SELF ?>" METHOD="POST"> <INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="64000"> <INPUT TYPE="submit" VALUE="go!"> <INPUT TYPE="file" NAME="up_file"> </FORM> </BODY> </HTML>
Here is the included php file (handle_upload.php): <?php if(isset($up_file)){ print "<P>You have succesfully sent the following file:<BR>\n"; print "path: $up_file<BR>\n"; print "filename: $up_file_name<BR>\n"; print "filesize: $up_file_size<BR>\n"; print "filetype: $up_file_type<BR>\n"; } ?>
When one submits a file (file exists and is within given MAX_FILE_SIZE boundaries), the handle_upload.php condition is true, so I get the following output in my browser:
You have succesfully sent the following file: path: /tmp/phpvtMKjj filename: test2.jpg filesize: 27365 filetype: image/jpeg <and again the form to upload another file>
Then I go and check under /tmp and I do not find anything :-(
I have in my php.ini: ;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;; file_uploads = On upload_tmp_dir = /tmp upload_max_filesize = 2M
I am using Apache 1.3.14 with DSO and php is a .so and Php is version 4.0.4
It is not a permissions problem cause I checked the Apache logs, and all dirs that need to be accessed are actually writable by the httpd user. I have read through "Handling file uploads" (http://www.php.net/manual/it/features.file-upload.php) and I don't see what is wrong :-(
thanks ins advance, thalis
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Would copy( $file, "somewhare/$file" ) be more platform independent?
-- ben.2.edwardsbt.com (ben
work untill end March) ben
videonetwork.org (ben
home)
> -----Original Message----- > From: Chris Lee [SMTP:lee
mediawaveonline.com] > Sent: Monday, March 19, 2001 2:38 PM > To: php-general
lists.php.net > Subject: Re: [PHP] FileUpload problematic > > everything is working as it should. php handels its own garbage > collection, when the script is over the file is deleted. you will have to > copy or move the file somewhere. or just do something with it and allow > php todo its ob and delete it when your done the script. > > ecec("cp $file /somewhere/$file_name"); > > > -- > > Chris Lee > lee
mediawaveonline.com > > > > ""Thalis A. Kalfigopoulos"" <thalis
cs.pitt.edu> wrote in message > news:Pine.LNX.4.21.0103161556530.1486-100000
arsenic.cs.pitt.edu... > Helloppl, > a problem with a file_upload form :-( Here is what I've done so far: > > File test.php which has the form is this: > <HTML> > <BODY> > <?php include("handle_upload.php"); ?> > <FORM ENCTYPE="multipart/form-data" ACTION="<?php print $PHP_SELF ?>" > METHOD="POST"> > <INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" > VALUE="64000"> > <INPUT TYPE="submit" VALUE="go!"> > <INPUT TYPE="file" NAME="up_file"> > </FORM> > </BODY> > </HTML> > > Here is the included php file (handle_upload.php): > <?php > if(isset($up_file)){ > print "<P>You have succesfully sent the following file:<BR>\n"; > print "path: $up_file<BR>\n"; > print "filename: $up_file_name<BR>\n"; > print "filesize: $up_file_size<BR>\n"; > print "filetype: $up_file_type<BR>\n"; > } > ?> > > When one submits a file (file exists and is within given MAX_FILE_SIZE > boundaries), the handle_upload.php condition is true, so I get the > following output in my browser: > > You have succesfully sent the following file: > path: /tmp/phpvtMKjj > filename: test2.jpg > filesize: 27365 > filetype: image/jpeg > <and again the form to upload another file> > > Then I go and check under /tmp and I do not find anything :-( > > I have in my php.ini: > ;;;;;;;;;;;;;;;; > ; File Uploads ; > ;;;;;;;;;;;;;;;; > file_uploads = On > upload_tmp_dir = /tmp > upload_max_filesize = 2M > > I am using Apache 1.3.14 with DSO and php is a .so and Php is version > 4.0.4 > > It is not a permissions problem cause I checked the Apache logs, and all > dirs that need to be accessed are actually writable by the httpd user. I > have read through "Handling file uploads" > (http://www.php.net/manual/it/features.file-upload.php) and I don't see > what is wrong :-( > > > thanks ins advance, > thalis > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net > For additional commands, e-mail: php-general-help
lists.php.net > To contact the list administrators, e-mail: php-list-admin
lists.php.net > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net > For additional commands, e-mail: php-general-help
lists.php.net > To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
what if you have three headers depending on what colors a user likes. this favorite color is stored in a session variable
$fav_color = 'blue_header';
<?php
function blue_header() { } function red_header() { } function green_header() { }
include_once('session.egn'); call_user_func($fav_color);
?>
there are obviously easier ways todo this, but its a simple example.
--Chris Lee lee
mediawaveonline.com
""Boget, Chris"" <Chris.Boget
wild.net> wrote in message news:4040BBE81A9AD411BD27009027887A7C042B75
tiger.wild.net... > http://www.php.net/manual/en/ref.funchand.php > This page must be your friends.
I took a look at this page (and all the functions referenced therein). While there must be a use for these functions otherwise they wouldn't have been included in PHP, I'm at a total loss as to why anyone would ever use them. Why wouldn't you just call the function (or do whatever) yourself? Could anyone offer some insight?
Chris
attached mail follows:
shame of me for asking that a stupid question, but i don't know how to remove an element off an associative array. can anybody please tell me, i didn't find anything about that in faqs or manuals.
thank you
-- alexalex-connect.com +49 9721 188848 +49 171 370 97 15
attached mail follows:
unset()
<?php $test[0] = 0; $test[1] = 1; $test[2] = 2; $test[3] = 3;
foreach($test as $pos => $val) echo "$val<br>";
unset($test[2]);
foreach($test as $pos => $val) echo "$val<br>"; ?>
--Chris Lee lee
mediawaveonline.com
""Alexander Gräf"" <alex
alex-connect.com> wrote in message news:995d13$cfl$1
toye.p.sourceforge.net...
shame of me for asking that a stupid question, but i don't know how to remove an element off an associative array. can anybody please tell me, i didn't find anything about that in faqs or manuals.
thank you
-- alex
alex-connect.com +49 9721 188848 +49 171 370 97 15
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
alex
if you're looking for a pop function, try array_pop.....if you just want to remove an item and then compact the array, i believe you'll have to hack together something yourself....check the mailing list archives...... http://marc.theaimsgroup.com/?l=php-general&r=1&w=2
jack
-----Original Message-----
From: Alexander Gräf [mailto:alex
alex-connect.com]
Sent: Monday, March 19, 2001 11:49 AM
To: php-general
lists.php.net
Subject: [PHP] removing element from array
shame of me for asking that a stupid question, but i don't know how to remove an element off an associative array. can anybody please tell me, i didn't find anything about that in faqs or manuals.
thank you
-- alexalex-connect.com +49 9721 188848 +49 171 370 97 15
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
55 projects found for query 'odbc'
Most of these are simply projects that have the word ODBC in their description someplace. There seem to be only a handful of libraries, and some (openlink/easysoft) are commercial offerings.
I still have not come across any ODBC driver that I can get a binary or source for, which is free, that I can compile under Linux to talk ODBC to databases.
What am I missing? I don't think I'm missing anything. I don't think any are out there - freetds was going to be working on something, I thought, but apparently that got delayed/shelved.
Yoshi Melrose wrote:
> have you tried out http://freshmeat.net ? do a search for odbc, you'll find
> a few. :)
>
> ----- Original Message -----
> From: "Michael Kimsal" <michael
tapinternet.com>
> To: <php-general
lists.php.net>
> Sent: Monday, March 19, 2001 9:01 AM
> Subject: Re: [PHP] MS SQL databse connecting
>
> > Am I the only one who can not find any free ODBC drivers for Linux?
> > I see countless references to ODBC driver managers, but no ODBC drivers
> > themselves - not free ones anyway.
> >
attached mail follows:
I know i had one. I used one for a project I had in php.... I'll look for it and see if I can get it to you. Hmmm.
----- Original Message -----
From: "Michael Kimsal" <michael
tapinternet.com>
To: "Yoshi Melrose" <webmaster
validus.com>
Cc: <php-general
lists.php.net>
Sent: Monday, March 19, 2001 10:54 AM
Subject: Re: [PHP] MS SQL databse connecting
> 55 projects found for query 'odbc'
>
> Most of these are simply projects that have the word ODBC
> in their description someplace. There seem to be only a handful
> of libraries, and some (openlink/easysoft) are commercial
> offerings.
>
> I still have not come across any ODBC driver that I can get
> a binary or source for, which is free, that I can compile under
> Linux to talk ODBC to databases.
>
> What am I missing? I don't think I'm missing anything. I don't think
> any are out there - freetds was going to be working on something,
> I thought, but apparently that got delayed/shelved.
>
>
>
>
>
> Yoshi Melrose wrote:
>
> > have you tried out http://freshmeat.net ? do a search for odbc, you'll
find
> > a few. :)
> >
> > ----- Original Message -----
> > From: "Michael Kimsal" <michael
tapinternet.com>
> > To: <php-general
lists.php.net>
> > Sent: Monday, March 19, 2001 9:01 AM
> > Subject: Re: [PHP] MS SQL databse connecting
> >
> > > Am I the only one who can not find any free ODBC drivers for Linux?
> > > I see countless references to ODBC driver managers, but no ODBC
drivers
> > > themselves - not free ones anyway.
> > >
>
>
attached mail follows:
Yoshi,
Regardless if you use a commercial or free driver, the only thing you need to compile with is iODBC, as a Driver Manager. You can then drop in any ODBC-compliant driver fairly seamlessly. A Howto is available at www.iodbc.org, but it's mostly a matter of getting the iODBC SDK and compiling --with-iodbc.
Also, while our drivers are not Open Source, they are free for low-use environments (2 concurrent database connections).
Please let me know if I may assist in any way.
Best regards, Andrew --------------------------------------- Andrew Hill - OpenLink Software Director Technology Evangelism eBusiness Infrastructure Technology http://www.openlinksw.com
On 3/19/01 11:54 AM, "Michael Kimsal" <michael
tapinternet.com> wrote:
> 55 projects found for query 'odbc'
>
> Most of these are simply projects that have the word ODBC
> in their description someplace. There seem to be only a handful
> of libraries, and some (openlink/easysoft) are commercial
> offerings.
>
> I still have not come across any ODBC driver that I can get
> a binary or source for, which is free, that I can compile under
> Linux to talk ODBC to databases.
>
> What am I missing? I don't think I'm missing anything. I don't think
> any are out there - freetds was going to be working on something,
> I thought, but apparently that got delayed/shelved.
>
>
>
>
>
> Yoshi Melrose wrote:
>
>> have you tried out http://freshmeat.net ? do a search for odbc, you'll find
>> a few. :)
>>
>> ----- Original Message -----
>> From: "Michael Kimsal" <michael
tapinternet.com>
>> To: <php-general
lists.php.net>
>> Sent: Monday, March 19, 2001 9:01 AM
>> Subject: Re: [PHP] MS SQL databse connecting
>>
>>> Am I the only one who can not find any free ODBC drivers for Linux?
>>> I see countless references to ODBC driver managers, but no ODBC drivers
>>> themselves - not free ones anyway.
>>>
>
attached mail follows:
Whups, sorry - looks like that should have been addressed to Michael.
Best regards, Andrew
On 3/19/01 12:13 PM, "Andrew Hill" <ahill
openlinksw.com> wrote:
> Yoshi,
>
> Regardless if you use a commercial or free driver, the only thing you need to
> compile with is iODBC, as a Driver Manager. You can then drop in any
> ODBC-compliant driver fairly seamlessly. A Howto is available at
> www.iodbc.org, but it's mostly a matter of getting the iODBC SDK and compiling
> --with-iodbc.
>
> Also, while our drivers are not Open Source, they are free for low-use
> environments (2 concurrent database connections).
>
> Please let me know if I may assist in any way.
>
> Best regards,
> Andrew
> ---------------------------------------
> Andrew Hill - OpenLink Software
> Director Technology Evangelism
> eBusiness Infrastructure Technology
> http://www.openlinksw.com
>
>
> On 3/19/01 11:54 AM, "Michael Kimsal" <michael
tapinternet.com> wrote:
>
>> 55 projects found for query 'odbc'
>>
>> Most of these are simply projects that have the word ODBC
>> in their description someplace. There seem to be only a handful
>> of libraries, and some (openlink/easysoft) are commercial
>> offerings.
>>
>> I still have not come across any ODBC driver that I can get
>> a binary or source for, which is free, that I can compile under
>> Linux to talk ODBC to databases.
>>
>> What am I missing? I don't think I'm missing anything. I don't think
>> any are out there - freetds was going to be working on something,
>> I thought, but apparently that got delayed/shelved.
>>
>>
>>
>>
>>
>> Yoshi Melrose wrote:
>>
>>> have you tried out http://freshmeat.net ? do a search for odbc, you'll find
>>> a few. :)
>>>
>>> ----- Original Message -----
>>> From: "Michael Kimsal" <michael
tapinternet.com>
>>> To: <php-general
lists.php.net>
>>> Sent: Monday, March 19, 2001 9:01 AM
>>> Subject: Re: [PHP] MS SQL databse connecting
>>>
>>>> Am I the only one who can not find any free ODBC drivers for Linux?
>>>> I see countless references to ODBC driver managers, but no ODBC drivers
>>>> themselves - not free ones anyway.
>>>>
>>
attached mail follows:
That's it, Thank you Andrew, I knew I had it somewhere.
Michael, this is where you want to go, Andrew hit the nail right on the head!
----- Original Message -----
From: "Andrew Hill" <ahill
openlinksw.com>
To: "Yoshi Melrose" <webmaster
validus.com>
Cc: <php-general
lists.php.net>
Sent: Monday, March 19, 2001 11:13 AM
Subject: Re: [PHP] MS SQL databse connecting
> Yoshi,
>
> Regardless if you use a commercial or free driver, the only thing you need
> to compile with is iODBC, as a Driver Manager. You can then drop in any
> ODBC-compliant driver fairly seamlessly. A Howto is available at
> www.iodbc.org, but it's mostly a matter of getting the iODBC SDK and
> compiling --with-iodbc.
>
> Also, while our drivers are not Open Source, they are free for low-use
> environments (2 concurrent database connections).
>
> Please let me know if I may assist in any way.
>
> Best regards,
> Andrew
> ---------------------------------------
> Andrew Hill - OpenLink Software
> Director Technology Evangelism
> eBusiness Infrastructure Technology
> http://www.openlinksw.com
>
>
> On 3/19/01 11:54 AM, "Michael Kimsal" <michael
tapinternet.com> wrote:
>
> > 55 projects found for query 'odbc'
> >
> > Most of these are simply projects that have the word ODBC
> > in their description someplace. There seem to be only a handful
> > of libraries, and some (openlink/easysoft) are commercial
> > offerings.
> >
> > I still have not come across any ODBC driver that I can get
> > a binary or source for, which is free, that I can compile under
> > Linux to talk ODBC to databases.
> >
> > What am I missing? I don't think I'm missing anything. I don't think
> > any are out there - freetds was going to be working on something,
> > I thought, but apparently that got delayed/shelved.
> >
> >
> >
> >
> >
> > Yoshi Melrose wrote:
> >
> >> have you tried out http://freshmeat.net ? do a search for odbc, you'll
find
> >> a few. :)
> >>
> >> ----- Original Message -----
> >> From: "Michael Kimsal" <michael
tapinternet.com>
> >> To: <php-general
lists.php.net>
> >> Sent: Monday, March 19, 2001 9:01 AM
> >> Subject: Re: [PHP] MS SQL databse connecting
> >>
> >>> Am I the only one who can not find any free ODBC drivers for Linux?
> >>> I see countless references to ODBC driver managers, but no ODBC
drivers
> >>> themselves - not free ones anyway.
> >>>
> >
>
>
attached mail follows:
We knew what you mean. ;)
----- Original Message -----
From: "Andrew Hill" <ahill
openlinksw.com>
To: "Yoshi Melrose" <webmaster
validus.com>; "Work"
<michael
tapinternet.com>
Cc: <php-general
lists.php.net>
Sent: Monday, March 19, 2001 11:14 AM
Subject: Re: [PHP] MS SQL databse connecting
> Whups, sorry - looks like that should have been addressed to Michael.
>
> Best regards,
> Andrew
>
> On 3/19/01 12:13 PM, "Andrew Hill" <ahill
openlinksw.com> wrote:
>
> > Yoshi,
> >
> > Regardless if you use a commercial or free driver, the only thing you
need to
> > compile with is iODBC, as a Driver Manager. You can then drop in any
> > ODBC-compliant driver fairly seamlessly. A Howto is available at
> > www.iodbc.org, but it's mostly a matter of getting the iODBC SDK and
compiling
> > --with-iodbc.
> >
> > Also, while our drivers are not Open Source, they are free for low-use
> > environments (2 concurrent database connections).
> >
> > Please let me know if I may assist in any way.
> >
> > Best regards,
> > Andrew
> > ---------------------------------------
> > Andrew Hill - OpenLink Software
> > Director Technology Evangelism
> > eBusiness Infrastructure Technology
> > http://www.openlinksw.com
> >
> >
> > On 3/19/01 11:54 AM, "Michael Kimsal" <michael
tapinternet.com> wrote:
> >
> >> 55 projects found for query 'odbc'
> >>
> >> Most of these are simply projects that have the word ODBC
> >> in their description someplace. There seem to be only a handful
> >> of libraries, and some (openlink/easysoft) are commercial
> >> offerings.
> >>
> >> I still have not come across any ODBC driver that I can get
> >> a binary or source for, which is free, that I can compile under
> >> Linux to talk ODBC to databases.
> >>
> >> What am I missing? I don't think I'm missing anything. I don't think
> >> any are out there - freetds was going to be working on something,
> >> I thought, but apparently that got delayed/shelved.
> >>
> >>
> >>
> >>
> >>
> >> Yoshi Melrose wrote:
> >>
> >>> have you tried out http://freshmeat.net ? do a search for odbc, you'll
find
> >>> a few. :)
> >>>
> >>> ----- Original Message -----
> >>> From: "Michael Kimsal" <michael
tapinternet.com>
> >>> To: <php-general
lists.php.net>
> >>> Sent: Monday, March 19, 2001 9:01 AM
> >>> Subject: Re: [PHP] MS SQL databse connecting
> >>>
> >>>> Am I the only one who can not find any free ODBC drivers for Linux?
> >>>> I see countless references to ODBC driver managers, but no ODBC
drivers
> >>>> themselves - not free ones anyway.
> >>>>
> >>
>
>
attached mail follows:
Hi there I am trying to get the scriplet code from http://www.phpwizard.net/resources/phpMisc/scripts/pretty/mail.php3
to work for a website I'm building. I am trying to allow a user to select a file from their hard
drive, and then have that file sent as an email attachment. Most of the time that file will be a Microsoft Word document. I have the code for the file selection all done, and I integrated the codelet (THANK YOU) into my code, and when I attach a .jpg file, it works fine, but if I choose a word doc, it attaches what it thinks is an image. I changed the line $mail->add_attachment("$attachment", $copy_filename, "application/msword"); to reflect the mime type for application/msword, but it still doesn't work. What suggestions might you have?
url to see it in action http://www.emergejobs.com/jen/jen_file_upload.phtml
the submit script that does the file upload then the email send is below. thank you SO MUCH -jen .
----- jen_file_upload_submit.phtml:
<html><head><title>Jen's file upload module</title></head> <BODY bgcolor="#666699" link="#FF9933" text="#FFFFFF" vlink="#FF8040"> <font face="arial, helvetica, sans-serif"> <P><h1>file upload</h1><P>
<?php $directory_to_copy_to = "/home/web/e/emerge/virtual_html/jen/";
function is_uploaded_file($filename) { if (!$tmp_file = get_cfg_var('upload_tmp_dir')) { $tmp_file = dirname(tempnam('', '')); } $tmp_file .= '/' . basename($filename); /* User might have trailing slash in php.ini... */ return (ereg_replace('/+', '/', $tmp_file) == $filename); }
if (is_uploaded_file($userfile)) { $clean_filename = ereg_replace(" ","_",$userfile_name); $clean_filename = strtoupper($clean_filename); $copy_filename = $directory_to_copy_to . $clean_filename; copy($userfile, $copy_filename); unlink($userfile); echo "<P>you uploaded $userfile, <P>this script just renamed it (and made it all caps) to $clean_filename <P>and copied it to $copy_filename"; } else { echo "ERROR there was an error uploading the file: '$userfile' ($userfile_name)."; }
/*
* Class mime_mail
* Original implementation by
Sascha Schumann <sascha
schumann.cx>
* Modified by Tobias Ratschiller
<tobias
dnet.it>:
* - General code clean-up
* - separate body- and
from-property
* - killed some mostly
un-necessary stuff
*/
class mime_mail { var $parts; var $to; var $from; var $headers; var $subject; var $body;
/* * void mime_mail() * class constructor */ function mime_mail() { $this->parts = array(); $this->to = ""; $this->from = ""; $this->subject = ""; $this->body = ""; $this->headers = ""; }
/* * void add_attachment(string message, [string name], [string ctype]) * Add an attachment to the mail object */ function add_attachment($message, $name = "", $ctype = "application/octet-stream") { $this->parts[] = array ( "ctype" => $ctype,
"message" => $message, "encode"
=> $encode, "name" => $name ); }
/* * void build_message(array part= * Build message parts of an multipart mail */ function build_message($part) { $message = $part[ "message"]; $message = chunk_split(base64_encode($message)); $encoding = "base64"; return "Content-Type: ".$part[ "ctype"]. ($part[ "name"]? "; name = \"".$part[ "name"]. "\"" : "").
"\nContent-Transfer-Encoding: $encoding\n\n$message\n"; }
/* * void build_multipart() * Build a multipart mail */ function build_multipart() { $boundary = "b".md5(uniqid(time())); $multipart = "Content-Type: multipart/mixed; boundary = $boundary\n\nThis is a MIME encoded message.\n\n--$boundary";
for($i = sizeof($this->parts)-1; $i >= 0; $i--) { $multipart .= "\n".$this->build_message($this->parts[$i]). "--$boundary"; } return $multipart.= "--\n"; }
/* * void send() * Send the mail (last class-function to be called) */ function send() { $mime = ""; if (!empty($this->from)) $mime .= "From: ".$this->from.
"\n"; if (!empty($this->headers)) $mime .= $this->headers. "\n";
if (!empty($this->body))
$this->add_attachment($this->body, "", "text/plain"); $mime .= "MIME-Version: 1.0\n".$this->build_multipart(); mail($this->to, $this->subject, "", $mime); } }; // end of class
/* * Example usage */
$attachment = fread(fopen($copy_filename, "r"), filesize($copy_filename));
$mail = new mime_mail();
$mail->from =
"jen
jenhallonline.com";
$mail->headers = "Errors-To:
jen
jenhallonline.com";
$mail->to =
"jhall
conovertuttle.com";
$mail->subject = "Testing email
attachment...";
$mail->body = "This is just a
test.";
$mail->add_attachment("$attachment", $copy_filename, "application/msword"); $mail->send();
?> <P>end of script. </body></html>
attached mail follows:
Hi,
please note: You can *not* fetch results that require earlier results using the pg_* functions. Explaination: when you submit a query the php script doesn't know about the content of all rows returned, instead the interface API makes use of pointers to fetch only the requested rows from the result.
That said, if you make a second call to pg_exec() consider saving all the results somewhere else if you need the previous set of results.
Regards, Nuno Silva
Luca Lazzeroni wrote:
> Thanks; in fact I've tryed the second solution and it works for me; but I
> can't understand why the script stop working during the upgrade of system.
> The most strange thing is that, after a deeper investigation on the code,
> I've found the PHP engine does something like closing the connection after
> the second pg_exec command.
> In fact, by using persistent connections I've partially corrected the
> problem and the codes doesn't complain about using an invalid (but not null)
> connection descriptor; but it stills be unable to get results from
> successive queries, also if result index are valid ! This sounds very
> strange for me.
>
> Thank you for your help !
>
> Luca Lazzeroni
>
> "Nuno Silva" <nuno_silva
websolut.net> ha scritto nel messaggio
> news:3AB4ED18.80603
websolut.net...
>
>> Hello,
>>
>> if the second query loops inside a _for_ statement and needs values from
>> the first query you have two options:
>>
>> 1. save all the results from query one to some array and then loop
>> inside the array within the _for_ statement executing new sql;
>> 2. open two separate connections to the database and work with the two.
>> like this:
>> $conn1 = pg_connect(...);
>> $conn2 = pg_connect(...);
>> ...
>> qry1 = pg_exec($conn1, $sql1);
>> ...
>> for ($i=.....) {
>> ...
>> $qry2 = pg_exec($conn2, $sql2);
>> ...
>> }
>>
>> Hope this helps,
>> Nuno Silva
>>
>>
>> Luca Lazzeroni wrote:
>>
>>
>>> Hi,
>>> I've recently migrated a system with PHP 4.0.3pl1 and PostgreSQL 7.0.2 -
>>> RedHat Linux 5.1 (yes 5) to a new one with PHP 4.0.4pl1 - PostgreSQL
>>
> 7.0.2 -
>
>>> RedHat Linux 7.0.
>>>
>>> All my database applications work fine except one which does strange
>>
> things:
>
>>> this is a piece of code:
>>>
>>> ----8<------- CUT ----
>>>
>>> $conn = pg_connect("dbname=aaaa user=yyyyy password=xxxxxx");
>>>
>>> $sql = "select * from table_a where condition_a";
>>> $qry1 = pg_exec ($conn,$sql);
>>>
>>> $obj1 = pg_fetchobject($qry1,0);
>>>
>>> // Until here everything works fine
>>>
>>> $sql2 = "select * from table_b where condition_b=".$obj1->value_a;
>>> $qry2 = pg_exec ($conn,$sql2);
>>>
>>> ----8<------- CUT ----
>>>
>>> The second query is nested in a for-loop running for every object in the
>>> first query; for performance reason I need to maintain the two queries
>>> independent.
>>>
>>> After executing (correctly) the first one, the system starts doing
>>
> strange
>
>>> things with the second one:
>>>
>>> Warning: Unable to jump to row 0 on PostgreSQL result index 23 in
>>
> cerca.php3
>
>>> on line 467
>>>
>>> and it fails to read data.
>>> The strange thing is that the system does the same things for EVERY
>>
> database
>
>>> where I must use two consecutive queries !
>>>
>>> Is there anyone who can help me ?
>>>
>>> Thanks in advance
>>>
>>> Luca Lazzeroni
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
>> For additional commands, e-mail: php-general-help
lists.php.net
>> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>>
attached mail follows:
I want to insert the Values into my Database like this
$handle = ora_logon("iusr
test","kiwi1");
$cursor1 = ora_open($handle);
$query = "insert into internet_tmp select
rv_ret($FF),$FF,$sesid,(sysdate+0.0021) from dual";
ora_parse($cursor1,$query) or die;
ora_exec($cursor1);
ora_close($cursor1);
tring the insert query on sql-plus works fine what do I do wrong??
oh yea error msg is like this Warning: Ora_Parse failed (ORA-00923: FROM keyword not found where expected -- while processing OCI function OPARSE) in test2.php on line 40
line40 is parse line
plaese help is very urgent rudi
attached mail follows:
On Tue, 20 Mar 2001 03:32, Rudolf Frint wrote:
> > I want to insert the Values into my Database like this
>
> $handle = ora_logon("iusr
test","kiwi1");
> $cursor1 = ora_open($handle);
> $query = "insert into internet_tmp select
> rv_ret($FF),$FF,$sesid,(sysdate+0.0021) from dual";
> ora_parse($cursor1,$query) or die;
> ora_exec($cursor1);
> ora_close($cursor1);
>
> tring the insert query on sql-plus works fine what do I do wrong??
>
> oh yea error msg is like this
> Warning: Ora_Parse failed (ORA-00923: FROM keyword not found where
> expected -- while processing OCI function OPARSE) in test2.php on line
> 40
>
> line40 is parse line
>
> plaese help is very urgent
> rudi
I'm not an Oracle person, but it sounds like you may have a syntax error in your SQL. Try echo-ing $query and see how it looks.
-- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA
attached mail follows:
On Tue, 20 Mar 2001, David Robley wrote:
> On Tue, 20 Mar 2001 03:32, Rudolf Frint wrote:
>
> > > I want to insert the Values into my Database like this
> >
> > $handle = ora_logon("iusr
test","kiwi1");
> > $cursor1 = ora_open($handle);
> > $query = "insert into internet_tmp select
> > rv_ret($FF),$FF,$sesid,(sysdate+0.0021) from dual";
> > ora_parse($cursor1,$query) or die;
> > ora_exec($cursor1);
> > ora_close($cursor1);
> >
> > tring the insert query on sql-plus works fine what do I do wrong??
> >
> > oh yea error msg is like this
> > Warning: Ora_Parse failed (ORA-00923: FROM keyword not found where
> > expected -- while processing OCI function OPARSE) in test2.php on line
> > 40
> >
> > line40 is parse line
> >
> > plaese help is very urgent
> > rudi
>
> I'm not an Oracle person, but it sounds like you may have a syntax error
> in your SQL. Try echo-ing $query and see how it looks.
>
> --
> David Robley | WEBMASTER & Mail List Admin
> RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
> AusEinet | http://auseinet.flinders.edu.au/
> Flinders University, ADELAIDE, SOUTH AUSTRALIA
>
I've had a few troubles with PHP/MySQL with requests like that... Maybe you could try that (it worked for me) :
$query = "insert into internet_tmp select rv_ret(\"$FF\"),\"$FF\",$sesid,(sysdate+0.0021) from dual";
the \"$var\" are important : ".$var." won't do, even if with an echo $query, you _seem_ to get the same results...
-- Ben As well look for a needle in a bottle of hay. Miguel de Cervantes
attached mail follows:
Hello all, hope that everyone had a nice weekend. I'm new to this form. I am about to install mysql, apache, and php on my linux box (redhat 7)
I went to the php site, but I'm a little bit lost. I found this link on there but I dont know if thats the way I have to set it up . I'm setting all these program for creating a Admin ticket . Heres the site just in case you guys like to take a look at. I found the site in the dec issue of linux Joarnal . http://wwredshift.com/~yramin/atp/irm
Not my question is. Would this be the right way of setting up php , mysql , and php . Can anyone check this site out for me. http://www.linuxguruz.org/z.php?id=31
also can you please tell me on the section were you ./configure the php . Would I be using the apxs setting or the red hat . Im' sorry if its a stupid question but I'm new to all this php thing.
Thank you
Luis
attached mail follows:
Hi,
My site has been working with cookies just fine .... until i discovered that some browsers (i think it is some browser under MacOS, I'm investigating) instead of deleting a cookie, set it to value "deleted", so in my code this variable has a value and believes there is a user called "deleted" trying to reauth..... a lot users can't login to my site ater their session times out due to this cause.... My question is, I am dealing with some new bug of explorer or there is a standard I am missing? Should I implement in my code this feature doing with "deleted" cookies? Or maybe it's a php bug? I run php-4.0.4pl1 ....
Thanks in advance
Nikolai
attached mail follows:
hello list, <