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: Sat Jan 25 2003 - 14:33:38 CST

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

    php-general Digest 25 Jan 2003 20:33:38 -0000 Issue 1844

    Topics (messages 133089 through 133122):

    If... Else.. I'm not getting it!
            133089 by: Frank Keessen
            133091 by: Jason Wong
            133092 by: Frank Keessen
            133093 by: Johannes Schlueter
            133094 by: Frank Keessen
            133095 by: Rich Gray
            133097 by: Frank Keessen
            133114 by: Jason Wong

    Re: memory exhausted... memory leak?
            133090 by: Tularis

    Script under Windows OK, under Linux, not...
            133096 by: Daniel Page
            133099 by: Daniel Page

    Re: Designing My First Content Management System
            133098 by: Geckodeep

    Re: PHP and XML mailing list
            133100 by: Dirkjan Ochtman

    Re: Sendmail function
            133101 by: Chris Hewitt

    Re: Evaluate PHP var in stored sql statement?
            133102 by: Noah
            133118 by: Maxim Maletsky
            133119 by: Noah

    PHP 4.3.0 - Apache 2 Problem - Missing phpinfo() Info
            133103 by: Kenneth Lerman

    OO2relation mapping
            133104 by: Dominik Wittenbeck

    Re: get apache user
            133105 by: Tommy Jensehaugen
            133112 by: Jason Wong

    Re: [SOAP] Re: soap post and http 1.1 100 continue
            133106 by: Danny Shepherd

    Switch statement || How to output html without using echo() or print()
            133107 by: Noah
            133109 by: John W. Holmes
            133110 by: Johannes Schlueter
            133113 by: Leif K-Brooks
            133115 by: Noah
            133116 by: Noah
            133117 by: Noah

    Adjusting Indexed Field After Deleting Entry
            133108 by: Guru Geek

    question about interaction between own state information...
            133111 by: Juerg Zgraggen

    GD jpg thumbnail - ugly discollored
            133120 by: Victor
            133121 by: George E. Papadakis
            133122 by: Victor

    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:


    Hi all,

    Please can you help me with the following:

    If got a little sample code:

    This one is working (!):

    <?php
    $vname=$_POST['vname'];
    echo "hello $vname";
    ?>
    <form action="<? echo ($_SERVER['PHP_SELF']); ?>" method=post>
    <table>
    <tr><td>Input yourname</td><td><input type=text name=vname></td></tr>
    <tr><td colspan=2><input type=submit name=submit></td></tr>
    </table>
    </form>
    <?php

    ?>

    But when i'm using IF Else.. Nothing is happening. I'm only seeing the form but when i submit that form: The $vname doen't display..

    Here is the code that doesn't work:

    <?php
    $vname=$_POST['vname'];
    if($submit) {
    echo "hello $vname";
    } else {
    ?>
    <form action="<? echo ($_SERVER['PHP_SELF']); ?>" method=post>
    <table>
    <tr><td>Input yourname</td><td><input type=text name=vname></td></tr>
    <tr><td colspan=2><input type=submit name=submit></td></tr>
    </table>
    </form>
    <?php
    }
    ?>

    What am I doing wrong???

    Thanks,

    Frank

    attached mail follows:


    On Saturday 25 January 2003 18:27, Frank Keessen wrote:

    > But when i'm using IF Else.. Nothing is happening. I'm only seeing the form
    > but when i submit that form: The $vname doen't display..
    >
    > Here is the code that doesn't work:
    >
    > <?php
    > $vname=$_POST['vname'];
    > if($submit) {

    Try some basic debugging techniques like echo ($submit). You'll see nothing,
    hence that IF clause fails.

    If register_globals is not enabled then you need to use $_POST['submit'] (just
    as you had to use $_POST['vname']).

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

    /* Confidence is simply that quiet, assured feeling you have before you fall flat on your face. -- Dr. L. Binder */

    attached mail follows:


    Hi,

    The register_globals = Off. Dit the basic echo ($submit) but it displays nothing..

    Any thoughts somebody??

    Thanks for helping me out on this cloudy saturday (in Amsterdam!)

    Regards,

    Frank

    ----- Original Message ----- From: "Jason Wong" <php-generalgremlins.biz> To: <php-generallists.php.net> Sent: Saturday, January 25, 2003 11:36 AM Subject: Re: [PHP] If... Else.. I'm not getting it!

    > On Saturday 25 January 2003 18:27, Frank Keessen wrote: > > > But when i'm using IF Else.. Nothing is happening. I'm only seeing the form > > but when i submit that form: The $vname doen't display.. > > > > Here is the code that doesn't work: > > > > <?php > > $vname=$_POST['vname']; > > if($submit) { > > Try some basic debugging techniques like echo ($submit). You'll see nothing, > hence that IF clause fails. > > If register_globals is not enabled then you need to use $_POST['submit'] (just > as you had to use $_POST['vname']). > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > Confidence is simply that quiet, assured feeling you have before you > fall flat on your face. > -- Dr. L. Binder > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Hi,

    On Saturday 25 January 2003 12:18, Frank Keessen wrote: > The register_globals = Off. Dit the basic echo ($submit) but it displays > nothing.. > > Any thoughts somebody??

    Switch on register_globals or (better!) use $_GET['submit'], $_POST['submit'] or $_REQUEST['submit'].

    > Thanks for helping me out on this cloudy saturday (in Amsterdam!)

    johannes

    attached mail follows:


    Hi,

    Thanks, but i'm a kind of a newbie in PHP and what i've read it's better to have the register_globals = Off!!! If you look at my code you see that i'm using the $_GET variable.. This works fine!! It's the IF.. ELSE what gives me a lot of trouble!

    Frank

    ----- Original Message ----- From: "Johannes Schlueter" <phpschlueters.de> To: "Frank Keessen" <fkeessenplanet.nl>; <php-generallists.php.net> Sent: Saturday, January 25, 2003 12:25 PM Subject: Re: [PHP] If... Else.. I'm not getting it!

    Hi,

    On Saturday 25 January 2003 12:18, Frank Keessen wrote: > The register_globals = Off. Dit the basic echo ($submit) but it displays > nothing.. > > Any thoughts somebody??

    Switch on register_globals or (better!) use $_GET['submit'], $_POST['submit'] or $_REQUEST['submit'].

    > Thanks for helping me out on this cloudy saturday (in Amsterdam!)

    johannes

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

    attached mail follows:


    You are using the post method not get so $_GET[] should be empty.

    Does this version of your code work?

    <?php if(isset($_POST['submit'])) { $vname=$_POST['vname']; echo "hello $vname"; } else { ?> <form action="<? echo ($_SERVER['PHP_SELF']); ?>" method=post> <table> <tr><td>Input yourname</td><td><input type=text name=vname></td></tr> <tr><td colspan=2><input type=submit name=submit></td></tr> </table> </form> <?php } ?>

    Rich -----Original Message----- From: Frank Keessen [mailto:fkeessenplanet.nl] Sent: 25 January 2003 11:33 To: Johannes Schlueter; php-generallists.php.net Subject: Re: [PHP] If... Else.. I'm not getting it!

    Hi,

    Thanks, but i'm a kind of a newbie in PHP and what i've read it's better to have the register_globals = Off!!! If you look at my code you see that i'm using the $_GET variable.. This works fine!! It's the IF.. ELSE what gives me a lot of trouble!

    Frank

    attached mail follows:


    Wow!! It worked... Sorry for the confusion about the get!!

    Thanks guys, i can go further!!! Have a nice weekend!

    Regards,

    Frank ----- Original Message ----- From: "Rich Gray" <richf1central.net> To: "Frank Keessen" <fkeessenplanet.nl>; <php-generallists.php.net> Sent: Saturday, January 25, 2003 12:42 PM Subject: RE: [PHP] If... Else.. I'm not getting it!

    > You are using the post method not get so $_GET[] should be empty. > > Does this version of your code work? > > <?php > if(isset($_POST['submit'])) { > $vname=$_POST['vname']; > echo "hello $vname"; > } else { > ?> > <form action="<? echo ($_SERVER['PHP_SELF']); ?>" method=post> > <table> > <tr><td>Input yourname</td><td><input type=text name=vname></td></tr> > <tr><td colspan=2><input type=submit name=submit></td></tr> > </table> > </form> > <?php > } > ?> > > Rich > -----Original Message----- > From: Frank Keessen [mailto:fkeessenplanet.nl] > Sent: 25 January 2003 11:33 > To: Johannes Schlueter; php-generallists.php.net > Subject: Re: [PHP] If... Else.. I'm not getting it! > > > Hi, > > Thanks, but i'm a kind of a newbie in PHP and what i've read it's better to > have the register_globals = Off!!! If you look at my code you see that i'm > using the $_GET variable.. This works fine!! It's the IF.. ELSE what gives > me a lot of trouble! > > Frank > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    On Saturday 25 January 2003 19:18, Frank Keessen wrote: > Hi, > > The register_globals = Off. Dit the basic echo ($submit) but it displays > nothing.. > > Any thoughts somebody??

    > > If register_globals is not enabled then you need to use $_POST['submit'] > > (just > > > as you had to use $_POST['vname']).

    !!??!!

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

    /* In matters of principle, stand like a rock; in matters of taste, swim with the current. -- Thomas Jefferson */

    attached mail follows:


    It worked fine till I changed database (just the database-name). Here is the script that is executed untill the line 61:

    - - - GLOBAL.PHP- - - <?php // Pre-load vars $settings = array(); $database = array(); define('XE_VERSION', '0.03a'); define('XE_BUILD', '2003012319'); // Require important Files require './config.inc.php'; require './libs/error.lib.php'; --------------------------------- - - - CONFIG.INC.PHP - - - <?php $database['host'] = 'localhost'; $database['port'] = '3306'; $database['name'] = 'XEngine'; $database['user'] = ''; $database['pass'] = ''; $database['type'] = 'mysql3x'; $database['persistent'] = (bool) false; $database['status'] = 'off';

    $settings['template_type'] = 'file'; // Takes only 'file' or 'db' $settings['pre'] = 'xe_'; ?> ------------------------------ - - - ERROR.LIB.PHP - - - <?php class error{ var $cache; var $last; var $show; var $die; function error(){ $this->cache = array(); $this->last = ''; $this->show = 4; $this->die = 1; define('XE_FATAL', 0); define('XE_ERROR', 1); define('XE_WARNING', 2); define('XE_MINOR', 3); define('XE_NOTICE', 4); } function set($show=4, $die=1){ $this->show = $show; $this->die = $die; return true; } function report($msg, $type){ global $output;

    if($type <= $this->show){ $this->cache[] = $type.'-|-'.$msg; $this->last = $type.'-|-'.$msg; if($this->die >= $type){ $output->finish(); } } return true; } function show($which='all'){ $array = array( 0 => 'FATAL ERROR', 1 => 'ERROR', 2 => 'WARNING', 3 => 'MINOR ERROR', 4 => 'NOTICE' ); if($which=='all'){ foreach($this->cache as $cache){ $errors = explode('-|-', $cache); $type = $errors[0]; $msg = $errors[1]; // line 61 $return[] = array($array[$type], $msg); --------------------------------------------------------------------------

    I hope you can help me with this, because (on the same server), just 2 dirs away, the same script is running smoothly... :S - Tularis

    John W. Holmes wrote:

    >>Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to >>allocate 35 bytes) in >>/home/virtual/site8/fst/var/www/html/staff/libs/error.lib.php on line >> >> >61 > > >>I suddenly got this error on one of my sites, and after rechecking the >>script, it shouldn't be happenning :S >> >>Anyway, I was wondering if this would be a memroy leak? or just some >>standard notice that I'm taking up too much memory ;) >> >> > >What were you doing when it happened? > >---John W. Holmes... > >PHP Architect - A monthly magazine for PHP Professionals. Get your copy >today. http://www.phparch.com/ > > > >

    attached mail follows:


    Hi,

    I have the following code :

    $_fp = fopen("/home/dh2240/mgt/index.php", "a+") or die(); $_contents = fread($_fp,filesize("/home/dh2240/mgt/index.php")); fclose ($_fp); //Menu elements $_sme = strpos("$_contents","sub_menu_elements"); echo "sme = $_sme<p>"; ...

    It should display somthing like "sme = 850", after finding the string in the specified file.

    Under windows, this script works fine (except replacing the "/home/dh2240/mgt/index.php" by "c:/apache/htdocs/mgt/index.php")... it seems that the file index.php cannot be opened under linux... The file is chmod 777, along with the directory /mgt, and the files identical, but still no luck... The fopen does not die(), but it does not seem to read any data from the file... I'm confused, and not sure how to check what is happening... Anyone got any ideas ?

    Cheers, Daniel

    attached mail follows:


    It could be somthing to do with my hoster running Linux in Safe Mode... I am not sure what this could entail, so I'll keep looking. Again, if anyone has any info, it would be appreciated!!!

    Cheers, Daniel

    "Daniel Page" <dlpdlpage.com> a écrit dans le message news: 20030125113940.36706.qmailpb1.pair.com... > Hi, > > I have the following code : > > $_fp = fopen("/home/dh2240/mgt/index.php", "a+") or die(); > $_contents = fread($_fp,filesize("/home/dh2240/mgt/index.php")); > fclose ($_fp); > file://Menu elements > $_sme = strpos("$_contents","sub_menu_elements"); > echo "sme = $_sme<p>"; > ... > > It should display somthing like "sme = 850", after finding the string in the > specified file. > > Under windows, this script works fine (except replacing the > "/home/dh2240/mgt/index.php" by "c:/apache/htdocs/mgt/index.php")... it > seems that the file index.php cannot be opened under linux... > The file is chmod 777, along with the directory /mgt, and the files > identical, but still no luck... The fopen does not die(), but it does not > seem to read any data from the file... I'm confused, and not sure how to > check what is happening... Anyone got any ideas ? > > Cheers, > Daniel > >

    attached mail follows:


    I my self is in the same situation I've started of with a great book http://www.essential-series.com/essential_php.htm which should give you some idea how to begin and the other one i bought which i am still waiting is "Building a Database-Driven Web Site Using PHP and MySql" by Kevin Yank. with these two books you should get head started in CMS. Good luck. geckodeep

    "Chris Shiflett" <shiflettphp.net> wrote in message news:20030125000345.93830.qmailweb14303.mail.yahoo.com... > --- Guru Geek <gurugeek2002g-i-w-s.com> wrote: > > Does anyone out there have any working examples > > of a PHP based CMS? > > http://freshmeat.net/search/?q=PHP+CMS§ion=projects > > Chris

    attached mail follows:


    When will this show up at the news server?

    "Sterling Hughes" <sterlingbumblebury.com> wrote in message news:1043463814.795.97.camelhasele... > A mailing list for discussing the future of PHP and XML development has > been created. You can subscribe by sending a message to > php-xml-dev-subscribelists.php.net (normal ezmlm commands apply). This > mailing list is _only_ intended for actual php extension and api > development, user support questions should remain on > php-generallists.php.net. > > -Sterling > > -- > "Nothing is particularly hard if you divide it into small jobs." > - Henry Ford

    attached mail follows:


    Christian Ista wrote:

    >Hello, > >A friend would like to know how to check on the server (dedicated) if the >function sendmail is enable or not, how ? if not activated how activate ? > >Thanks, >

    If I understand your question correctly (and I may not):

    Assuming RedHat linux, then as root "which sendmail" should return you something like "/usr/sbin/sendmail". This would tell you that it is installed. "ps ax | grep sendmail" should give you "sendmail: accepting connections". This would mean that it is running.

    If it is installed but not running, then "chkconfig --list sendmail" will list the runlevels that it is set to run under. Normally it is 2, 3, 4 and 5. "chkconfig --level 2345 sendmail on" will set it to run at those runlevels, and "service sendmail start" will start it up immediately if it is not running.

    Hope this helps

    Chris

    attached mail follows:


    Thanks for your help Maxim.

    I've got quite a bit to learn. PHP is far more challenging than Cold Fusion.........

    --Noah

    ----- Original Message ----- From: "Maxim Maletsky" <maximphp.net> To: "Noah" <noahnewminddesign.com> Cc: <php-generallists.php.net> Sent: Friday, January 24, 2003 11:02 AM Subject: Re: [PHP] Evaluate PHP var in stored sql statement?

    > > eval takes the string and executes PHP in that string. So, > > eval("\$myrow[2] = \"$myrow[2]\";"); > > is equivalent to: > > $myrow[2] = "$myrow[2]"; > > I'd reccomend you using single quotes and then escape only backslashes > and single quotes within a string > > -- > Maxim Maletsky > maximphp.net > > > > "Noah" <noahnewminddesign.com> wrote... : > > > Don't quite understand why this works, but it does: > > > > /* Escape quotes in sql_query so our header_id gets evaluated */ > > eval("\$myrow[2] = \"$myrow[2]\";"); > > > > What's the deal with the leading backslash in ' eval("\$myrow[2] '? > > > > Does eval() tell php to evaluate the string as php code; i.e. text without > > quotes? > > > > Thanks for the help....... > > > > --Noah > > > > > > ----- Original Message ----- > > From: "Maxim Maletsky" <maximphp.net> > > To: "CF High" <noahnewminddesign.com> > > Cc: <php-generallists.php.net> > > Sent: Friday, January 24, 2003 9:59 AM > > Subject: Re: [PHP] Evaluate PHP var in stored sql statement? > > > > > > > > > > use eval() > > > > > > www.php.net/eval > > > > > > > > > -- > > > Maxim Maletsky > > > maximphp.net > > > > > > > > > > > > "CF High" <noahnewminddesign.com> wrote... : > > > > > > > Hey all. > > > > > > > > I need to find out how to get PHP to evaluate a PHP variable stored in > > our > > > > MySql database. > > > > > > > > Currently the variable is being read as a string; i.e. select * from > > table > > > > where column = $myrow[0] -- instead of evaluating $myrow[0] as a > > variable. > > > > > > > > > > > > The SQL statement is retrieved in the first call to dbConnect (see code > > > > below) > > > > > > > > > > > > > > > > dbConnect("SELECT header_id, header, sql_query FROM cat_headers WHERE > > > > section_id = $_REQUEST[section_id] order by header"); > > > > > > > > $set = $result; /* Give initial result set a unique name */ > > > > > > > > while ($myrow = mysql_fetch_row($set)) { > > > > > > > > echo(Display the header title here); > > > > > > > > > > > > dbConnect($myrow[2]); /* $myrow[2] is the sql_query > > gotten > > > > from the first dbConnect() call */ > > > > > > > > $set1 = $result; /* Give next result set a unique name > > */ > > > > > > > > while ($myrow = mysql_fetch_row($set1)) { > > > > > > > > echo(Display category rows here); > > > > > > > > } > > > > > > > > } > > > > > > > > -- > > > > Any leads/suggestions much appreciated.......... > > > > > > > > --Noah > > > > > > > > > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    no, much less instead

    ---
    Maxim Maletsky
    maximphp.net
    

    On Sat, 25 Jan 2003 09:18:47 -0800 "Noah" <noahnewminddesign.com> wrote:

    > Thanks for your help Maxim. > > I've got quite a bit to learn. PHP is far more challenging than Cold > Fusion......... > > --Noah > > ----- Original Message ----- > From: "Maxim Maletsky" <maximphp.net> > To: "Noah" <noahnewminddesign.com> > Cc: <php-generallists.php.net> > Sent: Friday, January 24, 2003 11:02 AM > Subject: Re: [PHP] Evaluate PHP var in stored sql statement? > > > > > > eval takes the string and executes PHP in that string. So, > > > > eval("\$myrow[2] = \"$myrow[2]\";"); > > > > is equivalent to: > > > > $myrow[2] = "$myrow[2]"; > > > > I'd reccomend you using single quotes and then escape only backslashes > > and single quotes within a string > > > > -- > > Maxim Maletsky > > maximphp.net > > > > > > > > "Noah" <noahnewminddesign.com> wrote... : > > > > > Don't quite understand why this works, but it does: > > > > > > /* Escape quotes in sql_query so our header_id gets evaluated */ > > > eval("\$myrow[2] = \"$myrow[2]\";"); > > > > > > What's the deal with the leading backslash in ' eval("\$myrow[2] '? > > > > > > Does eval() tell php to evaluate the string as php code; i.e. text > without > > > quotes? > > > > > > Thanks for the help....... > > > > > > --Noah > > > > > > > > > ----- Original Message ----- > > > From: "Maxim Maletsky" <maximphp.net> > > > To: "CF High" <noahnewminddesign.com> > > > Cc: <php-generallists.php.net> > > > Sent: Friday, January 24, 2003 9:59 AM > > > Subject: Re: [PHP] Evaluate PHP var in stored sql statement? > > > > > > > > > > > > > > use eval() > > > > > > > > www.php.net/eval > > > > > > > > > > > > -- > > > > Maxim Maletsky > > > > maximphp.net > > > > > > > > > > > > > > > > "CF High" <noahnewminddesign.com> wrote... : > > > > > > > > > Hey all. > > > > > > > > > > I need to find out how to get PHP to evaluate a PHP variable stored > in > > > our > > > > > MySql database. > > > > > > > > > > Currently the variable is being read as a string; i.e. select * from > > > table > > > > > where column = $myrow[0] -- instead of evaluating $myrow[0] as a > > > variable. > > > > > > > > > > > > > > > The SQL statement is retrieved in the first call to dbConnect (see > code > > > > > below) > > > > > > > > > > > > > > > > > > > > dbConnect("SELECT header_id, header, sql_query FROM cat_headers > WHERE > > > > > section_id = $_REQUEST[section_id] order by header"); > > > > > > > > > > $set = $result; /* Give initial result set a unique name */ > > > > > > > > > > while ($myrow = mysql_fetch_row($set)) { > > > > > > > > > > echo(Display the header title here); > > > > > > > > > > > > > > > dbConnect($myrow[2]); /* $myrow[2] is the sql_query > > > gotten > > > > > from the first dbConnect() call */ > > > > > > > > > > $set1 = $result; /* Give next result set a unique > name > > > */ > > > > > > > > > > while ($myrow = mysql_fetch_row($set1)) { > > > > > > > > > > echo(Display category rows here); > > > > > > > > > > } > > > > > > > > > > } > > > > > > > > > > -- > > > > > Any leads/suggestions much appreciated.......... > > > > > > > > > > --Noah > > > > > > > > > > > > > > > > > > > > -- > > > > > PHP General Mailing List (http://www.php.net/) > > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > >

    attached mail follows:


    Hmmmmm......

    Guess I'll find out as I go deeper into PHP........

    --Noah

    ----- Original Message ----- From: "Maxim Maletsky" <maximmaxim.cx> To: "Noah" <noahnewminddesign.com> Cc: <maximphp.net>; <php-generallists.php.net> Sent: Saturday, January 25, 2003 9:47 AM Subject: Re: [PHP] Evaluate PHP var in stored sql statement?

    > no, much less instead > > --- > Maxim Maletsky > maximphp.net > > > On Sat, 25 Jan 2003 09:18:47 -0800 "Noah" <noahnewminddesign.com> wrote: > > > Thanks for your help Maxim. > > > > I've got quite a bit to learn. PHP is far more challenging than Cold > > Fusion......... > > > > --Noah > > > > ----- Original Message ----- > > From: "Maxim Maletsky" <maximphp.net> > > To: "Noah" <noahnewminddesign.com> > > Cc: <php-generallists.php.net> > > Sent: Friday, January 24, 2003 11:02 AM > > Subject: Re: [PHP] Evaluate PHP var in stored sql statement? > > > > > > > > > > eval takes the string and executes PHP in that string. So, > > > > > > eval("\$myrow[2] = \"$myrow[2]\";"); > > > > > > is equivalent to: > > > > > > $myrow[2] = "$myrow[2]"; > > > > > > I'd reccomend you using single quotes and then escape only backslashes > > > and single quotes within a string > > > > > > -- > > > Maxim Maletsky > > > maximphp.net > > > > > > > > > > > > "Noah" <noahnewminddesign.com> wrote... : > > > > > > > Don't quite understand why this works, but it does: > > > > > > > > /* Escape quotes in sql_query so our header_id gets evaluated */ > > > > eval("\$myrow[2] = \"$myrow[2]\";"); > > > > > > > > What's the deal with the leading backslash in ' eval("\$myrow[2] '? > > > > > > > > Does eval() tell php to evaluate the string as php code; i.e. text > > without > > > > quotes? > > > > > > > > Thanks for the help....... > > > > > > > > --Noah > > > > > > > > > > > > ----- Original Message ----- > > > > From: "Maxim Maletsky" <maximphp.net> > > > > To: "CF High" <noahnewminddesign.com> > > > > Cc: <php-generallists.php.net> > > > > Sent: Friday, January 24, 2003 9:59 AM > > > > Subject: Re: [PHP] Evaluate PHP var in stored sql statement? > > > > > > > > > > > > > > > > > > use eval() > > > > > > > > > > www.php.net/eval > > > > > > > > > > > > > > > -- > > > > > Maxim Maletsky > > > > > maximphp.net > > > > > > > > > > > > > > > > > > > > "CF High" <noahnewminddesign.com> wrote... : > > > > > > > > > > > Hey all. > > > > > > > > > > > > I need to find out how to get PHP to evaluate a PHP variable stored > > in > > > > our > > > > > > MySql database. > > > > > > > > > > > > Currently the variable is being read as a string; i.e. select * from > > > > table > > > > > > where column = $myrow[0] -- instead of evaluating $myrow[0] as a > > > > variable. > > > > > > > > > > > > > > > > > > The SQL statement is retrieved in the first call to dbConnect (see > > code > > > > > > below) > > > > > > > > > > > > > > > > > > > > > > > > dbConnect("SELECT header_id, header, sql_query FROM cat_headers > > WHERE > > > > > > section_id = $_REQUEST[section_id] order by header"); > > > > > > > > > > > > $set = $result; /* Give initial result set a unique name */ > > > > > > > > > > > > while ($myrow = mysql_fetch_row($set)) { > > > > > > > > > > > > echo(Display the header title here); > > > > > > > > > > > > > > > > > > dbConnect($myrow[2]); /* $myrow[2] is the sql_query > > > > gotten > > > > > > from the first dbConnect() call */ > > > > > > > > > > > > $set1 = $result; /* Give next result set a unique > > name > > > > */ > > > > > > > > > > > > while ($myrow = mysql_fetch_row($set1)) { > > > > > > > > > > > > echo(Display category rows here); > > > > > > > > > > > > } > > > > > > > > > > > > } > > > > > > > > > > > > -- > > > > > > Any leads/suggestions much appreciated.......... > > > > > > > > > > > > --Noah > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > PHP General Mailing List (http://www.php.net/) > > > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > >

    attached mail follows:


    phpinfo() on PHP Version 4.2.2 with Apache/1.3.24 has a block which called Apache Environment which does not appear in PHP 4.3.0/Apache2. This block of info has (in part):

    DOCUMENT_ROOT /usr/local/apache/htdocs_best-emts HTTP_ACCEPT image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */* HTTP_ACCEPT_ENCODING gzip, deflate HTTP_ACCEPT_LANGUAGE en-us HTTP_CONNECTION Keep-Alive HTTP_COOKIE POSTNUKESID=af2005c09ffd2e5ceecf91eff96ee77d HTTP_HOST www.best-emts.com HTTP_REFERER http://www.best-emts.com/modules.php?op=modload&name=PostWrap&file=index&pag e=http://www.best-emts.com/emts/rosterByNumber.php HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) PATH /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/java/b in:/bd/EMTS/bin:/usr/local/map/bin:/usr/local/mysql/bin REMOTE_ADDR 198.138.213.31 REMOTE_PORT 2010 SCRIPT_FILENAME /usr/local/apache/htdocs_best-emts/emts/rosterByNumber.php SERVER_ADDR 198.138.213.25 ------------------------------------------ Some of the information does not seem to be available elsewhere.

    Is this an undocumented change? Is this a bug in my configuration? What, if anything, am I doing wrong?

    Thanks,

    Ken

    Kenneth Lerman Kenneth.Lermanse-ltd.com Systems Essentials Limited Fax: (203)426-9138 55 Main Street Voice: (203)426-4430 Newtown, CT 06470 http://se-ltd.com/~lerman

    attached mail follows:


    Quick question for the skilled among you,

    Why I ask this: I am currently developing a object to relational mapping layer for PHP. It's NOT a simple treat all databases like one kind of layer (although it does involve it to preserve extensibility) but an XML based intermediate layer that creates both, table structures, following a conventional scheme and PHP classes that allow, OO access to these tables. I have enclosed the XML file that represents the intermediate layer. Its pretty readable even without the XML schema. I am currently under development, so don't expect anything useful in less than a few weeks

    Question: Does anyone of you know anyone who has tried something similar, because my research on the subject grows thin? Is something like this of public interest at all, or would you prefer accessing your datastructure the old fashion way?

    Dominik Wittenbeck ---------------------------------------------------------------- http://www.developaz.com

    begin 666 oo2relationalMapping.xml M/#]X;6P=F5R<VEO;CTB,2XP(C\^#0H\9&%T86)A<V4>&UL;G,](FAT=' Z M+R]W=W<N9&5V96QO<&%Z+F-O;2]S8VAE;6%S+V1A=&%B87-E(CX-"D\<W1R M=6-T=7)E/T*"0D\;V)J96-T(&YA;64](G=O<FME<D)Y3&EV:6YG(B!V:7)T M=6%L/2)Y97,B(&5X=&5N9',](G=O<FME<B(^#0H)"0D\86QI87,;F%M93TB M8V]U;G1R>3(B('!A=&](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L9#X- M"D)"0D)"3QF:65L9"!N86UE/2)L87-T3F%M92(^5VET=&5N8F5C:SPO9FEE M;&0^#0H)"0D)"0D\9FEE;&0;F%M93TB861D<F5S<R(^#0H)"0D)"0D)/'%U M97)Y('-Q;#TB4TE.1TQ%(%-%3$5#5"!A9&1R97-S($923TT8V]M<&%N>2!7 M2$5212!C;VUP86YY+FYA;64])T1E=F5L;W!A>B!.971W;W)K)R(+SX-"D) M"0D)"3PO9FEE;&0^#0H)"0D)"3PO9FEE;&0^#0H)"0D)"3QF:65L9"!N86UE M/2)C;VUP86YY(CY$979E;&]P87H3F5T=V]R:SPO9FEE;&0^#0H)"0D)/"]R M;W<^#0H)"0D\+W)E8V]R9',^#0H)"3PO:6YS97)T/T*#0H)/"]D871A/T* +/"]D871A8F%S93X` ` end

    attached mail follows:


    If I can't use any of those, it's not possible? correct? thank you for your help.

    tommy

    "Jason Wong" <php-generalgremlins.biz> wrote in message news:200301251550.38942.php-generalgremlins.biz... > On Saturday 25 January 2003 06:15, Tommy Jensehaugen wrote: > > > I have a page where I log in as an Apache user. How do I get the apache > > username in php? > > print_r($_SERVER) to see which you can use. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > Thirteen at a table is unlucky only when the hostess has only twelve chops. > -- Groucho Marx > */ >

    attached mail follows:


    On Saturday 25 January 2003 23:41, Tommy Jensehaugen wrote: > "Jason Wong" <php-generalgremlins.biz> wrote in message > news:200301251550.38942.php-generalgremlins.biz... > > > On Saturday 25 January 2003 06:15, Tommy Jensehaugen wrote: > > > I have a page where I log in as an Apache user. How do I get the apache > > > username in php? > > > > print_r($_SERVER) to see which you can use.

    > If I can't use any of those, it's not possible? correct? > thank you for your help.

    I'm assuming you're using HTTP authentication? So create a php page which requires login, then on that page do the above. That will show you all the values that can be obtained from apache.

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

    /* The goys have proven the following theorem... -- Physicist John von Neumann, at the start of a classroom lecture. */

    attached mail follows:


    ----- Original Message ----- From: "Dominik Wittenbeck" <webmasterdevelopaz.com> To: <soaplists.php.net> Sent: Saturday, January 25, 2003 3:28 PM Subject: [SOAP] Re: soap post and http 1.1 100 continue

    > Yep, know that one, > > Why it does happen: > although the HTTP 1.1 spec states that a HTTP 100 SHOULD NOT (or was it MUST > NOT ;-) to the client, unless it requires it by a specific header, IIS does > it with webservices and thereby about any that are published and maintained > with .NET ;-)

    Not quite right :

    An origin server SHOULD NOT send a 100 (Continue) response if the request message does not include an Expect request-header field with the "100-continue" expectation, and MUST NOT send a 100 (Continue) response if such a request comes from an HTTP/1.0 (or earlier) client. There is an exception to this rule: for compatibility with RFC 2068, a server MAY send a 100 (Continue) status in response to an HTTP/1.1 PUT or POST request that does not include an Expect request-header field with the "100-continue" expectation. This exception, the purpose of which is to minimize any client processing delays associated with an undeclared wait for 100 (Continue) status, applies only to HTTP/1.1 requests, and not to requests with any other HTTP-version value.

    > Solution: > A HTTP 100 basically states: "ok I am ready for your content now". You have > probably submitted your content already... resend it, but the content only, > without the \r\n\r\n mark that separates headers from payload with HTTP. > To serve a clean solution you should however go ahead and implement a > listener that tries to hear a HTTP 100. With PHP this is kind of tiresome. > In my implementation I also just resend the payload ;-)

    A HTTP 100 basically states "ok based on your headers I won't reject your body data, so send it now" - handy for services which need to check specific headers. Imagine if the client sent 5MBs of data only to have it knocked back because an authorization header wasn't present. :-)

    I suppose a better solution would be to use the 100-Continue properly (i.e. send headers + with an expect header and no body) or send HTTP/1.0 requests.

    HTH

    Danny.

    attached mail follows:


    Hey all.

    Don't know if this is possible, but here goes:

    I've got a simple switch statement that carries out one of several operations based on the switch statement variable value.

    Each operation has 50 lines of html -- do I have to echo or print all this html!?

    I'm new to PHP so pardon my ignorance here. I'm used to the relative ease of Cold Fusion............

    Thanks for any ideas/suggestions,

    --Noah

    --
    

    attached mail follows:


    > I've got a simple switch statement that carries out one of several > operations based on the switch statement variable value. > > Each operation has 50 lines of html -- do I have to echo or print all > this > html!?

    You could put your HTML into a separate file and just include() it wherever you want it displayed...

    ---John W. Holmes...

    PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

    attached mail follows:


    On Saturday 25 January 2003 20:38, CF High wrote:

    > Each operation has 50 lines of html -- do I have to echo or print all > this html!?

    Try something like <?php switch ($foo) { case 1: ?> <h1>Hello</h1> <?php break; } ?>

    johannes

    attached mail follows:


    No. You can either echo/print with a heredoc (which is still echoing/printing, but is a lot easier) or you can exit PHP. For example: <?php switch($somevar){ case 'case1': print <<< END some html some html some html END; break; case 'case2': print <<< END some html some html some html END; break; } ?>

    Or: <?php switch($somevar){ case 'case1': ?> some html some html some html <?php break; case 'case2': ?> some html some html some html <?php break; } ?>

    CF High wrote:

    >Hey all. > >Don't know if this is possible, but here goes: > >I've got a simple switch statement that carries out one of several >operations based on the switch statement variable value. > >Each operation has 50 lines of html -- do I have to echo or print all this >html!? > >I'm new to PHP so pardon my ignorance here. I'm used to the relative ease >of Cold Fusion............ > >Thanks for any ideas/suggestions, > >--Noah > >-- > > > > > >

    -- 
    The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
    

    attached mail follows:


    That does the trick, although I'm not exactly sure why.

    Shouldn't the html between the <?php case 1: ?> and <?php break; }: ?> statements be executed regardless of whether or not case 1 matches the switch variable?

    In Cold Fusion anything outside of <cfoutput>cf code here</cfoutput> is ignored by the CF language processor; thus the <?php case 1?> html here <?php break; }?> would display the html for each case.

    In any case thanks for workaround -- I would have echoed out all the html otherwise..........

    --Noah

    ----- Original Message ----- From: "Johannes Schlueter" <phpschlueters.de> To: "CF High" <noahnewminddesign.com>; <php-generallists.php.net> Sent: Saturday, January 25, 2003 8:38 AM Subject: Re: [PHP] Switch statement || How to output html without using echo() or print()

    > On Saturday 25 January 2003 20:38, CF High wrote: > > > Each operation has 50 lines of html -- do I have to echo or print all > > this html!? > > Try something like > <?php > switch ($foo) { > case 1: > ?> > <h1>Hello</h1> > <?php > break; > } > ?> > > johannes >

    attached mail follows:


    Hey John.

    While your suggestion certainly will work, I'd prefer not to have an excessive number of include files to keep track of.

    Johannes' suggestion does the trick:

    "Try something like <?php switch ($foo) { case 1: ?> <h1>Hello</h1> <?php break; } ?>"

    ----- Original Message ----- From: "John W. Holmes" <holmes072000charter.net> To: "'CF High'" <noahnewminddesign.com>; <php-generallists.php.net> Sent: Saturday, January 25, 2003 8:42 AM Subject: RE: [PHP] Switch statement || How to output html without using echo() or print()

    > > I've got a simple switch statement that carries out one of several > > operations based on the switch statement variable value. > > > > Each operation has 50 lines of html -- do I have to echo or print > all > > this > > html!? > > You could put your HTML into a separate file and just include() it > wherever you want it displayed... > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > >

    attached mail follows:


    Thanks for the informative response, Leif.

    Looks like you and Johannes are on the same page -- these solutions save a great deal of time.

    Thanks,

    --Noah

    "Leif K-Brooks" <eurleifbuyer-brokerage.com> wrote in message news:3E32C749.8010302buyer-brokerage.com... > No. You can either echo/print with a heredoc (which is still > echoing/printing, but is a lot easier) or you can exit PHP. For example: > <?php > switch($somevar){ > case 'case1': > print <<< END > some html > some html > some html > END; > break; > case 'case2': > print <<< END > some html > some html > some html > END; > break; > } > ?> > > > Or: > <?php > switch($somevar){ > case 'case1': > ?> > some html > some html > some html > <?php > break; > case 'case2': > ?> > some html > some html > some html > <?php > break; > } > ?> > > CF High wrote: > > >Hey all. > > > >Don't know if this is possible, but here goes: > > > >I've got a simple switch statement that carries out one of several > >operations based on the switch statement variable value. > > > >Each operation has 50 lines of html -- do I have to echo or print all this > >html!? > > > >I'm new to PHP so pardon my ignorance here. I'm used to the relative ease > >of Cold Fusion............ > > > >Thanks for any ideas/suggestions, > > > >--Noah > > > >-- > > > > > > > > > > > > > > -- > The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. > > >

    attached mail follows:


    Hello,

    Here is one of my smaller PHP projects. I'm trying to finish it before I move on to my CMS project.

    http://www.g-i-w-s.com/linker_admin.php

    The script does nothing more then manage links. It lists an indexed number of the link, a url, a text description and a delete option. Here's my question. I originally had a link #1, #2, and #3. I obviously deleted them. I was wondering if there is a way to use PHP/MySQL to get the indexed numbers to re-assign so that the first link you see is always #1 the second link you see is always #2 and so on?

    Thanks in advance, Roger

    PS The original script was not mine, it came from a 'php how to' article at web monkey, I did some modifications to fit what I needed. We don't want anyone thinking that I'm taking credit for their knowledge ;-)

    attached mail follows:


    hi

    question about interaction between own state information...

    my problem is very simple: i have an object with a class-member-function which writes a file of about 2MB. the duration of this function is quite long. thats why i'd like to have display informations in a pop-up. for that reason i made a member-variable for getting a counter and set the object into a registerd session. the running writefunction will now increase the counter every time it wirtes information to the file. on the other hand, the pop-up should access the same session and read the counter-variable on the object with the running wirtefunction.

    my problem: i cannot access the session on the pop-up WHILE the writefile function is running. that writefile function is locking the session in some way. that seems logical for me.

    now, how can solve my problem? my main-window should be able to interact with its pop-up-window. i would like to send state information from a running function on the main-window to its pop-up-window. this is refreshing automatically.

    Thanx for every hint or answer Regards, Jürg Zgraggen

    attached mail follows:


    I have a script that takes uploaded images (jpeg only) and makes proportionate thumbnails etc, and saves them in jpeg (.jpg) format again (default compression of %75 I think) anyway, the thumbnails are UGLY. Beauty of content aside, they are discolored, and usually one predominant color takes over the entire picture so they come looking like off-black and white thumbnails. WHY? And how can I fix this/get around it?

    This is some extra info.

    GD Support enabled GD Version 2.0 or higher FreeType Support enabled FreeType Linkage with freetype JPG Support enabled PNG Support enabled WBMP Support enabled

    ______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca

    attached mail follows:


    Use ImageMagick found http://www.imagemagick.org . It is all you need to handle images. Aside the binary external program take a look at this too : http://magick.communityconnect.com/

    best of luck,

    --georgep

    ----- Original Message ----- From: "Victor" <victorargilent.com> To: <php-generallists.php.net> Sent: Saturday, January 25, 2003 10:00 PM Subject: [PHP] GD jpg thumbnail - ugly discollored

    > I have a script that takes uploaded images (jpeg only) and makes > proportionate thumbnails etc, and saves them in jpeg (.jpg) format again > (default compression of %75 I think) anyway, the thumbnails are UGLY. > Beauty of content aside, they are discolored, and usually one > predominant color takes over the entire picture so they come looking > like off-black and white thumbnails. WHY? And how can I fix this/get > around it? > > This is some extra info. > > GD Support enabled > GD Version 2.0 or higher > FreeType Support enabled > FreeType Linkage with freetype > JPG Support enabled > PNG Support enabled > WBMP Support enabled > > > > ______________________________________________________________________ > Post your free ad now! http://personals.yahoo.ca > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    That is not an option since I do not have control over the hosting company.

    -----Original Message----- From: George E. Papadakis [mailto:georgepphaistosnetworks.gr] Sent: Saturday, January 25, 2003 3:20 PM To: Victor; php-generallists.php.net Subject: Re: [PHP] GD jpg thumbnail - ugly discollored

    Use ImageMagick found http://www.imagemagick.org . It is all you need to handle images. Aside the binary external program take a look at this too : http://magick.communityconnect.com/

    best of luck,

    --georgep

    ----- Original Message ----- From: "Victor" <victorargilent.com> To: <php-generallists.php.net> Sent: Saturday, January 25, 2003 10:00 PM Subject: [PHP] GD jpg thumbnail - ugly discollored

    > I have a script that takes uploaded images (jpeg only) and makes > proportionate thumbnails etc, and saves them in jpeg (.jpg) format again > (default compression of %75 I think) anyway, the thumbnails are UGLY. > Beauty of content aside, they are discolored, and usually one > predominant color takes over the entire picture so they come looking > like off-black and white thumbnails. WHY? And how can I fix this/get > around it? > > This is some extra info. > > GD Support enabled > GD Version 2.0 or higher > FreeType Support enabled > FreeType Linkage with freetype > JPG Support enabled > PNG Support enabled > WBMP Support enabled > > > > ______________________________________________________________________

    > Post your free ad now! http://personals.yahoo.ca > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    ______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca