OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general-digest-help_at_lists.php.net
Date: Wed Jan 15 2003 - 07:42:26 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    php-general Digest 15 Jan 2003 13:42:26 -0000 Issue 1824

    Topics (messages 131642 through 131700):

    Re: Next and Previous
            131642 by: Matt
            131645 by: Miguel Brás

    Re: PHP & RTF
            131643 by: [-^-!-%-
            131647 by: Jason Reid

    Re: emptying hte array??
            131644 by: Jason k Larson

    Re: attach image with the mail command?
            131646 by: Rick Emery
            131655 by: Manuel Lemos

    Advanced Search
            131648 by: rw.xend.net
            131650 by: Andrew Brampton
            131651 by: Jean-Christian Imbeault

    Re: Trapping PHP errors
            131649 by: Jean-Christian Imbeault
            131656 by: Michael Sims

    Gotchas with Php and Postgresql?
            131652 by: John Wells
            131657 by: Jason k Larson

    Setcookie() and header()
            131653 by: J. Alden Gillespy
            131658 by: Jason k Larson
            131660 by: Michael Sims
            131661 by: J. Alden Gillespy
            131663 by: Michael Sims

    Re: Favorite Email validation routine?
            131654 by: Daevid Vincent

    Calendar problem
            131659 by: menezesd

    Save Dialog
            131662 by: Richard Rojas

    update more "same" fields at the same time
            131664 by: Simon
            131666 by: Chris Hayes
            131667 by: Simon
            131668 by: Giannis Vrentzos
            131669 by: Simon
            131678 by: Giannis Vrentzos
            131680 by: Giannis Vrentzos
            131682 by: Simon
            131684 by: Giannis Vrentzos
            131686 by: Simon
            131698 by: Giannis Vrentzos

    Re: Persistent global data ?
            131665 by: Mathias Rockel

    Question about $_GET
            131670 by: Frank Keessen
            131671 by: Danny Shepherd
            131672 by: Marek Kilimajer
            131673 by: Frank Keessen
            131674 by: Jason k Larson
            131675 by: Jason k Larson
            131676 by: Chris Hayes
            131677 by: Marek Kilimajer
            131681 by: TomH
            131683 by: Jason Wong
            131685 by: Rick Emery

    Re: MySQL problem with RedHat 8
            131679 by: Daniel Elenius

    dynamic variables in a while loop?
            131687 by: Philipp Hartmann
            131690 by: Rick Emery
            131693 by: Ford, Mike [LSS]
            131700 by: Philipp Hartmann

    Can someone help me with this code please?
            131688 by: Phil Powell

    sending array
            131689 by: Danielle van Gladbach
            131691 by: Rick Emery
            131692 by: Jason Wong
            131694 by: Foong
            131695 by: Danielle van Gladbach
            131696 by: Mark Charette

    php obj -> xml ?
            131697 by: neko

    PHP/Flash Dynamic Graphs?
            131699 by: MH

    Administrivia:

    To subscribe to the digest, e-mail:
            php-general-digest-subscribelists.php.net

    To unsubscribe from the digest, e-mail:
            php-general-digest-unsubscribelists.php.net

    To post to the list, e-mail:
            php-generallists.php.net

    ----------------------------------------------------------------------

    attached mail follows:


    >"Miguel Brás" <molino26netcabo.pt> wrote in message
    news:20030115012159.51386.qmailpb1.pair.com...
    > That's not the case, I tested it on ID549 and the previous one should be
    548 and he still assume -1

    Works for me. Are you adding the ?ID=500 to the url? If you don't have
    that, then the ID is 0, so you get the 1 and -1.

    attached mail follows:


    Let's see

    i solved thhe problem...
    I did <? echo $ID-1; ?> since I was making the select with WHERE ID = '$ID'
    so I get the var $ID.,

    Thx for the help of all

    Miguel
    "Matt" <mschroebelepooch.com> escreveu na mensagem
    news:034901c2bc37$41429160$299aa8c0epooch.com...
    > >"Miguel Brás" <molino26netcabo.pt> wrote in message
    > news:20030115012159.51386.qmailpb1.pair.com...
    > > That's not the case, I tested it on ID549 and the previous one should be
    > 548 and he still assume -1
    >
    > Works for me. Are you adding the ?ID=500 to the url? If you don't have
    > that, then the ID is 0, so you get the 1 and -1.
    >
    >

    attached mail follows:


    Thanks, Michael. I'll look into it.
    -john

    =P e p i e D e s i g n s
     www.pepiedesigns.com
     Providing Solutions That Increase Productivity

     Web Developement. Database. Hosting. Multimedia.

    On Wed, 15 Jan 2003, Michael Hall wrote:

    > I don't know how much use this is for your needs, but I have found Openjade and
    > DocBook to be excellent tools for creating RTF files from XML sources. PHP can
    > be the scripting language used to tie things together, manipulate HTML/XML etc,
    > but basically this solution is "outside" of PHP I suppose.
    >
    > Mick
    >
    > Quoting "[-^-!-%-" <monfortkahuna.sdsu.edu>:
    >
    > >
    > > For those of you with experience in using php for RTF documents.
    > >
    > > I need help generating RTF Style tags from PHP. I can convert regular text
    > > to an RTF document, but the document will
    > > display RTF Style tags as regular text (in the RTF document).
    > >
    > > How do I make the RTF document recognize the RTF Style tags.
    > >
    > > Any help with code samples, tutorials and/or references, will be greatly
    > > appreciated.
    > >
    > > -john
    > >
    > > =P e p i e D e s i g n s
    > > www.pepiedesigns.com
    > > Providing Solutions That Increase Productivity
    > >
    > > Web Developement. Database. Hosting. Multimedia.
    > >
    > >
    > >
    > > --
    > > PHP General Mailing List (http://www.php.net/)
    > > To unsubscribe, visit: http://www.php.net/unsub.php
    > >
    >
    >
    > --
    > ----------------------------------------------------
    > MICHAEL HALL Web Development Officer
    > Batchelor Institute of Indigenous Tertiary Education
    > W: mick.hallnt.gov.au (08) 8951 8352
    > H: nintininti.com (08) 8953 1442
    > ----------------------------------------------------
    >

    attached mail follows:


    http://www.phpbuilder.com/columns/nair20020523.php3

    Looked fairly good when I read thru it a while back. Hope that it might be
    able to help.

    Jason Reid
    jasonachost.ca

    --
    AC Host Canada
    www.achost.ca
    

    ----- Original Message ----- From: "[-^-!-%-" <monfortengineering.sdsu.edu> To: <php-generallists.php.net> Sent: Tuesday, January 14, 2003 5:53 PM Subject: [PHP] PHP & RTF

    > > For those of you with experience in using php for RTF documents. > > I need help generating RTF Style tags from PHP. I can convert regular text > to an RTF document, but the document will > display RTF Style tags as regular text (in the RTF document). > > How do I make the RTF document recognize the RTF Style tags. > > Any help with code samples, tutorials and/or references, will be greatly > appreciated. > > -john > > =P e p i e D e s i g n s > www.pepiedesigns.com > Providing Solutions That Increase Productivity > > Web Developement. Database. Hosting. Multimedia. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    That's not going to 'empty' the array it's going to undefine it. Just overwrite the array with a new empty array like:

    $a = array();

    That keeps the variable an array variable type and is of course empty.

    HTH, Jason k Larson

    Justin French wrote:

    > on 15/01/03 7:52 AM, Scott Fletcher (scottabcoa.com) wrote: > > > >How to do the proper way of emptying hte array?? > > > >Example... > > > >$a[0] = "test1"; > >$a[1] = "test2"; > >$a[2] = "test3"; > >$a[3] = "test4"; > > > >$a = ""; <-- Is this hte proper way to do it???? > > > unset($a); > > http://php.net/unset > > Justin

    attached mail follows:


    this class will do all the work you need:

    instantiate with CMIMEMail() then attach with attachfile() add body with makebody() send with send() ============================= /* * Notes from rozhikziet.zhitomir.ua 25 Mar 2000: * This library based idea of Dan Potter * Improvements: Multi attachmends in one e-mail, ability to post html & plain trext, up to 3x spe ed improved. * USSAGE - mimetype example for attacment * $m = new CMIMEMail($to,$from,$subject); * $m->mailbody("This is simply text","<html><body><h1>This is HTML text</h1>"); * $m->attach("example.html","text/html",$filebody); * $m->attachFile("resume.gif","image/gif"); * $m->send(); * NOTE: if your system have chunk_split function use it. ******* * To Do: * 1. Make quoted-printable encoder and use them in makebody; * 2. Generate right boundaries * 3. Fix bugs in SMTP send direct futction SMTPsend() */

    function my_chunk_split($str) { $stmp = base64_encode($str); $len = strlen($stmp); $out = ""; $done=0; while( $done<$len ) { $out.=( $len-$done>76)?substr($strp,$done, 76). "\r\n":substr($strp,$done, $len-$done). "\r \n"; $done+=76;

    } return $out; }

    class CMIMEMail { var $to; var $from; var $cc; var $bcc; var $subject; var $boundary = "----=_NextPart_000_0009_01BF95E9.CDFD2060"; var $smtp_headers; var $filename_real; var $body_plain; var $body_html; var $atcmnt; var $atcmnt_type; function CMIMEMail($to,$from,$subject,$cc="",$bcc="",$priority=3) { $this->to=$to; $this->from=$from; $this->subject=$subject; $this->priority=$priority; $this->cc=$cc; $this->bcc=$bcc; } function mailbody( $plain, $html= "" ) { $this->body_plain=$plain; $this->body_html=$html; } function attach( $name, $content_type, $data ) { $this->atcmnt[$name]=$data; $this->atcmnt_type[$name]=$content_type; } function attachfile( $fname, $content_type ) { $name=ereg_replace( "(.+/)", "",$fname); $f=fopen($name, "r"); $fsz = filesize($name); $ftext = fread($f,$fsz); $this->attach($name,$content_type,$ftext); fclose($f); } function clear() { unset( $this->atcmnt ); unset( $this->atcmnt_type ); } function makeheader() { $out = "From: ".$this->from."\nReply-To: ".$this->from. "\n"; if( $this->cc !="") $out .="Cc: ".$this->cc."\n"; if( $this->bcc !="") $out .="Bcc: ".$this->bcc."\n"; $out.= "MIME-Version: 1.0\nContent-Type: multipart/mixed;\n boundary=\"".$this->boundary. "\"\ nX-Priority: ".$this->priority. "\n"; return $out; } function makebody() { $boundary2= "----=_NextPart_001_0009_01BF95E9.CDFD2060"; $out= ""; $out= "\n\n".$this->body_plain. "\n\n"; if( $this->body_html!= "" ) { $out.= "--".$this->boundary. "\nContent-Type: multipart/alternative;\n boundary=$boundary2\n \n"; $out.= "$body_plain\n--$boundary2\nContent-Type: text/plain\nContent-Transfer-Encoding: quot ed-printable\n\n".$this->body_plain. "\n\n--$boundary2\nContent-Type: text/html\n". "Content-Transfer-Encoding: quoted-printable\n\n$this->body_html\n\n--$boundary2--\n" ; } else { # $out.= "--".$this->boundary. "\nContent-Type: text/plain\nContent-Transfer-Encoding: quoted -printable\n\n".$this->body_plain. "\n\n--".$this->boundary. "\n"; $out.= "--".$this->boundary. "\nContent-Type: text/plain\nContent-Transfer-Encoding: quoted- printable\n\n".$this->body_plain. "\n\n"; } if( ISSET($this->atcmnt_type) ) { reset( $this->atcmnt_type); while( list($name, $content_type) = each($this->atcmnt_type) ) { $out.= "\n--".$this->boundary. "\nContent-Type: $content_type\nContent-Transfer-Encoding: ba se64\nContent-Disposition: attachment; filename=\"$name\"\n\n". chunk_split(base64_encode($this->atcmnt[$name])). "\n";

    } } $out.= "--".$this->boundary. "--\n"; return $out; } function send(){ mail( $this->to, $this->subject, $this->makebody(),$this->makeheader() ); } function sendto($email,$subj="#"){ if( $subj=="#") $subj= $this->subject; mail( $email, $subj, $this->makebody(),$this->makeheader() ); } function SMTPsend($host){ $errno=0;$errstr= ""; // $f=fsockopen("127.0.0.1",25,&$erno, &$errstr); if(!$f) { $this->send(); } else { //SNMP commands Not finished yet echo fgets($f,512); fputs($f, "HELO host.com\n"); echo fgets($f,512); fputs($f, "MAIL FROM: ".$this->from. "\n"); echo fgets($f,512); fputs($f, "RCPT TO: ".$this->to). "\n"; echo fgets($f,512); fputs($f, "data\n"); echo fgets($f,512); fputs($f, "From: ".$this->from. "\nTo: ".$this->to. "\n".$this->makeheader().$this->makebody (). "\n\n.\n"); fputs($f, "quit\nexit");

    fclose($f); } } } ?>

    ----- Original Message ----- From: <harald.mohringgmx.de> To: <> Sent: Tuesday, January 14, 2003 7:09 PM Subject: [PHP] attach image with the mail command?

    how can i attach an image with the mail command how do get the image in a variable when i have chosen it with the input type file?

    Harry

    -- 
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php
    

    attached mail follows:


    Hello,

    On 01/14/2003 11:09 PM, Harald Mohring wrote: > how can i attach an image with the mail command > how do get the image in a variable when i have chosen it with the input type > file?

    Do you mean attaching an image as a separate file or embed it in the message so it displays in HTML message?

    Either way, you may want to try this class:

    http://www.phpclasses.org/mimemessage

    -- 
    

    Regards, Manuel Lemos

    attached mail follows:


    Hello!

    Any quick solutions to this:

    if (!$city && !$sub_name && !$address && !$pool && !$waterfront && !$waterview && !$golf && !$type && !$beds) {$result = mysql_query("SELECT p.* FROM properties p ORDER by price asc;");} elseif (!$city && !$sub_name && !$address && !$pool && !$waterfront && !$waterview && !$golf && !$type) {$result = mysql_query("SELECT p.* FROM properties p WHERE beds >= $beds ORDER by price asc;");}

    I don't want to have to write 50 different ifelse statements unless I have to.

    Please show me the way to make the search more efficient.

    TIA

    RW

    attached mail follows:


    $sql = 'SELECT p.* FROM properties p WHERE '; if(isSet($city)) $sql .= 'city = "' . $city . '" AND '; if(isSet($sub_name )) $sql .= 'sub_name = "' . $sub_name . '" AND '; .... //Remove last AND and append 'ORDER by price asc' mysql_query($sql );

    Hope this helps Andrew

    ----- Original Message ----- From: <rwxend.net> To: <php-generallists.php.net> Sent: Wednesday, January 15, 2003 4:16 AM Subject: [PHP] Advanced Search

    > > Hello! > > Any quick solutions to this: > > if (!$city && !$sub_name && !$address && !$pool && !$waterfront && !$waterview > && !$golf && !$type && !$beds) > {$result = mysql_query("SELECT p.* FROM properties p ORDER by price asc;");} > elseif (!$city && !$sub_name && !$address && !$pool && !$waterfront && > !$waterview && !$golf && !$type) > {$result = mysql_query("SELECT p.* FROM properties p WHERE beds >= $beds ORDER > by price asc;");} > > I don't want to have to write 50 different ifelse statements unless I have to. > > Please show me the way to make the search more efficient. > > TIA > > RW > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    rwxend.net wrote: >

    > I don't want to have to write 50 different ifelse statements unless I have to.

    You can add all the boolean fileds in the query and not worry about doing if's to check them, the DB will automatically find the fields that match for boolean fields (just make sure to initialize all your booleans variables first). So

    SELECT p.* FROM properties p WHERE beds >= $beds AND pool='$pool' AND waterfront='$waterfront' AND [other booleans ...] ORDER by price asc;

    Jc

    attached mail follows:


    Michael Sims wrote: > > My site has a custom error handler (implemented via set_error_handler) > which sends a nicely formatted email including all of the error > details, a variable dump, the contents of the output buffer before the > error occured, and the contents of a call to debug_backtrace, in > addition to logging the error to a file.

    If it's not asking too much would you be willing to share that custome error handler you wrote?

    I'm in the process of writing one but wouldn't want to re-invent the wheel if I didn't have too :)

    Jc

    attached mail follows:


    On Wed, 15 Jan 2003 13:25:05 +0900, you wrote:

    >If it's not asking too much would you be willing to share that custome >error handler you wrote?

    It's a big long so I'm sending it to you off-list. If anyone else is interested just send me an email off list and I'll send you a copy...

    attached mail follows:


    I'm preparing for a large project in which I'm the sole designer/developer. I've just about made the decision to go with Postgresql, as part of the project is converting a MS Sql Server db to a open source db and I think Postgresql provides some features that will make this port easier.

    However, just wondering if there're any "gotchas" I need to consider here. I'm definitely using PHP to write the app, and I can attest to PHP's great support for mysql (used it many, many times), but I have no experience using it with Postgresql.

    While I suspect that it's just as easy to work with via PHP as is MySql, I'm looking for any hardened, trenches-earned wisdom anyone would like to bestow.

    Thanks very much.

    John

    attached mail follows:


    I'd have to say no regarding any "gotchas". I've been using mySQL, PostgreSQL, and Oracle via PHP interfaces and only mySQL and PostgreSQL have proved to work flawlessly. The Oracle stuff does work, but I find it lacking in some of the simple functionality that mySQL and Postgres offer.

    PHP uses Postgres' pglib for it's interface which puts the stability and compatability in Postgres' hands, which of course is the best possible thing to do. So you can rest assured that PHP knows how to talk to Postgres.

    HTH, Jason k Larson

    John Wells wrote:

    > I'm preparing for a large project in which I'm the sole > designer/developer. I've just about made the decision to go with > Postgresql, as part of the project is converting a MS Sql Server db to a > open source db and I think Postgresql provides some features that will > make this port easier. > > However, just wondering if there're any "gotchas" I need to consider here. > I'm definitely using PHP to write the app, and I can attest to PHP's > great support for mysql (used it many, many times), but I have no > experience using it with Postgresql. > > While I suspect that it's just as easy to work with via PHP as is MySql, > I'm looking for any hardened, trenches-earned wisdom anyone would like to > bestow. > > Thanks very much. > > John

    attached mail follows:


    After I set a cookie and then send a redirect header, the cookie doesn't show up, but the browser successfully redirects.

    setcookie("test", "blahblah", time() + 1440); header("Location: http://www.mywebsite.com/login.php");

    However, if I take out the header() statement, then the cookie is successfully set. Anyone else having this problem?

    J. Alden Gillespy (aka Dogga) Microsoft Beta Tester: - Office 11 - Content Management Server (CMS) 2002 - Systems Management Server (SMS) 2003

    attached mail follows:


    Unless I am mistaken, the typical behavior for most browsers is exactly as you described. Which is due to the browser receiving a Location header and acting on it, disregarding any other headers. (ex: cache/no-cache, cookies, etc)

    Anybody care to prove me wrong?

    While not the best route, you could alternatively use a meta-refresh for the redirect. This would give you the chance for the headers to be read and the cookie created.

    Hope that helps, Jason k Larson

    J. Alden Gillespy wrote:

    > After I set a cookie and then send a redirect header, the cookie doesn't > show up, but the browser successfully redirects. > > setcookie("test", "blahblah", time() + 1440); > header("Location: http://www.mywebsite.com/login.php"); > > However, if I take out the header() statement, then the cookie is > successfully set. Anyone else having this problem? > > J. Alden Gillespy (aka Dogga) > Microsoft Beta Tester: > - Office 11 > - Content Management Server (CMS) 2002 > - Systems Management Server (SMS) 2003

    attached mail follows:


    On Tue, 14 Jan 2003 22:34:49 -0700, you wrote:

    >Unless I am mistaken, the typical behavior for most browsers is exactly >as you described. Which is due to the browser receiving a Location >header and acting on it, disregarding any other headers. (ex: >cache/no-cache, cookies, etc) > >Anybody care to prove me wrong?

    Actually most browsers can handle receiving a cookie and being redirected in the same response. I have several applications that do this and I have no problems in later versions of IE, Mozilla, Netscape, or Opera (all that I can test with).

    I would wager that the original poster is using IIS, and I would also wager that they are running PHP in CGI mode, not ISAPI mode. IIS has a bug that occurs when a CGI program tries to set a cookie and redirect in the same response (detailed in Microsoft Knowledge Base article Q176113), but there is a workaround. I sent a post to this list back in August of last year which details the workaround:

    http://marc.theaimsgroup.com/?l=php-general&m=102929828515647&w=2

    If the original post isn't using IIS, then I'm not sure what's happening.

    attached mail follows:


    Accidentally replied to sender instead of list --------------------------------------

    Wow. You hit the nail on the head. :)

    I installed PHP on IIS via the executable, so I gather I have one of two choices:

    -- Research your article and see how to work around the problem OR -- Use ISAPI. (how do I go about doing this? :)

    Thanks again for your help so far.

    J. Alden Gillespy (aka Dogga) Microsoft Beta Tester: - Office 11 - Content Management Server (CMS) 2002 - Systems Management Server (SMS) 2003 > > > -----Original Message----- > From: Michael Sims [mailto:mhsimsmidsouth.rr.com] > Sent: Wednesday, January 15, 2003 1:08 AM > To: php-generallists.php.net > Cc: jlarsoncandlefire.org; doggabowjackloren.com > > On Tue, 14 Jan 2003 22:34:49 -0700, you wrote: > > >Unless I am mistaken, the typical behavior for most browsers > is exactly > >as you described. Which is due to the browser receiving a Location > >header and acting on it, disregarding any other headers. (ex: > >cache/no-cache, cookies, etc) > > > >Anybody care to prove me wrong? > > Actually most browsers can handle receiving a cookie and being > redirected in the same response. I have several applications that do > this and I have no problems in later versions of IE, Mozilla, > Netscape, or Opera (all that I can test with). > > I would wager that the original poster is using IIS, and I would also > wager that they are running PHP in CGI mode, not ISAPI mode. IIS has > a bug that occurs when a CGI program tries to set a cookie and > redirect in the same response (detailed in Microsoft Knowledge Base > article Q176113), but there is a workaround. I sent a post to this > list back in August of last year which details the workaround: > > http://marc.theaimsgroup.com/?l=php-general&m=102929828515647&w=2 > > If the original post isn't using IIS, then I'm not sure what's > happening.

    attached mail follows:


    On Wed, 15 Jan 2003 01:36:26 -0500, you wrote:

    >Wow. You hit the nail on the head. :)

    Well, I spent a good day or two hunting the problem down the first time I ran across it. Spending that much time on something tends to make it stick in your head. :)

    >I installed PHP on IIS via the executable, so I gather I have one of two >choices: > >-- Research your article and see how to work around the problem >OR >-- Use ISAPI. (how do I go about doing this? :)

    It's been several months since I've tried to use PHP with IIS, but when I did it was the general consensus that the ISAPI module wasn't stable enough for production sites. If that's still the case I'd probably stick with the CGI version. Of course things may have improved, I haven't been keeping up with the Windows side of things. Perhaps someone on the php-windows list would have some ISAPI experiences to share.

    If you decide to try and implement the workaround and run into problems, drop me a line. I have working code examples which deal with this problem that I'd be happy to share.

    attached mail follows:


    I just use a simple Javascript function. I figure if it's remotely close, then good, if not then it's going to be an invalid email address most likely anyways:

    function emailCheck(str) { var at="" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ return false }

    if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false }

    if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false }

    if (str.indexOf(at,(lat+1))!=-1){ return false }

    if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false }

    if (str.indexOf(dot,(lat+2))==-1){ return false } if (str.indexOf(" ")!=-1){ return false }

    return true }

    DÆVID.

    "A good friend will come and bail you out of jail...but a true friend will be sitting next to you in the holding cell, laughing and saying -'That was fucking awesome!'"

    > -----Original Message----- > From: Manuel Lemos [mailto:mlemosacm.org] > Sent: Sunday, January 12, 2003 9:30 PM > To: php-generallists.php.net > Subject: [PHP] Re: Favorite Email validation routine? > > > Hello, > > On 01/13/2003 03:21 AM, Peter Janett wrote: > > I'm looking for everyone's favorite email syntax validation > routine. Code > > that takes an email address and does regex on it to > determine if it's > > formatted correctly. > > > > I know there are some on phpclasses.org that actually check > the mx record > > and server of the domain, but I'm just looking for a good, > clean and fast > > email address syntax check. > > > > So, what is your favorite bit of code to do that? > > This class that I don't know if you seen also comes with > complex regex > for simple e-mail address validation: > http://www.phpclasses.org/emailvalidation

    -- 
    

    Regards, Manuel Lemos

    -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    Hello friends.

    I have two fields in my form. When two dates are entered in these two boxes, I need to find the diiference in calendar months and remaining days between these two dates. This "Calendar months and remaining days" is important. The functions that I know do not work for calendar months. Can anyone help me and tell me how this could be achieved and are there any PHP functions to do this?

    best regards Denis

    attached mail follows:


    Hi guys,

    Is there a way for PHP to invoke the Save Dialog on the client's PC? And after choosing a filename, save the contents of a TextArea into their hard drives?

    --- Richard ---

    attached mail follows:


    Hi,

    I have table with six records in it. I can use "while" to display them all, but in form. Is there any way I can edit all six records, and update them all with one submit.

    TNX

    attached mail follows:


    At 10:07 15-1-03, you wrote: >I have table with six records in it. I can use "while" to display them all, >but in form. Is there any way I can edit all six records, and update them >all with one submit.

    One of the many ways to do it: When writing the form, number the fieldnames with the ID's of the items. Separate name and ID with a clear character like '__' <input type="text" name="field__531"> <input type="text" name="field__532"> <input type="text" name="field__533">

    In the receiving page, split the name again. Then build a query for every record. I'm not sure whether you can string multiple queries, separated by a semicolon (;), have a try.

    this is a principle code (not working but it shows the idea) for checking every incoming variable

    for [each $key, $value in $_POST] {if (! strpos('field',$key)==false) { $key=explode('__',$key); $ID=$key[1]; mysql_query(UPDATE mytable SET WHERE ID=$ID) } }

    attached mail follows:


    "Chris Hayes" <chayesantenna.nl> wrote in message news:5.1.0.14.0.20030115103551.01f79e20pop4.antenna.nl... > for [each $key, $value in $_POST] > {if (! strpos('field',$key)==false) > { $key=explode('__',$key); > $ID=$key[1]; > mysql_query(UPDATE mytable SET WHERE ID=$ID) > } > }

    i cant get this code to work. does anybody have the working code..

    tnx

    attached mail follows:


    Simon wrote: > Hi, > > I have table with six records in it. I can use "while" to display them all, > but in form. Is there any way I can edit all six records, and update them > all with one submit. > > TNX > What do you mean with "update more "same" fields at the same time"?Can you give us an example?

    Gvre

    attached mail follows:


    > What do you mean with "update more "same" fields at the same time"?Can > you give us an example? > > Gvre >

    <form name="form1" method="post" action="">

    <?

    $query1 = "SELECT * FROM table where subcat = $_GET[a]";

    $result1 = mysql_query($query1);

    while($row = mysql_fetch_object($result1))

    {

    ?>

    <p>

    <input name="textfield" type="text" value="<? echo $row->oid; ?>">

    <input name="textfield1" type="text" value="<? echo $row->url; ?>">

    </p>

    <?

    }

    ?>

    <p>

    <input type="submit" name="Submit" value="Submit">

    </p>

    </form>

    now i want to change values of texfields and update them back to mysql.

    attached mail follows:


    Simon wrote: >>What do you mean with "update more "same" fields at the same time"?Can >>you give us an example? >> >>Gvre >> > > > <form name="form1" method="post" action=""> > > <? > > $query1 = "SELECT * FROM table where subcat = $_GET[a]"; > > $result1 = mysql_query($query1); > > while($row = mysql_fetch_object($result1)) > > { > > ?> > > <p> > > <input name="textfield" type="text" value="<? echo $row->oid; ?>"> > > <input name="textfield1" type="text" value="<? echo $row->url; ?>"> > > </p> > > <? > > } > > ?> > > <p> > > <input type="submit" name="Submit" value="Submit"> > > </p> > > </form> > > now i want to change values of texfields and update them back to mysql. > If you want to update all the records that have subcat = $_GET[a] with the same values then you can do somethink like this:

    $subcat = $_POST['a']; $qsubcat = $_POST['subcat'];

    "update tables set field1=$_POST['textfield'],field2='$_POST['textfield1']' where subcat='$qsubcat'"

    I don 't know if this query will execute correctly because i don 't know the datatypes of your table fields. I prefer writing update and insert php scripts independed from select pages.It 's easier to read.

    attached mail follows:


    Simon wrote: >>What do you mean with "update more "same" fields at the same time"?Can >>you give us an example? >> >>Gvre >> > > > <form name="form1" method="post" action=""> > > <? > > $query1 = "SELECT * FROM table where subcat = $_GET[a]"; > > $result1 = mysql_query($query1); > > while($row = mysql_fetch_object($result1)) > > { > > ?> > > <p> > > <input name="textfield" type="text" value="<? echo $row->oid; ?>"> > > <input name="textfield1" type="text" value="<? echo $row->url; ?>"> > > </p> > > <? > > } > > ?> > > <p> > > <input type="submit" name="Submit" value="Submit"> > > </p> > > </form> > > now i want to change values of texfields and update them back to mysql. > If you want to update all the records that have subcat = $_GET[a] with the same values then you can do somethink like this:

    $subcat = $_POST['a']; $qsubcat = $_POST['subcat'];

    "update tables set field1=$_POST['textfield'],field2='$_POST['textfield1']' where subcat='$qsubcat'"

    I don 't know if this query will execute correctly because i don 't know the datatypes of your table fields. I prefer writing update and insert php scripts independed from select pages.It 's easier to read.

    attached mail follows:


    > If you want to update all the records that have subcat = $_GET[a] with > the same values then you can do somethink like this: > > $subcat = $_POST['a']; > $qsubcat = $_POST['subcat']; > > "update tables set > field1=$_POST['textfield'],field2='$_POST['textfield1']' where > subcat='$qsubcat'" > > I don 't know if this query will execute correctly because i don 't know > the datatypes of your table fields. > I prefer writing update and insert php scripts independed from select > pages.It 's easier to read. >

    thing is that i want to update same field 6 times with one mysql query. lets say i have 6 names in one mysql table. now I wand to update all six of them with one query.

    attached mail follows:


    Simon wrote: >>If you want to update all the records that have subcat = $_GET[a] with >>the same values then you can do somethink like this: >> >>$subcat = $_POST['a']; >>$qsubcat = $_POST['subcat']; >> >>"update tables set >>field1=$_POST['textfield'],field2='$_POST['textfield1']' where >>subcat='$qsubcat'" >> >>I don 't know if this query will execute correctly because i don 't know >>the datatypes of your table fields. >>I prefer writing update and insert php scripts independed from select >>pages.It 's easier to read. >> > > > thing is that i want to update same field 6 times with one mysql query. lets > say i have 6 names in one mysql table. now I wand to update all six of them > with one query. > with the same data or not?

    attached mail follows:


    > with the same data or not? > not with the same data

    attached mail follows:


    Simon wrote: >>with the same data or not? >> > > not with the same data > You can put your data and the primary keys in arrays and exec a loop but the data[0] must be the data for the id[0], data[1] must be the data for id[1] etc.

    The loop should be something like this:

    for (int $i=0; $i<=total_records_select_returned -1; $i++) update table set field1='$data[$i]' where id=$id[$i];

    I 'm not sure for the syntax but the idea is correct.

    attached mail follows:


    Hi!

    This looks VERY interesting, it seems to be exactly what the Application Object does for ASP, and thats exactly what I need ... now I just have to hope that this version is stable enough ...

    many thanks !

    mathias rockel

    ----- Original Message ----- From: "Tamas Arpad" <stsmail.xubion.hu> To: "Mathias Rockel" <mr.phppfaffendorf-consulting.com>; <php-generallists.php.net> Sent: Tuesday, January 14, 2003 6:11 PM Subject: Re: [PHP] Re: Persistent global data ?

    > > So this is the only way I guess ... > > > > Do you propose to serialize() the objects in the tree and write that data > > into a shared memory block, and then deserialize them at the beginning of > > each script that needs the data back into objects ? I would think that that > > would impose the same performance penaltys from creating the objects again > > (this seems to be what slows php down), only the reading process ist sped > > up ... not exactly what I would like, but seems PHP provides no other > > functionality ... > > > > mathias rockel > There's another way with srm: > http://www.vl-srm.net/doc/features.application-vars.php > But I don't know if it's still maintaned. > > Arpi >

    attached mail follows:


    Hi All,

    Can you please help me with the following problem? I've had code wich was running fine with php till i've upgraded to PHP version 4.2.3.

    The original code line was:

    $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = '$id'";

    but it's not working when you have register_globals=Off So i've read everywhere to use the $_Get:

    So the code looks like this:

    $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET['id']";

    But all i'm getting in my browser is:

    parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'

    Can someone please help?

    Thanks and regards,

    Frank

    attached mail follows:


    Try

    $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = {$_GET['id']}";

    HTH

    Danny. ----- Original Message ----- From: "Frank Keessen" <fkeessenplanet.nl> To: <php-generallists.php.net> Sent: Wednesday, January 15, 2003 10:50 AM Subject: [PHP] Question about $_GET

    Hi All,

    Can you please help me with the following problem? I've had code wich was running fine with php till i've upgraded to PHP version 4.2.3.

    The original code line was:

    $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = '$id'";

    but it's not working when you have register_globals=Off So i've read everywhere to use the $_Get:

    So the code looks like this:

    $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET['id']";

    But all i'm getting in my browser is:

    parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'

    Can someone please help?

    Thanks and regards,

    Frank

    attached mail follows:


    "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET[id]";

    - removed single quotes

    Frank Keessen wrote:

    >Hi All, > >Can you please help me with the following problem? I've had code wich was running fine with php till i've upgraded to PHP version 4.2.3. > >The original code line was: > >$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = '$id'"; > >but it's not working when you have register_globals=Off >So i've read everywhere to use the $_Get: > >So the code looks like this: > >$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET['id']"; > >But all i'm getting in my browser is: > >parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' > > >Can someone please help? > >Thanks and regards, > >Frank > > >

    attached mail follows:


    Thanks, but not working:

    The error message: Error in query: SELECT Newsheadline, News, Contact FROM news WHERE Newsid = . You have an error in your SQL syntax near '' at line 1

    Here are both lines:

    $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = {$_GET['id']}";

    $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());

    Regards,

    Frank ----- Original Message ----- From: "Danny Shepherd" <dannykyboshed.com> To: "Frank Keessen" <fkeessenplanet.nl>; <php-generallists.php.net> Sent: Wednesday, January 15, 2003 11:54 AM Subject: Re: [PHP] Question about $_GET

    > Try > > $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = > {$_GET['id']}"; > > HTH > > Danny. > ----- Original Message ----- > From: "Frank Keessen" <fkeessenplanet.nl> > To: <php-generallists.php.net> > Sent: Wednesday, January 15, 2003 10:50 AM > Subject: [PHP] Question about $_GET > > > Hi All, > > Can you please help me with the following problem? I've had code wich was > running fine with php till i've upgraded to PHP version 4.2.3. > > The original code line was: > > $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = > '$id'"; > > but it's not working when you have register_globals=Off > So i've read everywhere to use the $_Get: > > So the code looks like this: > > $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = > $_GET['id']"; > > But all i'm getting in my browser is: > > parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' > > > Can someone please help? > > Thanks and regards, > > Frank > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = '$_GET['id']'";

    It looks like here that again $_GET['id'] has an empty value;

    Jason k Larson

    Frank Keessen wrote:

    > Thanks, but not working: > > The error message: > Error in query: SELECT Newsheadline, News, Contact FROM news WHERE > Newsid = > . You have an error in your SQL syntax near '' at line 1 > > Here are both lines: > > $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = > {$_GET['id']}"; > > > $result = mysql_query($query) or die ("Error in query: $query. " . > mysql_error()); > > Regards, > > Frank > ----- Original Message ----- > From: "Danny Shepherd" > To: "Frank Keessen" ; > Sent: Wednesday, January 15, 2003 11:54 AM > Subject: Re: [PHP] Question about $_GET >

    attached mail follows:


    Forms have two distinct methods. GET and POST. if the form has a method of POST vars are stored in $_POST, ditto for GET.

    Use $_POST['id'] not $_GET['id'] if your form uses the POST method.

    HTH, Jason k Larson

    Jason k Larson wrote:

    > $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = > '$_GET['id']'"; > > It looks like here that again $_GET['id'] has an empty value; > > Jason k Larson > > > Frank Keessen wrote: > > > Thanks, but not working: > > > > The error message: > > Error in query: SELECT Newsheadline, News, Contact FROM news WHERE > > Newsid = > > . You have an error in your SQL syntax near '' at line 1 > > > > Here are both lines: > > > > $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = > > {$_GET['id']}"; > > > > > > $result = mysql_query($query) or die ("Error in query: $query. " . > > mysql_error()); > > > > Regards, > > > > Frank > > ----- Original Message ----- > > From: "Danny Shepherd" > > To: "Frank Keessen" ; > > Sent: Wednesday, January 15, 2003 11:54 AM > > Subject: Re: [PHP] Question about $_GET > >

    attached mail follows:


    At 11:57 15-1-03, Marek Kilimajer wrote: >"SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET[id]"; > >- removed single quotes

    I think that that is a really bad advice.

    Let me explain.

    For one, the single quotes are not in the way here because the query is written between double quotes.

    Then, leaving out the single quotes like Marek suggests will only work because PHP is too programmer-friendly. But the indexes of such arrays should always be quoted, because they are strings, and not the name of 'constant' values. If you do not quote them PHP will first try to look up whether you defined id somewhere, as a constant (with define ('id','value');). Which you did not, so PHP will fail to find it. Only then PHP will gently assume that since there is no constant defined with the name id, that you meant 'id'. Valuable processing time wasted for no reason. Set error_reporting to ~E_ALL if you do not believe me.

    I would support the $_POST suggestion by Jason.

    Suggested reading: the 'PHP Bible'.

    attached mail follows:


    Chris Hayes wrote:

    > > > Let me explain. > > For one, the single quotes are not in the way here because the query > is written between double quotes. > > Then, leaving out the single quotes like Marek suggests will only work > because PHP is too programmer-friendly. > But the indexes of such arrays should always be quoted, because they > are strings, and not the name of 'constant' values.

    But it is within string (double quotes), so the index evaluates as a string, not as a constant.

    > If you do not quote them PHP will first try to look up whether you > defined id somewhere, as a constant (with define ('id','value');). > Which you did not, so PHP will fail to find it. Only then PHP will > gently assume that since there is no constant defined with the name > id, that you meant 'id'. Valuable processing time wasted for no reason. > Set error_reporting to ~E_ALL if you do not believe me.

    I believe you, but try it first: <?php $a=array('id'=> 'Hello world'); echo "$a[id]"; ?>

    <?php $a=array('id'=> 'Hello world'); echo "$a['id']"; ?>

    this is *different*: <?php $a=array('id'=> 'Hello world'); echo $a[id]; ?>

    <?php $a=array('id'=> 'Hello world'); echo $a['id']; ?>

    > > > I would support the $_POST suggestion by Jason.

    He got error from php and not mysql,

    > > > Suggested reading: the 'PHP Bible'. > > >

    attached mail follows:


    Frank,

    This is frustrating because there are several things at work here...

    -- firstly -- Page data (POST or GET) is ALWAYS 'character' type when received into your script -- whether or not that's how you use it in your application/database

    So most times you need to "settype($id, "integer") in order to use the values in the particular case of database queries where the data=type is some numeric type

    -- secondly --

    MySQL query syntax generally _requires_ character data to be 'single quoted', whereas integers should be unquoted

    So if your Newsid field in the MySQLK table structure is character type then use the single quotes if integer the _unquotes in the $query

    ((Your error messages imply that this is likely one of the probs with the code.))

    -- lastly -- For some reason (beyond my grasp) the variable substitution in PHP behaves differently for _simple_ vars ($var) as opposed to _complex_ vars like $_POST["somevarname"] and $arrayname["$othervar"]

    So the conmbined solution to at least give a try ===================================================================

    settype($id, "integer"); // assuming that the MySQL field-type is an integer $id = $_GET['id']; // change to what I called a _simple_ var ;-) // then place $id in the query as unquoted $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $id";

    Hope that helps,

    Tom Henry

    Frank Keessen wrote: > Thanks, but not working: > > The error message: > Error in query: SELECT Newsheadline, News, Contact FROM news WHERE Newsid = > . You have an error in your SQL syntax near '' at line 1 > > Here are both lines: > > $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = > {$_GET['id']}"; > > > $result = mysql_query($query) or die ("Error in query: $query. " . > mysql_error()); > > Regards, > > Frank > ----- Original Message ----- > From: "Danny Shepherd" <dannykyboshed.com> > To: "Frank Keessen" <fkeessenplanet.nl>; <php-generallists.php.net> > Sent: Wednesday, January 15, 2003 11:54 AM > Subject: Re: [PHP] Question about $_GET > > > >>Try >> >>$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = >>{$_GET['id']}"; >> >>HTH >> >>Danny. >>----- Original Message ----- >>From: "Frank Keessen" <fkeessenplanet.nl> >>To: <php-generallists.php.net> >>Sent: Wednesday, January 15, 2003 10:50 AM >>Subject: [PHP] Question about $_GET >> >> >>Hi All, >> >>Can you please help me with the following problem? I've had code wich was >>running fine with php till i've upgraded to PHP version 4.2.3. >> >>The original code line was: >> >>$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = >>'$id'"; >> >>but it's not working when you have register_globals=Off >>So i've read everywhere to use the $_Get: >> >>So the code looks like this: >> >>$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = >>$_GET['id']"; >> >>But all i'm getting in my browser is: >> >>parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' >> >> >>Can someone please help? >> >>Thanks and regards, >> >>Frank >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > >

    attached mail follows:


    On Wednesday 15 January 2003 18:57, Frank Keessen wrote: > Thanks, but not working: > > The error message: > Error in query: SELECT Newsheadline, News, Contact FROM news WHERE Newsid = > . You have an error in your SQL syntax near '' at line 1 > > Here are both lines: > > $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = > {$_GET['id']}"; > > > $result = mysql_query($query) or die ("Error in query: $query. " . > mysql_error());

    Let's put this straight when referring to items in an array inside a double-quoted string that is the correct syntax to use. IE:

    $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = {$_GET['id']}";

    Your problem now is clearly one of SQL syntax as the error states so explicitly.

    If Newsid is not numerical type then you need single quotes around the expression that it is being compared to. IOW your query should look like:

    $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = '{$_GET['id']}'";

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.biz
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    

    /* If we see the light at the end of the tunnel, it's the light of an oncoming train. -- Robert Lowell */

    attached mail follows:


    Make life easy for yourself:

    $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = ".$_GET['id']; ----- Original Message ----- From: "Frank Keessen" <fkeessenplanet.nl> To: <php-generallists.php.net> Sent: Wednesday, January 15, 2003 4:50 AM Subject: [PHP] Question about $_GET

    Hi All,

    Can you please help me with the following problem? I've had code wich was running fine with php till i've upgraded to PHP version 4.2.3.

    The original code line was:

    $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = '$id'";

    but it's not working when you have register_globals=Off So i've read everywhere to use the $_Get:

    So the code looks like this:

    $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET['id']";

    But all i'm getting in my browser is:

    parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'

    Can someone please help?

    Thanks and regards,

    Frank

    attached mail follows:


    Hi Again, I already have it! (And it is the one from the distro)

    [danielp85 daniel]$ rpm -q php-mysql php-mysql-4.2.2-8.0.5

    /daniel

    On Wed, 2003-01-15 at 02:19, Larry Brown wrote: > You need the php-mysql rpm do rpm -q php-mysql > Get the one from the distro > > Larry S. Brown > Dimension Networks, Inc. > (727) 723-8388 > > -----Original Message----- > From: Daniel Elenius [mailto:danel698student.liu.se] > Sent: Tuesday, January 14, 2003 5:22 PM > To: php-generallists.php.net > Subject: Re: [PHP] MySQL problem with RedHat 8 > > Yes, mysql.so is in /usr/lib/php4. The php.ini file has this in it: > > [danielp85 etc]$ grep mysql php.ini > ;extension=php_mysql.dll > extension=mysql.so > mysql.allow_persistent = On > mysql.max_persistent = -1 > mysql.max_links = -1 > ; Default port number for mysql_connect(). If unset, mysql_connect() > will use > ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the > mysql.default_port = > mysql.default_socket = > ; Default host for mysql_connect() (doesn't apply in safe mode). > mysql.default_host = > ; Default user for mysql_connect() (doesn't apply in safe mode). > mysql.default_user = > ; Default password for mysql_connect() (doesn't apply in safe mode). > ; *Any* user with PHP access can run 'echo > cfg_get_var("mysql.default_password") > mysql.default_password = > > > /daniel > > On Tue, 2003-01-14 at 23:17, Joseph W. Goff wrote: > > Make sure that the shared module is in the correct directory. > > Check your php.ini file to make sure but it is most likely at /usr/lib/php4 > > make sure that you have mysql.so > > ----- Original Message ----- > > From: "Daniel Elenius" <danel698student.liu.se> > > To: <php-generallists.php.net> > > Sent: Tuesday, January 14, 2003 3:58 PM > > Subject: [PHP] MySQL problem with RedHat 8 > > > > > > > Hi! > > > > > > I'm trying to connect to my mysql database using something like > > > > > > mysql_connect( 'localhost', 'root', 'thepassword' ) > > > or die ( 'Unable to connect to server.' ); > > > > > > But I get the error message: > > > Fatal error: Call to undefined function: mysql_connect() in > > > /home/daniel/public_html/index.php on line 21 > > > > > > I have: > > > > > > [rootp85 /]# rpm -qa |grep sql > > > php-mysql-4.2.2-8.0.5 > > > mysql-3.23.52-3 > > > mysql-server-3.23.52-3 > > > mysql-devel-3.23.52-3 > > > > > > and: > > > > > > [rootp85 /]# rpm -q php > > > php-4.2.2-8.0.5 > > > > > > Someone mentioned these two settings in php.ini, which I tried with no > > > success: > > > > > > register_globals = On > > > short_open_tag = On > > > > > > phpinfo() says that php was compiled with '--with-mysql=shared,/usr' > > > > > > Can someone help me please? > > > > > > regards, > > > -- > > > Daniel Elenius <danel698student.liu.se> > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > Daniel Elenius <danel698student.liu.se> > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    -- 
    Daniel Elenius <danel698student.liu.se>
    

    attached mail follows:


    Hi everyone. I am more of an ActionScript person, but I have to do this one in php. Should be easy for everyone familiar with php syntax...

    Here is what I want to do: I am getting several variables into a Php Script such as:

    help1 = "yes" / "no" help2 = "yes" / "no" . . . helpX = "yes" / "no"

    I need to check whether the variable is true or false, and according to that add 1 to a counter variable.

    Something like this I'd do in ActionScript, but dont know about php [CODE] $i = 0; While (++$i <= 8) { if ([help]+$i=="yes"){ // this line produces an error... $counterYes += counterYes; } } [/CODE]

    Do I have to initialize all variables before I can use them in php?

    Thank you very, very much for your time and your help!! Philipp

    attached mail follows:


    for($ii=1; $ii<20; $ii++) { $helpz = "help$ii"; if(${$helpz} == "yes) { } else { } } ----- Original Message ----- From: "Philipp Hartmann" <heartgsdh.org> To: <php-generallists.php.net> Sent: Wednesday, January 15, 2003 6:50 AM Subject: [PHP] dynamic variables in a while loop?

    Hi everyone. I am more of an ActionScript person, but I have to do this one in php. Should be easy for everyone familiar with php syntax...

    Here is what I want to do: I am getting several variables into a Php Script such as:

    help1 = "yes" / "no" help2 = "yes" / "no" . . . helpX = "yes" / "no"

    I need to check whether the variable is true or false, and according to that add 1 to a counter variable.

    Something like this I'd do in ActionScript, but dont know about php [CODE] $i = 0; While (++$i <= 8) { if ([help]+$i=="yes"){ // this line produces an error... $counterYes += counterYes; } } [/CODE]

    Do I have to initialize all variables before I can use them in php?

    Thank you very, very much for your time and your help!! Philipp

    -- 
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php
    

    attached mail follows:


    > -----Original Message----- > From: Philipp Hartmann [mailto:heartgsdh.org] > Sent: 15 January 2003 12:50 > > Here is what I want to do: > I am getting several variables into a Php Script such as: > > help1 = "yes" / "no" > help2 = "yes" / "no" > . > . > . > helpX = "yes" / "no" > > I need to check whether the variable is true or false, and > according to that > add > 1 to a counter variable. > > Something like this I'd do in ActionScript, but dont know about php > [CODE] > $i = 0; > While (++$i <= 8) { > if ([help]+$i=="yes"){ // this line produces an error...

    I think you need to read the PHP manual page on variable variables: http://www.php.net/manual/en/language.variables.variable.php -- and the one on string operators: http://www.php.net/manual/en/language.operators.string.php

    > $counterYes += counterYes;

    I assume this is a typo for $counterYes += 1 ...! > } > } > [/CODE] > > Do I have to initialize all variables before I can use them in php?

    No -- but, presuming these values are coming from a form, or a query on the URL, the other thing you need to take account of is the configuration setting for register_globals. If it's on, then fine, the above will work with appropriate amendments to suit PHP syntax; if it's off, then you have to use the $_POST[] or $_GET[] array as appropriate, and in fact the variable variables stuff is not relevant because the array index is just the HelpX string.

    Cheers!

    Mike

    --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.fordlmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

    attached mail follows:


    Thanks everyone! Works great! Phil

    ----- Original Message ----- From: "Rick Emery" <remeryemeryloftus.com> To: "Philipp Hartmann" <heartgsdh.org>; <php-generallists.php.net> Sent: Wednesday, January 15, 2003 2:03 PM Subject: Re: [PHP] dynamic variables in a while loop?

    > for($ii=1; $ii<20; $ii++) > { > $helpz = "help$ii"; > if(${$helpz} == "yes) > { > } > else > { > } > } > ----- Original Message ----- > From: "Philipp Hartmann" <heartgsdh.org> > To: <php-generallists.php.net> > Sent: Wednesday, January 15, 2003 6:50 AM > Subject: [PHP] dynamic variables in a while loop? > > > Hi everyone. > I am more of an ActionScript person, but I have to do this one in php. > Should > be easy for everyone familiar with php syntax... > > Here is what I want to do: > I am getting several variables into a Php Script such as: > > help1 = "yes" / "no" > help2 = "yes" / "no" > . > . > . > helpX = "yes" / "no" > > I need to check whether the variable is true or false, and according to that > add > 1 to a counter variable. > > Something like this I'd do in ActionScript, but dont know about php > [CODE] > $i = 0; > While (++$i <= 8) { > if ([help]+$i=="yes"){ // this line produces an error... > $counterYes += counterYes; > } > } > [/CODE] > > Do I have to initialize all variables before I can use them in php? > > Thank you very, very much for your time and your help!! > Philipp > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    Following is the code that will do a remote scrape of http://www3.brinkster.com/soa/val/profile/display.asp (which sometimes goes down), however, it should time out and produce an error after 5 seconds; instead, sometimes, the entire page (http://valsignalandet.com) which includes this script below, takes up to 90 seconds to load because of the ASP script locking, in spite of my safeguards. Can anyone please help; I'm out of ideas.

    Thanx

    Phil

    <? require_once('/users/ppowell/web/php_global_vars.php');

    // OPEN SOCKET CONNECTION TO BRINKSTER SET TO TIMEOUT IN 2 SECONDS $res = ''; $fp = fsockopen('www3.brinkster.com', 80, &$errno, &$errstr, 2) or die('Oops'); if (!$fp) { echo "${font}Cannot profiles at this time. <a href=http://www3.brinkster.com/soa/val/profile/view.asp>Click here</a> or try again later</font><p>"; } else { $httpStr = "POST /soa/val/profile/display.asp?showLeftNavBanner=1 HTTP/1.0\r\nAccept: text/*\r\nUser-agent: NC_GET_URL\r\nHost: www3.brinkster.com:80\r\n\r\n"; fputs($fp, $httpStr); $start = time(); // DOUBLE TIME SETTING: SET FOR BOTH STREAM TIMEOUT AND FOR DATA LOOPING TIMEOUT TO // ENSURE THAT THE WHOLE PROCESS IS 5 SECONDS OR IT QUITS // STREAM COMMANDS DON'T WORK ON VAL BECAUSE PHP VERSION IS TOO OLD - CRAP! list($phpVersion1, $phpVersion2, $phpVersion3) = explode('.', phpversion()); if ($phpVersion1 >=4 && $phpVersion2 >= 3) { if (!stream_set_timeout($fp, 5)) echo 'Could not set stream timeout<p>'; if (!stream_set_blocking($fp, 0)) echo 'Could not set stream blocking<p>'; }

    $now = $start; while (!feof($fp) && $now < $start + 5) { $res .= fgets($fp, 4096); $now = time(); }

    fclose($fp); } if (strlen($res) > 0 && $now < $start + 5) { echo trim(substr($res, strpos($res, '<'), strlen(trim($res)))); } else { echo "${font}Could not display profiles at this time. <a href=http://www3.brinkster.com/soa/val/profile/view.asp>Click here</a> or try again later</font><p>"; } ?>

    attached mail follows:


    Hi,

    I am trying to send an array from one php to another:

    $org["index-A"]=17010000; $org["index-B"]=12090000;

    print "<a href=\"test2.php?org=".$org."\">test2</a><BR>\n";

    But if I try to read te array in test2.php, I get "Warning: Variable passed to each() is not an array ".

    Can anyone help me???? Danielle

    attached mail follows:


    show us the test1.php code. show us the test2.php code. We can't read your mind. ----- Original Message ----- From: "Danielle van Gladbach" <gladbachict.tno.nl> To: <php-generallists.php.net> Sent: Wednesday, January 15, 2003 6:59 AM Subject: [PHP] sending array

    Hi,

    I am trying to send an array from one php to another:

    $org["index-A"]=17010000; $org["index-B"]=12090000;

    print "<a href=\"test2.php?org=".$org."\">test2</a><BR>\n";

    But if I try to read te array in test2.php, I get "Warning: Variable passed to each() is not an array ".

    Can anyone help me???? Danielle

    -- 
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php
    

    attached mail follows:


    On Wednesday 15 January 2003 20:59, Danielle van Gladbach wrote:

    > I am trying to send an array from one php to another: > > $org["index-A"]=17010000; > $org["index-B"]=12090000; > > print "<a href=\"test2.php?org=".$org."\">test2</a><BR>\n"; > > But if I try to read te array in test2.php, I get "Warning: Variable > passed to each() is not an array ".

    You can't pass an array thru the URL. What you need to do is serialize() it then urlencode() it (or maybe rawurlencode()). Then you can put the resulting string in the URL.

    In test2.php you would unserialize() $org ($_GET['org']).

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.biz
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    

    /* E Pluribus Unix */

    attached mail follows:


    I am not sure you can do it way, here is what i suggest

    test2.php?org[index-A]=<?php $org['index-A'] ?>&org[index-B]=<?php $org['index-B'] ?>......

    you need to specify each var in you array in the query path.

    Danielle Van Gladbach <gladbachict.tno.nl> wrote in message news:3E255B1C.144F73C9ict.tno.nl... > Hi, > > I am trying to send an array from one php to another: > > $org["index-A"]=17010000; > $org["index-B"]=12090000; > > print "<a href=\"test2.php?org=".$org."\">test2</a><BR>\n"; > > But if I try to read te array in test2.php, I get "Warning: Variable > passed to each() is not an array ". > > Can anyone help me???? > Danielle > >

    attached mail follows:


    There not much in there because I strip it for testing.

    test1.php <? $org["index-A"]=17010000; $org["index-B"]=12090000;

    print "<a href=\"test2.php?org=".$org."\">test2</a><BR>\n"; ?>

    test2.php <? while (list ($key, $val) = each($org)) { print "key=".$key."val".$val."<br>\n"; } ?>

    Rick Emery wrote:

    > show us the test1.php code. > show us the test2.php code. > We can't read your mind. > ----- Original Message ----- > From: "Danielle van Gladbach" <gladbachict.tno.nl> > To: <php-generallists.php.net> > Sent: Wednesday, January 15, 2003 6:59 AM > Subject: [PHP] sending array > > Hi, > > I am trying to send an array from one php to another: > > $org["index-A"]=17010000; > $org["index-B"]=12090000; > > print "<a href=\"test2.php?org=".$org."\">test2</a><BR>\n"; > > But if I try to read te array in test2.php, I get "Warning: Variable > passed to each() is not an array ". > > Can anyone help me???? > Danielle > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    You know, if you actually looked at the link you've created you'd find your answer ...

    > -----Original Message----- > From: D.M. van Gladbach [mailto:Gladbachict.tno.nl] > > There not much in there because I strip it for testing. > > test1.php > <? > $org["index-A"]=17010000; > $org["index-B"]=12090000; > > print "<a href=\"test2.php?org=".$org."\">test2</a><BR>\n"; > ?> > > test2.php > <? > while (list ($key, $val) = each($org)) > { > print "key=".$key."val".$val."<br>\n"; > } > ?> > >>

    attached mail follows:


    Just wanted some opinions on the best way to produce well-formed xml from a php object. In my case, I was toying with the idea of a generic way to product an xml file from a PEAR DataObject - the idea being that a 3rd party requests data, I extract from mysql using Pear's DataObjects, then tell that objects to produce xml (or pass it to a transformer or something).

    Links? Ideas? Recommendations from RL experience?

    cheers, neko

    attached mail follows:


    Hi,

    I want to create dynamic graphs with PHP and Flash for data that changes constantly (let's say every 2 seconds). The graphs must change visibly in the browser window without refreshing the page. Is this possible? I have read most that I could find on MING and searched the web as well, but didn't have much luck. Is PHP/Flash approach the best?

    Any info/scripts/url's would be appreciated.

    TX MH