Re: [PHP] [PHP5RC3] echo $this-db-host not work
echo $this-db-host; // will output localhost but echo $this-db-host ; // whill output Object id #2-host is that a bug. or just have to workout by myself? http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP5RC3] echo $this-db-host not work
Try enclosing the variable in Curly Braces echo {$this-db-host} ; Otherwise, the string parser sees $this-db as the variable you're referring to. Chris Tomasen wrote: assume $this-db is an object. $db-host is a string localhost. ehco $this-db-host; // will output localhost but ehco $this-db-host ; // whill output Object id #2-host is that a bug. or just have to workout by myself? Thanks for all your good work Tomasen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Running a PHP script on an automated regular schedule
You may also want to look at wget as a way of invoking your PHP script if command line support is not available. Henry I.A. Gray [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi. I am wanting to use a PHP script to check on an hourly/daily basis on a few things- ie links on my sites, whether the sites are up and running and also to send an e-mail to me. I know how to do this using PHP but my problem is how to have this running 24/7. I can't really have this on a web page as wouldn't it time out? I don't have my own server and so use a hosting company. Is there a way of running a PHP script on a regular basis (say every 10 or 30 mins, or hourly or daily)? Would I have to set up my own server to do this? I just the simplest way of acheiving this. Any ideas? Does anyone know of any decent link checkers written in PHP that I could implement? Many thanks, Ian Gray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [Q] Why does my php file gets displayed instead of executed
Could it be that php files are not executed for POST method? Michael T. Peterson wrote: Per request, here are the two other source files that get executed prior to the invocation of validate_member_login.php, index.php and init.php. But first, here's a simple restatement of the problem: (1) Direct the browser to open index.php (2) init.php is included by index.php. (3) index.php dispatches user to member_login.htm. User fills in username and password fields and then presses the submit button. (4) form action=validate_member_login.php .../ is invoked. (5) The source code of validate_member_login.php is displayed in the browser rather then being executed. However, when the invocation sequence is: (1) Direct the browser directly to member_login.htm and fill in the username and password fields. (2) Press submit. (3) validate_member_login.php is executed properly. Here's index.php. Its purpose is to check the session variables to determine whether the user is logged in. If not, the user is dispatched to member_login.php via redirct using header(). Now, here are the two php files of interest, index.php and init.php. First, index.php, ?php include_once( 'init.php' ); /** * If member is already logged in, his/her username and password values will be available to us. */ if( isset( $HTTP_SESSION_VARS['session_id'] ) isset( $HTTP_SESSION_VARS['username'] ) ) { $session_id = $HTTP_SESSION_VARS['session_id']; $username = $HTTP_SESSION_VARS['username']; $result = authenticate_session( $username, $session_id ); if( $result != SUCCESS ) { if( $result == MEMBER_NOT_REGISTERED ) { header( 'Location: '.MEMBER_REGISTRATION_PAGE ); } else if( $result == PASSWORD_MISMATCH ) { header( 'Location: '.MEMBER_LOGIN_PAGE ); } else { die( $result ); } } header( 'Location: '.MEMBER_HOME_PAGE ); } header( 'Location: '.MEMBER_LOGIN_PAGE ); ? Here is init.php, the file that index.php includes (see above). This file just sets up the exectution environment. ?php session_start(); /** * init.php * * Script that initializes the execution environment. */ // // Check whether this is running on a UNIX or a Windows operating system. // We need to know this to set the include_path separator character // character correctly. // $isWindows = false; $pathDelimiter = ':'; $operatingSystem = PHP_OS; if( strcmp( $operatingSystem, 'WINNT' ) == 0 ) { $isWindows = true; $pathDelimiter = ';'; } // Uncomment and use this symbol when publishing to the internet on ipowerweb. // Yields /home/mazamaso/public_html $WWWROOT = $_SERVER['DOCUMENT_ROOT']; // Set up the dev directory's environment variables. $PROJECT_DIR = $WWWROOT.'/northwest_steelheader'; $MEMBERS_DIR = $PROJECT_DIR.'/members'; $SCRIPTS_DIR= $PROJECT_DIR.'/scripts'; $DB_SCRIPTS_DIR = $SCRIPTS_DIR.'/db'; $UTILS_SCRIPTS_DIR = $SCRIPTS_DIR.'/utils'; $SESSION_SCRIPTS_DIR = $SCRIPTS_DIR.'/security'; $GRAPHICS_DIR= $SCRIPTS_DIR.'/jpgraphics'; $MEMBER_HOME_PAGE = $PROJECT_DIR.'/member_homepage.html'; $MEMBER_LOGIN_PAGE = $MEMBERS_DIR.'/member_login.htm'; $MEMBER_REGISTRATION_PAGE = $MEMBERS_DIR.'/member_registration_form.htm'; $MEMBER_LOGOUT_PAGE = $MEMBERS_DIR.'/member_logout.php'; $INCLUDE_PATH = '.'.$pathDelimiter.$PROJECT_DIR.$pathDelimiter.$DB_SCRIPTS_DIR.$pathDelimite r.$UTILS_SCRIPTS_DIR.$pathDelimiter.$GRAPHICS_DIR.$pathDelimiter.$SESSION_SC RIPTS_DIR; // // Establish the site's environment variables // define( 'PROJECT_DIR', $PROJECT_DIR ); define( 'MEMBERS_DIR', $MEMBERS_DIR ); define( 'SCRIPTS_DIR', $SCRIPTS_DIR ); define( 'DB_DIR', $DB_SCRIPTS_DIR ); define( 'UTILS_DIR', $UTILS_SCRIPTS_DIR ); define( 'SESSION_DIR', $SESSION_SCRIPTS_DIR ); define( 'DEBUG', true ); define( 'MEMBER_HOME_PAGE', $MEMBER_HOME_PAGE ); define( 'MEMBER_LOGIN_PAGE', $MEMBER_LOGIN_PAGE ); define( 'MEMBER_REGISTRATION_PAGE', $MEMBER_REGISTRATION_PAGE ); define( 'MEMBER_LOGOUT_PAGE', $MEMBER_LOGOUT_PAGE ); if( strcmp( $WWWROOT, 'c:/program files/apache group/apache/htdocs' ) == 0 ) { define( 'DB_NAME', '' ); define( 'DB_ADMIN', 'a' ); define( 'DB_PASSWORD', 'b' ); } else { define( 'DB_NAME', '' ); define( 'DB_ADMIN', '' ); define( 'DB_PASSWORD', '' ); } ini_set( 'include_path', $INCLUDE_PATH ); ini_set( 'session.save_path', $PROJECT_DIR.'session_stats'); // These are the base includes, i.e., that apply to every php file in the site include_once( 'print_utils.php' ); include_once( 'mz_error_handler.php' ); include_once( 'db_utils.php' ); include_once( 'passwords.php' ); include_once( 'date_utils.php' ); include_once( 'session_control_lib.php' ); set_error_handler( 'mz_error_handler' ); assert_options( ASSERT_ACTIVE, TRUE ); assert_options( ASSERT_BAIL, TRUE ); ? snip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unset empty elements in an array
On Mon, 12 Jul 2004 15:33:53 +1000, Justin French wrote: Hi, Looking for a one-liner to delete all empty elements in an array. I know I can do it with a foreach loop, but I'm hoping that I've missed an existing function in the manual which may already do this, or a simple one-liner to replace the foreach. ?php foreach($in as $k = $v) { if(empty($v)) { unset($in[$k]); } } ? Sure, a one-liner: foreach ($in as $k = $v ) { if(empty($v)) unset($in[$k]); } ;). Really what do you need an internal function for something simple like that? thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: installing 4.3.x and 5.x
On Sun, 11 Jul 2004 23:17:04 -0400, Alex Duggan wrote: Hello, Is it possible to build php-4.3.x and php-5.0.0RC3 both as static modules into apache-1.3? If so, can the two version of php be installed in the same prefix? or should they be installed in /usr/local/php4 and /usr/local/php5? AFAIK it can only be done with one of these as module, the other as CGI. thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML and PHP output to PHP variable
Hi! Let's say my index.php consists of the following: ? include(header.inc); echo pPHP says Hello World/p; ? pHTML says Hello World/p ? //.. some other php code that generates output... ? ..some other HMTL output.. My question is: how can I make the whole index.php generated output put in one PHP variable? It is also important that it is done from the same index.php file. Thanks, Maris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML and PHP output to PHP variable
hello! use output buffering... ?php ob_start(); //... your code here $_contents = ob_get_contents(); ob_end_clean(); ? regards, m. Maris wrote: Hi! Let's say my index.php consists of the following: ? include(header.inc); echo pPHP says Hello World/p; ? pHTML says Hello World/p ? //.. some other php code that generates output... ? ..some other HMTL output.. My question is: how can I make the whole index.php generated output put in one PHP variable? It is also important that it is done from the same index.php file. Thanks, Maris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML and PHP output to PHP variable
Thanks a lot Miroslav, will try this construction! :) Miroslav Hudak [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] hello! use output buffering... ?php ob_start(); //... your code here $_contents = ob_get_contents(); ob_end_clean(); ? regards, m. Maris wrote: Hi! Let's say my index.php consists of the following: ? include(header.inc); echo pPHP says Hello World/p; ? pHTML says Hello World/p ? //.. some other php code that generates output... ? ..some other HMTL output.. My question is: how can I make the whole index.php generated output put in one PHP variable? It is also important that it is done from the same index.php file. Thanks, Maris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unset empty elements in an array
Justin French wrote: Hi, Looking for a one-liner to delete all empty elements in an array. I know I can do it with a foreach loop, but I'm hoping that I've missed an existing function in the manual which may already do this, or a simple one-liner to replace the foreach. ?php foreach($in as $k = $v) { if(empty($v)) { unset($in[$k]); } } ? --- Justin French http://indent.com.au Though it's not really a one-liner: [code] while ($key = array_search('', $in)) unset($in[$key]); [/code] For more infos on array_seach(): http://www.php.net/array_search Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unset empty elements in an array
Daniel Kullik wrote: Justin French wrote: Hi, Looking for a one-liner to delete all empty elements in an array. I know I can do it with a foreach loop, but I'm hoping that I've missed an existing function in the manual which may already do this, or a simple one-liner to replace the foreach. ?php foreach($in as $k = $v) { if(empty($v)) { unset($in[$k]); } } ? --- Justin French http://indent.com.au Though it's not really a one-liner: [code] while ($key = array_search('', $in)) unset($in[$key]); [/code] For more infos on array_seach(): http://www.php.net/array_search Daniel A note I forgot to addi in my previous posting: You ought to think over what you consider empty since empty() would for example return true if the checked variable contained the integer 0 or the string '0'. My posted line of code recognizes only an empty string as empty. You might want to take a look at this: http://www.php.net/manual/en/types.comparisons.php Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Odd Refresh Error
* Thus wrote Scott Taylor: Some people are complaining that when the visit one of my pages that the pages refeshes over and over again. One person said that it was only when he typed something in on one of the forms. How could an error like this be caused? Could this be a bug in a browser? More like a End User malfunction. Or that your form submision is causing an infinite redirect loop of some sort. Curt -- The infinite loop is what I thought at first too, but wouldn't this show up on all browsers and not just netscape 7.1? What does End User malfunction mean? That people don't know how to use their browsers/the internet? I wouldn't doubt that this is the case unless I didn't have so many people come to me with this - probably there have been at least 5-7 people who have reported this. Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] addslashes vs string unescape
I'm confronted with a somewhat weird problem and hopefully someone can make a suggestion. I have to perform the following 3-step task: Step 1. Someone provides a string (let's call it the formatting string) which contains a PHP expression, which will apply a PHP function on another string, let's call this one the random string. I don't control either the formatting nor the random string. Example of formatting string: trim('%val%') Step 2. As you may have guessed, I have to insert the random string in the formatting string before I can eval() the latter. So I need to replace %val% with the random string. But I have to be careful, since the random string may itself contain either double or single quotes, which will break the eval() later. So I also need an addslashes(). Operations performed: $for_eval=str_replace('%val%',addslashes($random),$format); $for_eval='$final_result='.$for_eval.';'; eval($for_eval); Step 3. After the above, I should have the formatted string in $final_result. *** So now for the problem: addslashes() indiscriminately escapes with backslashes both single and double quotes. Strings variables can be specified with either single or double quotes; each of the cases, in turn, will not un-escape the other type of quote. For example, a string enclosed in double quotes will not un-escape \' and a string enclosed in single quotes will not un-escape \. But my addslashes() escaped both types of quotes. And the formatting string (see step 1) will necessarily have enclosed the string to be (%val%) in only one of the two types of quotes. So, after all steps are performed, I may very well be left with either single or double quotes still escaped, depending on the type of quotes which were used in the formatting string. I was under the impression that double quote strings will be interpreted as to unescape single quotes too. However, the manual says they don't do that; they unescape some common print sequences (such as tab or newline), double quotes (of course), backslash itself, and octal or hexa expressions. NOT single quotes. If only I could be sure of the type of quotes which were used in the formatting string, I could only escape those by hand. But I can't be sure. Also, I can't forcefully strip slashes from the final result, because I don't know which sequences that look like escapes are really escapes or are just legitimate pieces of string. If only double quote strings would un-escape both types of quotes; they don't, so their un-escape action is not a 100% reversion of the addslashes() effect. Any ideas? -- Romanian Web Developers - http://ROWD.ORG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Odd Refresh Error
The problem is in the browser, i have IE 6.0 and some pages on my localhost server have the same problem, sometimes it happend, sometimes not. If i use other browser like Opera the page has no problem. I think this problem is not related to the version, because others with the same version doesnt have the same problem. The problem happend more frequently when i use big tables or long pages. Solution: Upgrade the browser. For the case - Original Message - From: Scott Taylor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 12, 2004 1:38 PM Subject: [PHP] Re: Odd Refresh Error * Thus wrote Scott Taylor: Some people are complaining that when the visit one of my pages that the pages refeshes over and over again. One person said that it was only when he typed something in on one of the forms. How could an error like this be caused? Could this be a bug in a browser? More like a End User malfunction. Or that your form submision is causing an infinite redirect loop of some sort. Curt -- The infinite loop is what I thought at first too, but wouldn't this show up on all browsers and not just netscape 7.1? What does End User malfunction mean? That people don't know how to use their browsers/the internet? I wouldn't doubt that this is the case unless I didn't have so many people come to me with this - probably there have been at least 5-7 people who have reported this. Scott -- 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
[PHP] Cannot send session cookie
Folks I am a new to php. I am currently learning about session handling and would appreciate some assistance with the following: I am using php 4.3.7 and I am using the default values in the php.ini for session.use_cookies = 1 session.cache_limiter = nocache When experimenting with a few simple lines of code script language='php' This is line 14 session_start(); /script I get the following errors: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php on line 15 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php on line 15 Can anyone offer me a insight on the reason for the error. Mike
Re: [PHP] Cannot send session cookie
From: http://www.php.net/manual/en/function.session-start.php Note: If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser. You have to put session_start before anything else. On Mon, 2004-07-12 at 15:40, Michael Purdy wrote: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php on line 15 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php on line 15 Can anyone offer me a insight on the reason for the error. Mike -- I/O, I/O, It's off to disk I go, A bit or byte to read or write, I/O, I/O, I/O... signature.asc Description: This is a digitally signed message part
Re: [PHP] Cannot send session cookie
When experimenting with a few simple lines of code script language='php' This is line 14 session_start(); /script I get the following errors: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php on line 15 What's on lines 1-13? Does it have whitespace or indents on line 14, like in your mail? Any use of headers, get/set cookies, or sessions must happen before any output such as HTML or print/echo is sent to the browser. Generally, it's a good idea to have set-up code such as session_start() be one of the very first things you call in a script. Wrong: htmlhead /body?php session_start() ?/body/html Right: ?php session_start() ?htmlhead /body //html - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Echoing a value
I'm having some trouble echoing a value to a file that is being pulled from a MySQL database. I've included my code below I'm sure it's something really simple but I'm not seeing it. $row['users.name'] and $row['users.company'] echo nothing while $row['cnt'] echoes it's expected values. If anyone can tell me what I'm doing wrong I'd appreciate it. Thanks, Ed $ap = fopen($ad_path/AdCount$issue.txt, w); mysql_connect ($local_host, $local_user, $local_pass); mysql_select_db ($local_db); $result = mysql_query (SELECT *, COUNT(*) as cnt FROM users, listings WHERE listings.user_id = users.id AND listings.active = '1' GROUP BY users.company, users.name); if ($row = mysql_fetch_array($result)) { do { fputs($ap, $row['users.name']); fputs($ap, $sp); fputs($ap, $sp); fputs($ap, $row['users.company']); fputs($ap, $sp); fputs($ap, $sp); fputs($ap, $row['cnt']); fputs($ap, $nl); } while($row = mysql_fetch_array($result)); mysql_close(); } fclose($ap); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] placing values in html teaxtarea
After doing calculations etc on my data I am wanting to place it in a textarea form in html. I am having trouble getting my data to show up in my texarea. For example, say after all my calculations I my field called $test ends up containing This is a test. Here is what I tried: textarea name=zoutput rows=20 cols=70 wrap value=? echo $test; ? / /textarea I can add the $test to input like this but not a textarea. Name: input type=text name=zfname value=? echo $test; ?/ br Is this possible? Thanks, Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] placing values in html teaxtarea
Would you please turn off return receipt in your messages? Thanks! Travis Hull, Douglas D wrote: After doing calculations etc on my data I am wanting to place it in a textarea form in html. I am having trouble getting my data to show up in my texarea. For example, say after all my calculations I my field called $test ends up containing This is a test. Here is what I tried: textarea name=zoutput rows=20 cols=70 wrap value=? echo $test; ? / /textarea I can add the $test to input like this but not a textarea. Name: input type=text name=zfname value=? echo $test; ?/ br Is this possible? Thanks, Doug -- Travis Low mailto:[EMAIL PROTECTED] http://www.dawnstar.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] placing values in html teaxtarea
On Monday 12 July 2004 23:09, Hull, Douglas D wrote: After doing calculations etc on my data I am wanting to place it in a textarea form in html. I am having trouble getting my data to show up in my texarea. For example, say after all my calculations I my field called $test ends up containing This is a test. Here is what I tried: textarea name=zoutput rows=20 cols=70 wrap value=? echo $test; ? / /textarea I can add the $test to input like this but not a textarea. Name: input type=text name=zfname value=? echo $test; ?/ br Is this possible? Please refer to some decent HTML documentation on how the textarea tag works. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Engineering without management is art. -- Jeff Johnson */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot send session cookie
Hi Michael, session_start(); must be the very first line of code on the page, with no whitespaces trailing, else you'll get the 'header already sent' message: ?php session_start(); ? Hth, Andre On Monday 12 July 2004 10:40 am, Michael Purdy wrote: Folks I am a new to php. I am currently learning about session handling and would appreciate some assistance with the following: I am using php 4.3.7 and I am using the default values in the php.ini for session.use_cookies = 1 session.cache_limiter = nocache When experimenting with a few simple lines of code script language='php' This is line 14 session_start(); /script I get the following errors: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php on line 15 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php on line 15 Can anyone offer me a insight on the reason for the error. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Echoing a value
Ed Curtis wrote: I'm having some trouble echoing a value to a file that is being pulled from a MySQL database. I've included my code below I'm sure it's something really simple but I'm not seeing it. $row['users.name'] and $row['users.company'] echo nothing while $row['cnt'] echoes it's expected values. If anyone can tell me what I'm doing wrong I'd appreciate it. Thanks, Ed $ap = fopen($ad_path/AdCount$issue.txt, w); mysql_connect ($local_host, $local_user, $local_pass); mysql_select_db ($local_db); $result = mysql_query (SELECT *, COUNT(*) as cnt FROM users, listings WHERE listings.user_id = users.id AND listings.active = '1' GROUP BY users.company, users.name); if ($row = mysql_fetch_array($result)) { do { fputs($ap, $row['users.name']); fputs($ap, $sp); fputs($ap, $sp); fputs($ap, $row['users.company']); fputs($ap, $sp); fputs($ap, $sp); fputs($ap, $row['cnt']); fputs($ap, $nl); } while($row = mysql_fetch_array($result)); mysql_close(); } fclose($ap); I'm not sure about MySQL, but I know for PostgreSQL when I prefix a field name with a table name in a query I don't need to specify the table name when accessing that fieldname in the query result. Try changing: fputs($ap, $row['users.name']); fputs($ap, $row['users.company']); To: fputs($ap, $row['name']); fputs($ap, $row['company']); That should do the trick. Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: addslashes vs string unescape
Skippy wrote: I'm confronted with a somewhat weird problem and hopefully someone can make a suggestion. I have to perform the following 3-step task: Step 1. Someone provides a string (let's call it the formatting string) which contains a PHP expression, which will apply a PHP function on another string, let's call this one the random string. I don't control either the formatting nor the random string. Example of formatting string: trim('%val%') Step 2. As you may have guessed, I have to insert the random string in the formatting string before I can eval() the latter. So I need to replace %val% with the random string. But I have to be careful, since the random string may itself contain either double or single quotes, which will break the eval() later. So I also need an addslashes(). Operations performed: $for_eval=str_replace('%val%',addslashes($random),$format); $for_eval='$final_result='.$for_eval.';'; eval($for_eval); Step 3. After the above, I should have the formatted string in $final_result. *** So now for the problem: addslashes() indiscriminately escapes with backslashes both single and double quotes. Strings variables can be specified with either single or double quotes; each of the cases, in turn, will not un-escape the other type of quote. For example, a string enclosed in double quotes will not un-escape \' and a string enclosed in single quotes will not un-escape \. But my addslashes() escaped both types of quotes. And the formatting string (see step 1) will necessarily have enclosed the string to be (%val%) in only one of the two types of quotes. So, after all steps are performed, I may very well be left with either single or double quotes still escaped, depending on the type of quotes which were used in the formatting string. I was under the impression that double quote strings will be interpreted as to unescape single quotes too. However, the manual says they don't do that; they unescape some common print sequences (such as tab or newline), double quotes (of course), backslash itself, and octal or hexa expressions. NOT single quotes. If only I could be sure of the type of quotes which were used in the formatting string, I could only escape those by hand. But I can't be sure. Also, I can't forcefully strip slashes from the final result, because I don't know which sequences that look like escapes are really escapes or are just legitimate pieces of string. If only double quote strings would un-escape both types of quotes; they don't, so their un-escape action is not a 100% reversion of the addslashes() effect. Any ideas? Can you use this? [code] ?php // Formatting string from outside - apply a function on a random value $format_string = 'trim();'; // Random value from outside - may contain quotes /-: // Leading and trailing spaces for trim() included $rand_string = eod My name is Bla, I want to do some 'foo'. eod; // Before and after - remember string's original length $strlen_start = strlen($rand_string); // Replacing all single-quotes with double-quotes $rand_string = str_replace(', '', $rand_string); // Combine format string with random string $for_eval = sprintf( '%s%s);', substr($format_string, 0, -2), addslashes($rand_string) ); // Save return value of format-random-combo in $final $for_eval = sprintf('$final = %s', $for_eval); // Dump and eval printf('tt%s/tt', $for_eval); eval($for_eval); // Before and after - remember string's new length $strlen_end = strlen($final); // Results: printf( 'brttbefore: %d, after: %d/tt', $strlen_start, $strlen_end ); ? [/code] Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echoing a value
On Monday 12 July 2004 22:58, Ed Curtis wrote: I'm having some trouble echoing a value to a file that is being pulled from a MySQL database. I've included my code below I'm sure it's something really simple but I'm not seeing it. $row['users.name'] and $row['users.company'] echo nothing while $row['cnt'] echoes it's expected values. If anyone can tell me what I'm doing wrong I'd appreciate it. print_r($row) -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Marriage is the waste-paper basket of the emotions. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] placing values in html teaxtarea
Hi, Tuesday, July 13, 2004, 1:09:25 AM, you wrote: HDD After doing calculations etc on my data I am wanting to HDD place it in a textarea form in html. I am having trouble getting HDD my data to show up in my texarea. For example, say after all my HDD calculations I my field called $test ends up containing This is HDD a test. Here is what I tried: HDD textarea name=zoutput rows=20 cols=70 wrap value=? HDD echo $test; ? / /textarea HDD I can add the $test to input like this but not a textarea. HDD Name: input type=text name=zfname value=? echo $test; ?/ br HDD Is this possible? HDD Thanks, HDD Doug HDD -- HDD PHP General Mailing List (http://www.php.net/) HDD To unsubscribe, visit: http://www.php.net/unsub.php the text has to go between the textarea/textarea like textarea name=zoutput rows=20 cols=70 wrap?echo $test?/textarea -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] easy data port
Hello, I have a real estate customer who wants to keep data about their own listings in a mysql db but wants to also pull data from the mls listing db which is sql server. They want to basically use the mls software and enter into the sql server db but have the php site pull from that server and pump their stuff into the mysql db to add images, etc. I have a list of views and columns from the sql server but is there an easy way to simply move data from the sql sever to the mysql server on a button click for example...short of me mapping every column in the sql server db to a column in the mysql db? Thanks, Eddie WARNING: The information contained in this message and any attachments is intended only for the use of the individual or entity to which it is addressed. This message may contain information that is privileged, confidential and exempt from disclosure under applicable law. It may also contain trade secrets and other proprietary information for which you and your employer may be held liable for disclosing. You are hereby notified that any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify [EMAIL PROTECTED] by E-Mail and then destroy this communication in a manner appropriate for privileged information. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: SOLVED! [PHP] Echoing a value
On Mon, 12 Jul 2004, Pablo Gosse wrote: Try changing: fputs($ap, $row['users.name']); fputs($ap, $row['users.company']); To: fputs($ap, $row['name']); fputs($ap, $row['company']); That should do the trick. Cheers, Pablo That did the trick! I knew it was something simple I was overlooking. Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] placing values in html teaxtarea
On Mon, 12 Jul 2004 10:09:25 -0500, Hull, Douglas D [EMAIL PROTECTED] wrote: After doing calculations etc on my data I am wanting to place it in a textarea form in html. I am having trouble getting my data to show up in my texarea. For example, say after all my calculations I my field called $test ends up containing This is a test. Here is what I tried: textarea name=zoutput rows=20 cols=70 wrap value=? echo $test; ? / /textarea I can add the $test to input like this but not a textarea.Name: input type=text name=zfname value=? echo $test; ?/ br Is this possible? (along the lines of Is your computer powered on?): Did you try: textarea ...echo $test;/textarea? In HTML 4/XHTML 1 and later (might be true for earlier versions, too), the tag textarea doesn't have a value attribute. Instead, the text between the textarea../textarea tags is passed to your script. Thanks, Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] placing values in html teaxtarea
textareas do not use the value attribute. instead, the value is placed between the textarea/textarea tags: textarea name=zoutput rows=20 cols=70 wrap /? echo $test; ?/textarea At 08:09 AM 7/12/2004, Hull, Douglas D wrote: After doing calculations etc on my data I am wanting to place it in a textarea form in html. I am having trouble getting my data to show up in my texarea. For example, say after all my calculations I my field called $test ends up containing This is a test. Here is what I tried: textarea name=zoutput rows=20 cols=70 wrap value=? echo $test; ? / /textarea I can add the $test to input like this but not a textarea. Name: input type=text name=zfname value=? echo $test; ?/ br Is this possible? Thanks, Doug -- 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
Re: [PHP] Cannot send session cookie
Hello, Do you have output buffering enabled in your php.ini file ? --snip-- ; Output buffering allows you to send header lines (including cookies) even ; after you send body content, at the price of slowing PHP's output layer a ; bit. You can enable output buffering during runtime by calling the output ; buffering functions. You can also enable output buffering for all files by ; setting this directive to On. If you wish to limit the size of the buffer ; to a certain size - you can use a maximum number of bytes instead of 'On', as ; a value for this directive (e.g., output_buffering=4096). output_buffering = 4096 --snip-- The session_start() does not have to be the first line of PHP code on the page if you have output buffering enabled. But it should be near the top. Michael. On Tue, 13 Jul 2004 00:40:04 +1000 Michael Purdy [EMAIL PROTECTED] wrote: Folks I am a new to php. I am currently learning about session handling and would appreciate some assistance with the following: I am using php 4.3.7 and I am using the default values in the php.ini for session.use_cookies = 1 session.cache_limiter = nocache When experimenting with a few simple lines of code script language='php' This is line 14 session_start(); /script I get the following errors: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php on line 15 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php on line 15 Can anyone offer me a insight on the reason for the error. Mike -- Michael Gale Network Administrator Utilitran Corporation -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] warning: function registration failed
I installed php-5.0.0 and I get these error when doing php -v PHP Warning: Function registration failed - duplicate name - mssql_connect in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_pconnect in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_close in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_select_db in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_query in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_free_result in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_get_last_message in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_num_rows in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_num_fields in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_fetch_field in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_fetch_row in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_fetch_array in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_fetch_object in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_data_seek in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_field_seek in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_result in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_min_error_severity in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_min_message_severity in Unknown on line 0 PHP Warning: mssql: Unable to register functions, unable to load in Unknown on line 0 I'm using gentoo linux. I downgraded back to php-4x and I'm still getting the errors. What's going on here? How do I fix this? Is it because gentoo now has both the mssql and freetds flags? -- -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: unset empty elements in an array
On 12/07/2004, at 6:38 PM, Thomas Seifert wrote: Really what do you need an internal function for something simple like that? It may be simple, but it's 60 characters I have to type over and over, or a user defined function I have to include() from a library file (and I have to ensure that library file is up to date on 30+ web applications). My view of internal functions is that they solve common, repetitive problems. Sure, some of those problems are quite complex, but others are not. A perfect example would be array_walk() -- it can be solved in a one liner too: foreach ($in as $k = $v ) { $in[$k] = myFunction($v); } ... but someone decided it was useful as an internal function. My hope was that there was such a function to delete empty array elements already defined in PHP, but since it appears there isn't, I'll just keep including my own from a library file. --- Justin French http://indent.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] placing values in html teaxtarea
Keith Greene wrote: Here is what I tried: textarea name=zoutput rows=20 cols=70 wrap value=? echo $test; ? / /textarea textareas do not use the value attribute. instead, the value is placed between the textarea/textarea tags: textarea name=zoutput rows=20 cols=70 wrap /? echo $test; ?/textarea Ensure you run $test through htmlentities() or htmlspecialchars() before placing it in your textarea like this to prevent code injection. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Trouble with arrays from within MySQL results where clause
Hello all, I am having trouble setting array data from within a MySQL results query. I have modified data from the result and wish to enter it into it's own array ($data). That then is used to generate a graph. The following code basically gives me an empty array... I am pulling out a timestamp and signal strength from a live data stream to chart how strong a tower's signal is during the day. The data streams once a minute from several sources. I compare each incoming signal with the if statement and keep the highest signal strength. Each row is then put into the new array. CODE: $data = array(); while ($row1 = mysql_fetch_row ($queryexe1)){ $datetime = $row1[2]; $sig1 = $row1[3]; $sig2 = $row1[6]; $sig3 = $row1[9]; list($date,$time) = explode( ,$datetime); if ($sig1 -150) { $aval = $sig1; } if ($sig2 -150) { $bval = $sig2; } if ($bval $aval) {$aval = bval;} if ($sig3 -150) { $bval = $sig3; } if ($bval $aval) {$aval = $bval;} $data[] = array('$time' = '$time','$aval' = 'aval'); $aval = -999; } $graph-SetDataValues($data); END CODE: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Trouble with arrays from within MySQL results where clause
Nevermind, I figured it out. Simple case of duh... $data[] = array('$time' = '$time','$aval' = 'aval'); Should have been: $data[] = array('$time' = $time ,'$aval' = aval); Thanks. :) -Original Message- From: Eric Boerner [mailto:[EMAIL PROTECTED] Sent: Monday, July 12, 2004 9:06 AM To: [EMAIL PROTECTED] Subject: [PHP] Trouble with arrays from within MySQL results where clause Hello all, I am having trouble setting array data from within a MySQL results query. I have modified data from the result and wish to enter it into it's own array ($data). That then is used to generate a graph. The following code basically gives me an empty array... I am pulling out a timestamp and signal strength from a live data stream to chart how strong a tower's signal is during the day. The data streams once a minute from several sources. I compare each incoming signal with the if statement and keep the highest signal strength. Each row is then put into the new array. CODE: $data = array(); while ($row1 = mysql_fetch_row ($queryexe1)){ $datetime = $row1[2]; $sig1 = $row1[3]; $sig2 = $row1[6]; $sig3 = $row1[9]; list($date,$time) = explode( ,$datetime); if ($sig1 -150) { $aval = $sig1; } if ($sig2 -150) { $bval = $sig2; } if ($bval $aval) {$aval = bval;} if ($sig3 -150) { $bval = $sig3; } if ($bval $aval) {$aval = $bval;} $data[] = array('$time' = '$time','$aval' = 'aval'); $aval = -999; } $graph-SetDataValues($data); END CODE: -- 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
Re: [PHP] Re: addslashes vs string unescape
On Mon, 12 Jul 2004 17:15:15 +0200 Daniel Kullik [EMAIL PROTECTED] wrote: Skippy wrote: Can you use this? It seems to work, at first test, but it's somewhat convoluted. I've found another fairly reasonable solution: using $val instead of %val%. This way I don't need to ever show the actual contents of the random string in the eval() and the problem becomes void. I said fairly reasonable because it will still require a painful porting period and letting people know they should move to $val, but in the long run it will work. Here's a lesson about not testing well enough before deploying. Thank you for the help just the same. -- Skippy - Romanian Web Developers - http://ROWD.ORG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trouble with arrays from within MySQL results where clause
Eric Boerner wrote: Hello all, I am having trouble setting array data from within a MySQL results query. I have modified data from the result and wish to enter it into it's own array ($data). That then is used to generate a graph. The following code basically gives me an empty array... I doubt the array is empty. It may not contain what you think it should, though. Try using print_r() on $data as you run through the code so you can see what it contains. if ($sig1 -150) { $aval = $sig1; } Don't put quotes around -150. As you have it right now, you're comparing strings. If $sig1 is a number, PHP plays nice and assumes you mean -150 instead of -150, though. Also, you don't need quotes around $sig1 at the end of the line. if ($sig2 -150) { $bval = $sig2; } if ($bval $aval) {$aval = bval;} Missing a dollar sign for bval on this line, unless bval is really a constant. Same deal with the quotes, too. if ($sig3 -150) { $bval = $sig3; } if ($bval $aval) {$aval = $bval;} Same deal here with the quotes, also. $data[] = array('$time' = '$time','$aval' = 'aval'); Variables in single quotes are not evaluated. '$val' is not the same as $val. Either way, you don't need any quotes here (assuming you mean $aval for the last entry. $data[] = array($time=$time, $aval=$aval); $aval = -999; $aval = -999; Again, $data has something in it so long as your query is running. It is probably just not what you think it is. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trouble with arrays from within MySQL results where clause
On Tuesday 13 July 2004 00:05, Eric Boerner wrote: I am having trouble setting array data from within a MySQL results query. I have modified data from the result and wish to enter it into it's own array ($data). That then is used to generate a graph. The following code basically gives me an empty array... I am pulling out a timestamp and signal strength from a live data stream to chart how strong a tower's signal is during the day. The data streams once a minute from several sources. I compare each incoming signal with the if statement and keep the highest signal strength. Each row is then put into the new array. CODE: $data = array(); while ($row1 = mysql_fetch_row ($queryexe1)){ $datetime = $row1[2]; $sig1 = $row1[3]; $sig2 = $row1[6]; $sig3 = $row1[9]; list($date,$time) = explode( ,$datetime); if ($sig1 -150) { $aval = $sig1; } if ($sig2 -150) { $bval = $sig2; } if ($bval $aval) {$aval = bval;} if ($sig3 -150) { $bval = $sig3; } if ($bval $aval) {$aval = $bval;} $data[] = array('$time' = '$time','$aval' = 'aval'); $aval = -999; } $graph-SetDataValues($data); END CODE: 1) print_r() ALL variables of interest, in particular $data - I think you'll find that it doesn't contain what you expect. 2) Read manual Types Strings, to find out the difference between enclosing a string in single-quotes and double-quotes. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* The biggest difference between time and space is that you can't reuse time. -- Merrick Furst */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using the mssql functions on a linux server
This may be a dumb question but how do I enable the mssql extension on a Linux server...if possible? I have a site which needs to connect to a mssql db. On my windows server, I just enable the mssql.dll extension...how do I do it on the Linux server? Thanks, Eddie WARNING: The information contained in this message and any attachments is intended only for the use of the individual or entity to which it is addressed. This message may contain information that is privileged, confidential and exempt from disclosure under applicable law. It may also contain trade secrets and other proprietary information for which you and your employer may be held liable for disclosing. You are hereby notified that any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify [EMAIL PROTECTED] by E-Mail and then destroy this communication in a manner appropriate for privileged information. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: unset empty elements in an array
On Tue, 13 Jul 2004 01:57:48 +1000, Justin French [EMAIL PROTECTED] wrote: [...] My hope was that there was such a function to delete empty array elements already defined in PHP, but since it appears there isn't, I'll just keep including my own from a library file. How about array_filter()? From the docs: If the callback function is not supplied, array_filter() will remove all the entries of input that are equal to FALSE. $a = array ('a' = 'foo', 'b' = '', 'c' = null, 'd' = 99, 'e' = 0); print_r (array_filter ($a)); // Output: Array ( [a] = foo [d] = 99 ) As a previous poster noted, though, this will only work for you if 0 and the empty string et al. are not significant in your application. pb -- paul bissex, e-scribe.com -- database-driven web development 413.585.8095 69.55.225.29 01061-0847 72°39'71W 42°19'42N -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File Upload Question
Perhaps this is more about HTML than PHP, but the PHP $_FILES var seems to be set up to allow a list of files to be uploaded. How does one get the pop-up window to allow a user to select (ctrl-click or whatever) multiple files in the same pop-up window? Everything I have tried has left the user restricted to selecting one file only. thanks in advance. Warren Vail
Re: [PHP] File Upload Question
Vail, Warren wrote: Perhaps this is more about HTML than PHP, but the PHP $_FILES var seems to be set up to allow a list of files to be uploaded. How does one get the pop-up window to allow a user to select (ctrl-click or whatever) multiple files in the same pop-up window? Everything I have tried has left the user restricted to selecting one file only. You can only select one file at a time. There's no way to change that. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: File Upload Question
As far as I know, this is not possible. You can however generate more file-upload boxes dynamicly. In this way, users can click an 'Upload another file'-button to display an extra upload form-element. Check the 'variable variables'-part in the PHP reference (user notes) for an example of this construction. Hope this is good solution for your application. greetz, Arnout Boks Warren Vail [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] Perhaps this is more about HTML than PHP, but the PHP $_FILES var seems to be set up to allow a list of files to be uploaded. How does one get the pop-up window to allow a user to select (ctrl-click or whatever) multiple files in the same pop-up window? Everything I have tried has left the user restricted to selecting one file only. thanks in advance. Warren Vail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload Question
you might need to resolve to Java applet or other means to select more than one files at same time. The following is an example: http://barleypop.vrac.iastate.edu/BarleyBase/test/upload/version_05/Upload.php yours, xin - Original Message - From: Vail, Warren [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 12, 2004 12:15 PM Subject: [PHP] File Upload Question Perhaps this is more about HTML than PHP, but the PHP $_FILES var seems to be set up to allow a list of files to be uploaded. How does one get the pop-up window to allow a user to select (ctrl-click or whatever) multiple files in the same pop-up window? Everything I have tried has left the user restricted to selecting one file only. thanks in advance. Warren Vail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: using the mssql functions on a linux server
== Quote from http://php.us.themoes.org/manual/en/ref.mssql.php: == To use the MSSQL extension on Unix/Linux, you first need to build and install the FreeTDS library. Source code and installation instructions are available at the FreeTDS home page: http://www.freetds.org/ Hope this helps you, Arnout Edward Peloke [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] This may be a dumb question but how do I enable the mssql extension on a Linux server...if possible? I have a site which needs to connect to a mssql db. On my windows server, I just enable the mssql.dll extension...how do I do it on the Linux server? Thanks, Eddie WARNING: The information contained in this message and any attachments is intended only for the use of the individual or entity to which it is addressed. This message may contain information that is privileged, confidential and exempt from disclosure under applicable law. It may also contain trade secrets and other proprietary information for which you and your employer may be held liable for disclosing. You are hereby notified that any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify [EMAIL PROTECTED] by E-Mail and then destroy this communication in a manner appropriate for privileged information. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: unset empty elements in an array
* Thus wrote Justin French: On 12/07/2004, at 6:38 PM, Thomas Seifert wrote: My view of internal functions is that they solve common, repetitive problems. Sure, some of those problems are quite complex, but others are not. A perfect example would be array_walk() -- it can be solved in a one liner too: foreach ($in as $k = $v ) { $in[$k] = myFunction($v); } ... but someone decided it was useful as an internal function. My hope was that there was such a function to delete empty array elements already defined in PHP, but since it appears there isn't, I'll just keep including my own from a library file. The problem with your function you want is that it is very specific, the name would have to be something like: unset_array_items_only_if_val_is_empty($array); Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: addslashes vs string unescape
On Mon, 12 Jul 2004 19:32:59 +0300, Skippy [EMAIL PROTECTED] wrote: On Mon, 12 Jul 2004 17:15:15 +0200 Daniel Kullik [EMAIL PROTECTED] wrote: Skippy wrote: Can you use this? It seems to work, at first test, but it's somewhat convoluted. I've found another fairly reasonable solution: using $val instead of %val%. This way I don't need to ever show the actual contents of the random string in the eval() and the problem becomes void. I said fairly reasonable because it will still require a painful porting period and letting people know they should move to $val, but in the long run it will work. Here's a lesson about not testing well enough before deploying. Thank you for the help just the same. Assuming the formatting string is in $formatString and the random string is in $randomString: $evalStr = str_replace('%val%', '$randomString', $formatString); $result = eval('return '.$evalStr); No need to change the way that users format their format string. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: unset empty elements in an array
Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Thus wrote Justin French: On 12/07/2004, at 6:38 PM, Thomas Seifert wrote: My view of internal functions is that they solve common, repetitive problems. Sure, some of those problems are quite complex, but others are not. A perfect example would be array_walk() -- it can be solved in a one liner too: foreach ($in as $k = $v ) { $in[$k] = myFunction($v); } ... but someone decided it was useful as an internal function. My hope was that there was such a function to delete empty array elements already defined in PHP, but since it appears there isn't, I'll just keep including my own from a library file. The problem with your function you want is that it is very specific, the name would have to be something like: unset_array_items_only_if_val_is_empty($array); What about: array_unset_empty_values() or array_remove_empty_values() :-) Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: warning: function registration failed
Try a clean install of PHP5 otherwise head over to the interals list to make sure it won't be a showstopper for the Release sceduled for today. -- red Josh Close wrote: I installed php-5.0.0 and I get these error when doing php -v PHP Warning: Function registration failed - duplicate name - mssql_connect in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_pconnect in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_close in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_select_db in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_query in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_free_result in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_get_last_message in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_num_rows in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_num_fields in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_fetch_field in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_fetch_row in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_fetch_array in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_fetch_object in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_data_seek in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_field_seek in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_result in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_min_error_severity in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - mssql_min_message_severity in Unknown on line 0 PHP Warning: mssql: Unable to register functions, unable to load in Unknown on line 0 I'm using gentoo linux. I downgraded back to php-4x and I'm still getting the errors. What's going on here? How do I fix this? Is it because gentoo now has both the mssql and freetds flags? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHPEclipse?
Hi, I was wondering, is anyone running Eclipse 3.0 w/PHPEclipse 1.1.0? I'm having trouble getting it working. I downloaded the July .ZIP file and unzipped it into the plugins directory. Its not recognizing it. Anyone have this working? -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stripslashes() when reading from the DB
Hi, I usually stripslashes() when I read the info from the database (MySQL). Because the information was inserted after adding slashes, or the system has magic_quotes_gpc set to ON. I'd like to know, if I can do stripslashes() directly, as it is suposed that all data was inserted into DB after slashing the vars. I mean, should I check or not before if magic_quotes_gpc are on ? As I know, magic_quotes_gpc has nothing to do with info readed from the DB, as it only affects Get/Post/Cookie values. I think to make a check like this: $result = mysql_query(SELECT ); $row = mysql_fetch_assoc($result); foreach ($row as $key = $value) { $row[$key] = stripslashes($value); } But not sure if it really necessary, as i'm getting some confusing results. Any help will be welcome Regards, Jordi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: using the mssql functions on a linux server
Is this the only way around it? Can I get to mssql without using the mssql extension? -Original Message- From: Arnout Boks [mailto:[EMAIL PROTECTED] Sent: Monday, July 12, 2004 1:59 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: using the mssql functions on a linux server == Quote from http://php.us.themoes.org/manual/en/ref.mssql.php: == To use the MSSQL extension on Unix/Linux, you first need to build and install the FreeTDS library. Source code and installation instructions are available at the FreeTDS home page: http://www.freetds.org/ Hope this helps you, Arnout Edward Peloke [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] This may be a dumb question but how do I enable the mssql extension on a Linux server...if possible? I have a site which needs to connect to a mssql db. On my windows server, I just enable the mssql.dll extension...how do I do it on the Linux server? Thanks, Eddie WARNING: The information contained in this message and any attachments is intended only for the use of the individual or entity to which it is addressed. This message may contain information that is privileged, confidential and exempt from disclosure under applicable law. It may also contain trade secrets and other proprietary information for which you and your employer may be held liable for disclosing. You are hereby notified that any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify [EMAIL PROTECTED] by E-Mail and then destroy this communication in a manner appropriate for privileged information. -- 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
[PHP] How to use multiple cookie statements
aHere is my code... ? setcookie(cookie[name],$_POST['name'], time()+86400) setcookie (cookie[email],$_POST['email'], time()+86400) setcookie (cookie[bgcolor],$_POST['bgcolor'], time()+86400) setcookie (cookie[tcolor], $_POST['tcolor'], time()+86400) ? I have to use cookies, since I am taking a class and it dictates that we use cookies, but I can't email my instructor since she never responds. So how do I use a cookie to record multiple values? Help would be appreciative.a -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if((strtolower(substr($author, 0, 1)) == $ausenquiry))
Hi, I'm trying to sort my array. My Usort works, but this line only chooses those that begin with an e: if((strtolower(substr($author, 0, 1)) == $ausenquiry)) http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=e is different from: http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=é So how would I recode $ausenquiry so if ausenquiry=e, it will choose words that begin with e, é sorted this way: usort($authors, 'usort_callback'); Here is my source: http://compcanlit.usherbrooke.ca/new1/db/ausenquiry.phps Sorry to throw the entire .inc at you. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to use multiple cookie statements
Ronald The Newbie Allen wrote: aHere is my code... ? setcookie(cookie[name],$_POST['name'], time()+86400) setcookie (cookie[email],$_POST['email'], time()+86400) setcookie (cookie[bgcolor],$_POST['bgcolor'], time()+86400) setcookie (cookie[tcolor], $_POST['tcolor'], time()+86400) ? I have to use cookies, since I am taking a class and it dictates that we use cookies, but I can't email my instructor since she never responds. So how do I use a cookie to record multiple values? Help would be appreciative.a As the standard says, 1 cookie = 1 value, no way to have more than one value in a cookie. But you can think about some workarounds, a quick example just to give you an idea: $cookie = implode(':', $array) Here you will have all values from the array in the cookie, and using : as a separator. To reverse the values: $values = explode(':', $cookie) and here you will have all values in the array $values, starting with index 0. Of course, in this way you can only set values, not the array keys. Look in the manual for implode() and explode() and see if is usefull for you. Regards, Jordi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OO woes
PHP version 5.0.0RC3 (cgi) (built: Jul 9 2004 13:18:24) I'm just getting my feet wet with OO and have run into a problem that I'm not familiar with...yet. I have a class that does a database connection and query all together. It all works nicely untiluntil my query has a word with quotes around it. I've tried addslashes and mysql_escape_string but when I do I get a Fatal Error. It occurs in the execute($query) function down below. I'm also using the recommended php.ini file...magic quotes off and all. * class DB_Mysql { protected $user; // Database username protected $pass; // Database password protected $dbhost;// Database host protected $dbname;// Database name protected $dbh; // Database handle public function __construct($user, $pass, $dbhost, $dbname) { $this-user = $user; $this-pass = $pass; $this-dbhost = $dbhost; $this-dbname = $dbname; } protected function connect() { $this-dbh = mysql_connect($this-dbhost, $this-user, $this-pass); if (!is_resource($this-dbh)) { throw new Exception; } if (!mysql_select_db($this-dbname, $this-dbh)) { throw new Exception; } } public function execute($query) { if (!$this-dbh) { $this-connect(); } // My $query has quotes in it // I try to escape the quotes $query = mysql_escape_string($query); // It causes an error $ret = mysql_query($query, $this-dbh); if (!$ret) { // An Exception error is thrown throw new Exception; } elseif (!is_resource($ret)) { return TRUE; } else { $statment = new DB_MysqlStatement($this-dbh, $query); return $statement; } } } * My query statement is: $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; I call the class as follows: $dbh = new DB_Mysql(user,passwd,localhost,test); $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; $dbh-execute($query); If the $_POST variable does not contain any quotes, the class works perfectly. But whenever quotes are passed through, I get the following error: Fatal error: Uncaught exception 'Exception' in /www/htdocs/classes/db_class.php:53 Stack trace: #0 /www/htdocs/letter.php(51): DB_Mysql-execute('INSERT into aeM...') #1 {main} thrown in /www/htdocs/classes/db_class.php on line 53 --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPEclipse?
On Mon, 2004-07-12 at 12:39, Dan Joseph wrote: I was wondering, is anyone running Eclipse 3.0 w/PHPEclipse 1.1.0? I'm having trouble getting it working. I downloaded the July .ZIP file and unzipped it into the plugins directory. Its not recognizing it. Anyone have this working? I tried it, however, i had no success getting it to work. I tried Trustudio php plugin and got the editor to work. The editor was okay, yet the preferences did not work all that great. The debugger did not work and i did not try and figure out what was wrong with it. This is linux eclipse too. -- Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to use multiple cookie statements
Or if you feel lazy... then you can use serialize / unserialize. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] auto-increment not working?? MySQL
hello. i've got a strange problem with a MySQL table. although my 'id' column is set to 'auto_increment', each new record i insert has the value 1. (instead of 1, 2, 3, etc.) i checked my sql statement and i'm not assigning the id value by mistake. here is my create statement (showing only a few columns from the table for brevity): CREATE TABLE `customers` ( `id` int(10) unsigned NOT NULL auto_increment, `fname` varchar(20) NOT NULL default '', `lname` varchar(20) NOT NULL default '', `is_active` tinyint(4) NOT NULL default '0', PRIMARY KEY (`fname`,`lname`,`email`,`id`), UNIQUE KEY `email` (`email`) ) TYPE=MyISAM; anyone know what's going on?? chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] warning: function registration failed
* Thus wrote Josh Close: I installed php-5.0.0 and I get these error when doing php -v PHP Warning: Function registration failed - duplicate name - mssql_connect in Unknown on line 0 Usually means that that module tried to get loaded twice or that you have that module staticly compiled in and are trying to load the module via an so as well. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to use multiple cookie statements
? setcookie(cookie[name],$_POST['name'], time()+86400) setcookie (cookie[email],$_POST['email'], time()+86400) setcookie (cookie[bgcolor],$_POST['bgcolor'], time()+86400) setcookie (cookie[tcolor], $_POST['tcolor'], time()+86400) ? you could try this: setcookie ('values', serialize($_POST), time()+86400); then when you want to retrieve it use $values = unserialize($_COOKIE['values']); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stripslashes() when reading from the DB
On Mon, 12 Jul 2004 20:45:12 +0200, Jordi Canals [EMAIL PROTECTED] wrote: Hi, I usually stripslashes() when I read the info from the database (MySQL). Because the information was inserted after adding slashes, or the system has magic_quotes_gpc set to ON. I'd like to know, if I can do stripslashes() directly, as it is suposed that all data was inserted into DB after slashing the vars. I mean, should I check or not before if magic_quotes_gpc are on ? As I know, magic_quotes_gpc has nothing to do with info readed from the DB, as it only affects Get/Post/Cookie values. I think to make a check like this: $result = mysql_query(SELECT ); $row = mysql_fetch_assoc($result); foreach ($row as $key = $value) { $row[$key] = stripslashes($value); } But not sure if it really necessary, as i'm getting some confusing results. What you *should* be doing is check for magic quotes when inserting into the DB. if(!get_magic_quotes_gpc()) { $value = mysql_real_escape_string($value); } $query = 'INSERT INTO table (field) VALUES ('.$value.')'; mysql_query($query); -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Exceptions
public function execute($query) { if (!$this-dbh) { $this-connect(); } // My $query has quotes in it // I try to escape the quotes $query = mysql_escape_string($query); // It causes an error $ret = mysql_query($query, $this-dbh); if (!$ret) { // An Exception error is thrown throw new Exception; } elseif (!is_resource($ret)) { return TRUE; } else { $statment = new DB_MysqlStatement($this-dbh, $query); return $statement; } } } * My query statement is: $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; I call the class as follows: $dbh = new DB_Mysql(user,passwd,localhost,test); $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; $dbh-execute($query); If the $_POST variable does not contain any quotes, the class works perfectly. But whenever quotes are passed through, I get the following error: Fatal error: Uncaught exception 'Exception' in Uncaught exceptions happen whenever you THROW an exception that isn't caught. This allows you to do certain things when exceptions happen and try to recover from the error. So, it should work when you try this: try { $dbh = new DB_Mysql(user,passwd,localhost,test); $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; $dbh-execute($query); } catch (Exception $e) { // This just prints, but you could do other things like ignoring // the error or trying to reconnect, etc. echo $e-getMessage(); print_r( $e-getTrace() ); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OO woes
Hi, Doesn't sound like an OO issue, sounds like you're kiling the query with the '. You should go thru and maybe do an str_replace( ', \', $_POST['test'] ) on all your post variables. -Dan Joseph -Original Message- From: Matthew Sims [mailto:[EMAIL PROTECTED] Sent: Monday, July 12, 2004 4:08 PM To: [EMAIL PROTECTED] Subject: [PHP] OO woes Importance: High PHP version 5.0.0RC3 (cgi) (built: Jul 9 2004 13:18:24) I'm just getting my feet wet with OO and have run into a problem that I'm not familiar with...yet. I have a class that does a database connection and query all together. It all works nicely untiluntil my query has a word with quotes around it. I've tried addslashes and mysql_escape_string but when I do I get a Fatal Error. It occurs in the execute($query) function down below. I'm also using the recommended php.ini file...magic quotes off and all. * class DB_Mysql { protected $user; // Database username protected $pass; // Database password protected $dbhost;// Database host protected $dbname;// Database name protected $dbh; // Database handle public function __construct($user, $pass, $dbhost, $dbname) { $this-user = $user; $this-pass = $pass; $this-dbhost = $dbhost; $this-dbname = $dbname; } protected function connect() { $this-dbh = mysql_connect($this-dbhost, $this-user, $this-pass); if (!is_resource($this-dbh)) { throw new Exception; } if (!mysql_select_db($this-dbname, $this-dbh)) { throw new Exception; } } public function execute($query) { if (!$this-dbh) { $this-connect(); } // My $query has quotes in it // I try to escape the quotes $query = mysql_escape_string($query); // It causes an error $ret = mysql_query($query, $this-dbh); if (!$ret) { // An Exception error is thrown throw new Exception; } elseif (!is_resource($ret)) { return TRUE; } else { $statment = new DB_MysqlStatement($this-dbh, $query); return $statement; } } } * My query statement is: $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; I call the class as follows: $dbh = new DB_Mysql(user,passwd,localhost,test); $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; $dbh-execute($query); If the $_POST variable does not contain any quotes, the class works perfectly. But whenever quotes are passed through, I get the following error: Fatal error: Uncaught exception 'Exception' in /www/htdocs/classes/db_class.php:53 Stack trace: #0 /www/htdocs/letter.php(51): DB_Mysql-execute('INSERT into aeM...') #1 {main} thrown in /www/htdocs/classes/db_class.php on line 53 --Matthew Sims --http://killermookie.org -- 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
RE: [PHP] PHPEclipse?
LOL.. I read all these PHPEclipse is great! reviews. It relaly does look good. Bummer you couldn't get it working either. I have EPIC installed, a Perl plug-in, its working fine, so I know plugins are working. Ahh well, maybe someone will read the list and have an answer. -Dan Joseph -Original Message- From: Ray Hunter [mailto:[EMAIL PROTECTED] Sent: Monday, July 12, 2004 4:02 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] PHPEclipse? On Mon, 2004-07-12 at 12:39, Dan Joseph wrote: I was wondering, is anyone running Eclipse 3.0 w/PHPEclipse 1.1.0? I'm having trouble getting it working. I downloaded the July .ZIP file and unzipped it into the plugins directory. Its not recognizing it. Anyone have this working? I tried it, however, i had no success getting it to work. I tried Trustudio php plugin and got the editor to work. The editor was okay, yet the preferences did not work all that great. The debugger did not work and i did not try and figure out what was wrong with it. This is linux eclipse too. -- Ray -- 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
Re: [PHP] How to use multiple cookie statements
I have to use cookies, since I am taking a class and it dictates that we use cookies, but I can't email my instructor since she never responds. So how do I use a cookie to record multiple values? Help would be appreciative.a A few options: use multiple cookies, e.g. setcookie('cookie_a'), setcookie('cookie_b'), etc. Jordi's suggestion is also good, though I would suggest using serialize() to make a single string out of your values, like this: serialize(array('name1' = 'value', 'name2' = 'value'). Or, use PHP's built-in session support. The cookie stores a unique ID, whie the actual values are stored on the server. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OO woes
Hi, Doesn't sound like an OO issue, sounds like you're kiling the query with the '. You should go thru and maybe do an str_replace( ', \', $_POST['test'] ) on all your post variables. -Dan Joseph Ha! That did it. Thanks! --Matthew Sims --http://killermookie.org -Original Message- From: Matthew Sims [mailto:[EMAIL PROTECTED] Sent: Monday, July 12, 2004 4:08 PM To: [EMAIL PROTECTED] Subject: [PHP] OO woes Importance: High PHP version 5.0.0RC3 (cgi) (built: Jul 9 2004 13:18:24) I'm just getting my feet wet with OO and have run into a problem that I'm not familiar with...yet. I have a class that does a database connection and query all together. It all works nicely untiluntil my query has a word with quotes around it. I've tried addslashes and mysql_escape_string but when I do I get a Fatal Error. It occurs in the execute($query) function down below. I'm also using the recommended php.ini file...magic quotes off and all. * class DB_Mysql { protected $user; // Database username protected $pass; // Database password protected $dbhost;// Database host protected $dbname;// Database name protected $dbh; // Database handle public function __construct($user, $pass, $dbhost, $dbname) { $this-user = $user; $this-pass = $pass; $this-dbhost = $dbhost; $this-dbname = $dbname; } protected function connect() { $this-dbh = mysql_connect($this-dbhost, $this-user, $this-pass); if (!is_resource($this-dbh)) { throw new Exception; } if (!mysql_select_db($this-dbname, $this-dbh)) { throw new Exception; } } public function execute($query) { if (!$this-dbh) { $this-connect(); } // My $query has quotes in it // I try to escape the quotes $query = mysql_escape_string($query); // It causes an error $ret = mysql_query($query, $this-dbh); if (!$ret) { // An Exception error is thrown throw new Exception; } elseif (!is_resource($ret)) { return TRUE; } else { $statment = new DB_MysqlStatement($this-dbh, $query); return $statement; } } } * My query statement is: $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; I call the class as follows: $dbh = new DB_Mysql(user,passwd,localhost,test); $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; $dbh-execute($query); If the $_POST variable does not contain any quotes, the class works perfectly. But whenever quotes are passed through, I get the following error: Fatal error: Uncaught exception 'Exception' in /www/htdocs/classes/db_class.php:53 Stack trace: #0 /www/htdocs/letter.php(51): DB_Mysql-execute('INSERT into aeM...') #1 {main} thrown in /www/htdocs/classes/db_class.php on line 53 --Matthew Sims --http://killermookie.org -- 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
Re: [PHP] PHPEclipse?
Hi, I am currently using Eclipse 3.0 with latest build of PHPEclipse on Linux. Just great. Did not tried debugger, however. On Monday 12 July 2004 09:39 pm, Dan Joseph wrote: Hi, I was wondering, is anyone running Eclipse 3.0 w/PHPEclipse 1.1.0? I'm having trouble getting it working. I downloaded the July .ZIP file and unzipped it into the plugins directory. Its not recognizing it. Anyone have this working? -Dan Joseph -- *** with best regards *** Andrei Verovski (aka MacGuru) *** Mac, Linux, DTP, Programming Web Site *** *** http://snow.prohosting.com/guru4mac/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHPEclipse?
How did you get it installed? Did you just extract the zip into the plugins directory? -Dan Joseph -Original Message- From: Andrei Verovski (aka MacGuru) [mailto:[EMAIL PROTECTED] Sent: Monday, July 12, 2004 4:36 PM To: [EMAIL PROTECTED] Cc: Dan Joseph Subject: Re: [PHP] PHPEclipse? Hi, I am currently using Eclipse 3.0 with latest build of PHPEclipse on Linux. Just great. Did not tried debugger, however. On Monday 12 July 2004 09:39 pm, Dan Joseph wrote: Hi, I was wondering, is anyone running Eclipse 3.0 w/PHPEclipse 1.1.0? I'm having trouble getting it working. I downloaded the July .ZIP file and unzipped it into the plugins directory. Its not recognizing it. Anyone have this working? -Dan Joseph -- *** with best regards *** Andrei Verovski (aka MacGuru) *** Mac, Linux, DTP, Programming Web Site *** *** http://snow.prohosting.com/guru4mac/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] auto-increment not working?? MySQL
[snip] i've got a strange problem with a MySQL table. although my 'id' column is set to 'auto_increment', each new record i insert has the value 1. (instead of 1, 2, 3, etc.) i checked my sql statement and i'm not assigning the id value by mistake. here is my create statement (showing only a few columns from the table for brevity): CREATE TABLE `customers` ( `id` int(10) unsigned NOT NULL auto_increment, `fname` varchar(20) NOT NULL default '', `lname` varchar(20) NOT NULL default '', `is_active` tinyint(4) NOT NULL default '0', PRIMARY KEY (`fname`,`lname`,`email`,`id`), UNIQUE KEY `email` (`email`) ) TYPE=MyISAM; anyone know what's going on?? [/snip] The guys on the MySQL list do. Have you read this-- http://dev.mysql.com/doc/mysql/en/example-AUTO_INCREMENT.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO woes
$query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; Your quotes look screwy to me. You seem to be missing both trailing single quotes. try this: $query = 'INSERT into aeMail set test=\'''.$_POST[test].'\'''; At 01:07 PM 7/12/2004, Matthew Sims wrote: PHP version 5.0.0RC3 (cgi) (built: Jul 9 2004 13:18:24) I'm just getting my feet wet with OO and have run into a problem that I'm not familiar with...yet. I have a class that does a database connection and query all together. It all works nicely untiluntil my query has a word with quotes around it. I've tried addslashes and mysql_escape_string but when I do I get a Fatal Error. It occurs in the execute($query) function down below. I'm also using the recommended php.ini file...magic quotes off and all. * class DB_Mysql { protected $user; // Database username protected $pass; // Database password protected $dbhost;// Database host protected $dbname;// Database name protected $dbh; // Database handle public function __construct($user, $pass, $dbhost, $dbname) { $this-user = $user; $this-pass = $pass; $this-dbhost = $dbhost; $this-dbname = $dbname; } protected function connect() { $this-dbh = mysql_connect($this-dbhost, $this-user, $this-pass); if (!is_resource($this-dbh)) { throw new Exception; } if (!mysql_select_db($this-dbname, $this-dbh)) { throw new Exception; } } public function execute($query) { if (!$this-dbh) { $this-connect(); } // My $query has quotes in it // I try to escape the quotes $query = mysql_escape_string($query); // It causes an error $ret = mysql_query($query, $this-dbh); if (!$ret) { // An Exception error is thrown throw new Exception; } elseif (!is_resource($ret)) { return TRUE; } else { $statment = new DB_MysqlStatement($this-dbh, $query); return $statement; } } } * My query statement is: $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; I call the class as follows: $dbh = new DB_Mysql(user,passwd,localhost,test); $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; $dbh-execute($query); If the $_POST variable does not contain any quotes, the class works perfectly. But whenever quotes are passed through, I get the following error: Fatal error: Uncaught exception 'Exception' in /www/htdocs/classes/db_class.php:53 Stack trace: #0 /www/htdocs/letter.php(51): DB_Mysql-execute('INSERT into aeM...') #1 {main} thrown in /www/htdocs/classes/db_class.php on line 53 --Matthew Sims --http://killermookie.org -- 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
Re: [PHP] OO woes
Your problem has nothing to do with the Objects (or really even PHP for that matter). You're not supposed to run mysql_escape_string on an entire query. Here's an example of its usage: $sString = This string contains a single-quote ('); $sQuery = INSERT INTO mytable SET mystrcolumn='{$sString}',mynumbercolumn=24; INSERT INTO mytable SET mystrcolumn='This string contains a single-quote (')',mynumbercolumn=24 == $sQuery; // This just shows what's in $sQuery If you were to run $sQuery as it is, it would not parse because the single-quote in $sString would indicate the end of that string, and the characters following it aren't valid SQL. But, if you were to use mysql_escape_string on $sString, before putting it in the query, everything would work out fine. $sString = This string contains a single-quote ('); $sString = mysql_escape_string($sString); $sQuery = INSERT INTO mytable SET mystrcolumn='{$sString}',mynumbercolumn=24; INSERT INTO mytable SET mystrcolumn='This string contains a single-quote (\')',mynumbercolumn=24 == $sQuery; // This just shows what's in $sQuery Now the single-quote in $sString has been escaped, and MySQL doesn't see it as the string delimiter. On a side note, mysql_real_escape_string would probably be prefferable, as it takes into accoutnt he character set of the current connection. Chris Matthew Sims wrote: PHP version 5.0.0RC3 (cgi) (built: Jul 9 2004 13:18:24) I'm just getting my feet wet with OO and have run into a problem that I'm not familiar with...yet. I have a class that does a database connection and query all together. It all works nicely untiluntil my query has a word with quotes around it. I've tried addslashes and mysql_escape_string but when I do I get a Fatal Error. It occurs in the execute($query) function down below. I'm also using the recommended php.ini file...magic quotes off and all. * class DB_Mysql { protected $user; // Database username protected $pass; // Database password protected $dbhost;// Database host protected $dbname;// Database name protected $dbh; // Database handle public function __construct($user, $pass, $dbhost, $dbname) { $this-user = $user; $this-pass = $pass; $this-dbhost = $dbhost; $this-dbname = $dbname; } protected function connect() { $this-dbh = mysql_connect($this-dbhost, $this-user, $this-pass); if (!is_resource($this-dbh)) { throw new Exception; } if (!mysql_select_db($this-dbname, $this-dbh)) { throw new Exception; } } public function execute($query) { if (!$this-dbh) { $this-connect(); } // My $query has quotes in it // I try to escape the quotes $query = mysql_escape_string($query); // It causes an error $ret = mysql_query($query, $this-dbh); if (!$ret) { // An Exception error is thrown throw new Exception; } elseif (!is_resource($ret)) { return TRUE; } else { $statment = new DB_MysqlStatement($this-dbh, $query); return $statement; } } } * My query statement is: $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; I call the class as follows: $dbh = new DB_Mysql(user,passwd,localhost,test); $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; $dbh-execute($query); If the $_POST variable does not contain any quotes, the class works perfectly. But whenever quotes are passed through, I get the following error: Fatal error: Uncaught exception 'Exception' in /www/htdocs/classes/db_class.php:53 Stack trace: #0 /www/htdocs/letter.php(51): DB_Mysql-execute('INSERT into aeM...') #1 {main} thrown in /www/htdocs/classes/db_class.php on line 53 --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] auto-increment not working?? MySQL
Your primary key should be only (`id`). On Mon, 12 Jul 2004 13:04:19 -0700, barophobia [EMAIL PROTECTED] wrote: hello. i've got a strange problem with a MySQL table. although my 'id' column is set to 'auto_increment', each new record i insert has the value 1. (instead of 1, 2, 3, etc.) i checked my sql statement and i'm not assigning the id value by mistake. here is my create statement (showing only a few columns from the table for brevity): CREATE TABLE `customers` ( `id` int(10) unsigned NOT NULL auto_increment, `fname` varchar(20) NOT NULL default '', `lname` varchar(20) NOT NULL default '', `is_active` tinyint(4) NOT NULL default '0', PRIMARY KEY (`fname`,`lname`,`email`,`id`), UNIQUE KEY `email` (`email`) ) TYPE=MyISAM; anyone know what's going on?? chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40f2f0f6322131004619089! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exceptions
if (!$ret) { // An Exception error is thrown throw new Exception; } elseif (!is_resource($ret)) { return TRUE; } else { $statment = new DB_MysqlStatement($this-dbh, $query); return $statement; } Fatal error: Uncaught exception 'Exception' in Uncaught exceptions happen whenever you THROW an exception that isn't caught. This allows you to do certain things when exceptions happen and try to recover from the error. So, it should work when you try this: try { $dbh = new DB_Mysql(user,passwd,localhost,test); $query = 'INSERT into aeMail set test=\''.$_POST[test].'\''; $dbh-execute($query); } catch (Exception $e) { // This just prints, but you could do other things like ignoring // the error or trying to reconnect, etc. echo $e-getMessage(); print_r( $e-getTrace() ); } Nice, that makes it easier on the eyes to read. --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPEclipse?
On Monday 12 July 2004 11:27 pm, Dan Joseph wrote: How did you get it installed? Did you just extract the zip into the plugins directory? Yes. -- *** with best regards *** Andrei Verovski (aka MacGuru) *** Mac, Linux, DTP, Programming Web Site *** *** http://snow.prohosting.com/guru4mac/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stripslashes() when reading from the DB
I usually stripslashes() when I read the info from the database (MySQL). Because the information was inserted after adding slashes, or the system has magic_quotes_gpc set to ON. I'd like to know, if I can do stripslashes() directly, as it is suposed that all data was inserted into DB after slashing the vars. I mean, should I check or not before if magic_quotes_gpc are on ? As I know, magic_quotes_gpc has nothing to do with info readed from the DB, as it only affects Get/Post/Cookie values. I think to make a check like this: $result = mysql_query(SELECT ); $row = mysql_fetch_assoc($result); foreach ($row as $key = $value) { $row[$key] = stripslashes($value); } But not sure if it really necessary, as i'm getting some confusing results. What you *should* be doing is check for magic quotes when inserting into the DB. if(!get_magic_quotes_gpc()) { $value = mysql_real_escape_string($value); } $query = 'INSERT INTO table (field) VALUES ('.$value.')'; mysql_query($query); To add further comment. If you're required to run stripslashes() on data coming out of your database then you did something wrong. Your code would have essentially looked like the following before insertion: $var = addslashes(addslashes($var)); Where 'magic_quotes_gpc = on' essentially executed one of those addslashes(). The above use of get_magic_quotes_gpc() shows you how to add slashes just once thus not having a bunch of \' type badness inside your database. Remember backslashes are only added to make proper strings for db insertion so the backslashes should never actually make it into the database. Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] auto-increment not working?? MySQL
On Mon, 12 Jul 2004 15:36:20 -0500, Jay Blanchard [EMAIL PROTECTED] wrote: The guys on the MySQL list do. Have you read this-- http://dev.mysql.com/doc/mysql/en/example-AUTO_INCREMENT.html not for this issue no. the problem for those that read this later is not that i am using multiple primary keys but rather the order in which they are defined. 'id' should be first in the list. once i moved 'id' to the first spot the table began incrementing as per expected behavior. thanks jay. chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array indexes as arguments to a function
please CC me, as I am on digest. --- say I've got a class that stores the cookie/get/post vars. I want to retrieve say one of them. Say, that post vars come back from browser as: POST[var1_arr][dim1][dim2] they are stored in object-post_vars[var1_arr][dim1][dim2]; object-post_vars[singleton]; I have the function class-get_post_var($index_arr){ return correct, processed post var; } How can I get the function to return an arbitrary depth into the post vars array? i.e. EITHER return $this-class_user_input_processing_function( $this-post_vars, $index_arr); Where $index_arr contains either: $index_arr = array(var1_arr,dim1_value, dim2_value); -or- $index_arr = array(singleton); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO woes
Your problem has nothing to do with the Objects (or really even PHP for that matter). You're not supposed to run mysql_escape_string on an entire query. Yup, you are correct, my bad. So I ran my $_POST array into array_map before the injection: $_POST = array_map(mysql_escape_string,$_POST); And it all worked on nicely. --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stripslashes() when reading from the DB
Jordi Canals wrote: I usually stripslashes() when I read the info from the database (MySQL). Because the information was inserted after adding slashes, or the system has magic_quotes_gpc set to ON. I remember being taught this lesson long ago. :) You do not need to strip slashes from the data being read from the database. If you find yourself having to do that, then you're escaping the data twice before it's inserted. You more than likely have magic_quotes_gpc enabled which escapes all incoming GET, POST and COOKIE data and then you are running addslashes() yourself. You should check the magic_quotes setting with get_magic_quotes_gpc() and then determine if you need to use addslashes or mysql_real_escape_string(). -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO woes
Matthew Sims wrote: Your problem has nothing to do with the Objects (or really even PHP for that matter). You're not supposed to run mysql_escape_string on an entire query. So I ran my $_POST array into array_map before the injection: $_POST = array_map(mysql_escape_string,$_POST); And it all worked on nicely. That's a waste of resources when you're only using one value out of $_POST in your query. Why not just turn on magic_quotes_gpc and have the same effect? I'd recommend some actual validation methods in your class. Something to ensure $_POST'd values are really integers within a range, strings of a certain length, etc and prepare them for insertion into a query. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and HTML Conventions
Hi all. I just wondered if the general convention was to use entirely PHP and simply encase HTML TAGs within that or use a mix and simply use PHP TAGs when required. -- - Michael Mason Arras People www.arraspeople.co.uk - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stripslashes() when reading from the DB
Philip Olson wrote: I usually stripslashes() when I read the info from the database (MySQL). Because the information was inserted after adding slashes, or the system has magic_quotes_gpc set to ON. To add further comment. If you're required to run stripslashes() on data coming out of your database then you did something wrong. Your code would have essentially looked like the following before insertion: Wow, here where just my mistake :p I have magic_quotes_gpc at ON and I do not use addslashes. I use a custom .htaccess file to ensure magic_quotes_gpc are ON ... But in a class used to create the forms, there is a striplashes(), so the extrange I've seen. Removed stripslashes from the function, solved the problem. Just have to work to see how manage the form when data comes from a previos post (Which have slashes) or comes from DB (Which have NOT). Thanks to all to help me to clarify this point. Jordi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and HTML Conventions
Hi all. I just wondered if the general convention was to use entirely PHP and simply encase HTML TAGs within that or use a mix and simply use PHP TAGs when required. -- - Michael Mason I'm trying to get myself to use PHP tags when required. When I first started learning PHP with HTML I would encase entire tables under PHP tags out of bad learning habits. Not only was it ugly to look at (so many echo statments, quotes () and escape slashes (\) ) but it became really hard to read the code. Also, using the PHP tags can mean fewer characters in your webpage making it slightly smaller. But...that's just my preference. :) --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [Q] Using $_SERVER['DOCUMENT_ROOT'] correctly
I'm attempting to define a set of environment variables that will allow me to edit and test my web pages on my local machine and then upload to my ISP for verification and publication without having to change any symbols. What variable should I use for the document root? Here's how some of the symbols were defined: $WWWROOT = $_SERVER['DOCUMENT_ROOT']; // Set up the dev directory's environment variables. $PROJECT_DIR = $WWWROOT.'/my_web_site'; $MEMBERS_DIR = $PROJECT_DIR.'/members'; ... etc, On my machine (a winxp system), the symbols and path get set properly and everything works great. However, when I upload the pages to my ISP's machine (a unix system), I get a 404 page not found error when trying to dispatch to /home/mtpweb/public_html/my_web_site/members/member_login.htm (the file exists On my local machine $_SERVER['DOCUMENT_ROOT'] is c:/program files/apache group/apache/htdocs On my ISP's machine the path is /home/mtpweb/public_html. Should I be using something other that $_SERVER['DOCUMENT_ROOT']? Cheers, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to use multiple cookie statements
* Thus wrote Jason Barnett: Or if you feel lazy... then you can use serialize / unserialize. I'll be even lazier... setcookie('foo[bar]', 'is ok'); setcookie('foo[qaz]', 'is better'); // after cookie is set. $myFoo = $_COOKIE['foo']; print_r($myFoo); Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php reserved characters...
hi... got a simple question... i have the following: html body ? $test = p; echo $test; print $test; ? /body /html it doesn't seem to print... which leads me to believe that is a reserved char/word... i tried to do a \p with no luck... any idea as to what's going on, and can someone point me to a list of the actual php reserved chars/words couldn't seem to track them down on the php site/google... thanks bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php reserved characters...
bruce wrote: i have the following: html body ? $test = p; echo $test; print $test; ? /body /html it doesn't seem to print... which leads me to believe that is a reserved char/word... i tried to do a \p with no luck... any idea as to what's going on, and can someone point me to a list of the actual php reserved chars/words couldn't seem to track them down on the php site/google... is not reserved. The problem is your HTML. Your result ends up like this: html body p p /body /html which is just badly formed HTML, not PHP. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php reserved characters...
can someone point me to a list of the actual php reserved chars/words couldn't seem to track them down on the php site/google... http://www.php.net/manual/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and HTML Conventions
I generally do all my program logic first then go to HTML. Once I start HTML, I drop in the PHP stuff where I need it. I think, but am not sure, that it also cuts down on processing time not having to parse out echo tags. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and HTML Conventions
Harlequin wrote: Hi all. I just wondered if the general convention was to use entirely PHP and simply encase HTML TAGs within that or use a mix and simply use PHP TAGs when required. It depends on the project, but when possible I prefer to have as much static content as possible for better performance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [Q] Using $_SERVER['DOCUMENT_ROOT'] correctly
Is your common script in the server root? If so then you can use something like this in the file: define('WWWROOT', basename(__FILE__)); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php reserved characters...
i tried to do a \p with no luck... any idea as to what's going on, and can someone point me to a list of the actual php reserved chars/words couldn't seem to track them down on the php site/google... is not reserved. The problem is your HTML. Your result ends up like this: Either that, or short_open_tags is not enabled. Try changing the first '?' to a '?php' and see if that doesn't help. And view source - John may be right. :) - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: unset empty elements in an array
On 13/07/2004, at 3:14 AM, Paul Bissex wrote: How about array_filter()? From the docs: If the callback function is not supplied, array_filter() will remove all the entries of input that are equal to FALSE. $a = array ('a' = 'foo', 'b' = '', 'c' = null, 'd' = 99, 'e' = 0); print_r (array_filter ($a)); // Output: Array ( [a] = foo [d] = 99 ) As a previous poster noted, though, this will only work for you if 0 and the empty string et al. are not significant in your application. Nice idea Paul, will try it out :) --- Justin French http://indent.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php