AW: [PHP] wysiwyg editor
To Roman If you are on Windows try Dreamweaver. Easy and comfortable.It's a hair saving tool for HTML. even let you edit js and php in a very bequem Mode . Or (on Linux) emacs but configure it for HTML and PHP if it is not already configured or SCREEM , this is also a good tool for html. CHEERS Reverend Raja Shahed -Ursprüngliche Nachricht- Von: Outbound [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 10. März 2004 09:16 An: [EMAIL PROTECTED] Betreff: [PHP] wysiwyg editor Hello, do you have any recommendation about what wysiwyg html(javascript) editor to use in php projects ? People usually don't like textareas and want to increate usability :-/ Best regards, Roman -- 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] arrays, loops, vars and props
Hey, would anyone know offhand, if its faster to create a temp array, fill it via loop, and then set a class property to that array, or to simply fill the class property via loop.. to clearify. would the following example be faster or slower had i simply done $this-myArray[$i] = $i; class MyClass { var $myArray = array(); function MyClass() { $myTempArray = array(); for($i=0;$i100;$i++) $myTempArray[$i] = $i; $this-myArray = $myTempArray; } } just curious... Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP, ODBC and Pervasive SQL
I am trying to connect from PHP to Pervasive SQL using ODBC, and I am experiencing difficulty. My PHP looks like this: $dsn = GruffTrading; // Datasource $dsu = ; // User $dsp = ; // Password if(!$odbc = odbc_connect($dsn,$dsu,$dsp)) die(Unable to connect to Data Source $dsnbr.odbc_error().: .odbc_errormsg()); I can connect to the database using the same DSN from MS Access, and I can connect to an Access database using the same PHP code, but obviously a different DSN. The error is S1000: [Pervasive Software][ODBC Interface][Pervasive Software SQL Engine]General error. I am using the Pervasive Software ODBC-32 driver, version 2.04.02.10, and am running on Windows 2000 Professional, latest patches and stuff all loaded, and PHP 4.3.0 I would appreciate any pointers in the right direction. Cheers, William.
[PHP] wysiwyg editor
Hello, do you have any recommendation about what wysiwyg html(javascript) editor to use in php projects ? People usually don't like textareas and want to increate usability :-/ Best regards, Roman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] nested UL tree from hierarchical db
Hi all, I'm playing around with Modified Preorder Tree Traversal as discussed in an article on sitepoint http://www.sitepoint.com/article/hierarchical-data-database/, which includes this function: ?php function display_tree($root) { // retrieve the left and right value of the $root node $result = mysql_query('SELECT lft, rgt FROM tree '. 'WHERE title='.$root.';'); $row = mysql_fetch_array($result); // start with an empty $right stack $right = array(); // now, retrieve all descendants of the $root node $result = mysql_query('SELECT title, lft, rgt FROM tree '. 'WHERE lft BETWEEN '.$row['lft'].' AND '. $row['rgt'].' ORDER BY lft ASC;'); // display each row while ($row = mysql_fetch_array($result)) { // only check stack if there is one if (count($right)0) { // check if we should remove a node from the stack while ($right[count($right)-1]$row['rgt']) { array_pop($right); } } // display indented node title echo str_repeat(' ',count($right)).$row['title'].\n; // add this node to the stack $right[] = $row['rgt']; } } ? This is outputting a text-based tree of the data in the database, but what I'd like to do is modify it to output a series of nested ul's (unordered lists) to describe the nesting, rather than relying on spaces and newlines. I've had a couple of attempts, with no luck... can someone shed some light on how this might be achieved? --- 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] gd for windows not working
I`ve tried use php without php.ini , but why the php still running without any error. It magic, isn`t it. I don`t know idea why it happen Please tell which is not right. -- joe patiani Geophysic and Meteorology Department Institut Teknologi Bandung Labtex XI Jl. Ganesha 10 Bandung 40132 Indonesia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gd for windows not working
Yes it true, now in running my php without php.ini, but why it still working without error. It strange for me, are you too. -- joe patiani Geophysic and Meteorology Department Institut Teknologi Bandung Labtex XI Jl. Ganesha 10 Bandung 40132 Indonesia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: wysiwyg editor
Outbound wrote: Hello, do you have any recommendation about what wysiwyg html(javascript) editor to use in php projects ? People usually don't like textareas and want to increate usability :-/ Best regards, Roman HTMLArea. Version 2 supports IE5.5+ V2: http://www.interactivetools.com/products/htmlarea/ Version 3 is currently out in RC1 and supports Mozilla 1.3+ as well as IE. I've got it running on a couple of sites and it works a treat: V3: http://dynarch.com/mishoo/htmlarea.epl Really easy to install - upload files, add a few lines of JavaScript and it will convert all textareas on the page into HTML editors. Back to PHP (!) - someone has written a PHP replacement for the Perl/Aspell spell checker that interfaces with HTMLArea. Not tried it, but since it's pretty much a straight clone it should work alright. Cheers, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gd for windows not working
On Thursday 11 March 2004 07:24, Joe Patiani wrote: I`ve tried use php without php.ini , but why the php still running without any error. It magic, isn`t it. I don`t know idea why it happen Please tell which is not right. Yes php can run without php.ini, nothing magic about it, it just uses the system defaults for the settings. As others have pointed out use phpinfo() to see where your version of php expects to find php.ini located. Then if you really have no php.ini file at the location where your version of php expects it to be then get yourself a copy from either one of the source tarballs or from CVS. -- 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 -- /* What I want to find out is -- do parrots know much about Astro-Turf? */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ob_ output buffering ...
Hi there! I want to use the output buffering to replace one important string before the output starts. How can i do this? rgds, Till -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Information about security
Hello I need some information about security in php. I want to create a backoffice extremely safe for user authentication? What you think about using .htaccess for authentication, and if it is possible to authenticate a user and then logout. And I would also like to know if you have other ways to do so in a high level of security. Obrigado.
RE: [PHP] Information about security
Have a look at PEAR::Auth on http://pear.php.net Vincent -Original Message- From: Andre [mailto:[EMAIL PROTECTED] Sent: mercredi 10 mars 2004 11:35 To: [EMAIL PROTECTED] Subject: [PHP] Information about security Hello I need some information about security in php. I want to create a backoffice extremely safe for user authentication? What you think about using .htaccess for authentication, and if it is possible to authenticate a user and then logout. And I would also like to know if you have other ways to do so in a high level of security. Obrigado. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Scripts for customer - service provider web available?
Denis L. Menezes wrote: Hello friends. I am in a hurry to make a website where suppliers can advertise their products and services and customers can place their requirements so the requirements can be matched with the service providers. Also vistors should be able to seek suppliers and customers. Can anyone tell me where I could find a ready made scripts program that does the above? Thanks denis http://freshmeat.net David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strip down Warnings
Hi there, i'm just starting with php. How can i tell fsockopen() to skip to echo this warnings? I get all of these warnings and would like to strip them down: Warning: fsockopen(): unable to connect to 192.168.2.209:5800 in /var/www/htdocs/3.php on line 13 o port 5800 em 192.168.2.210 está aberto Warning: fsockopen(): unable to connect to 192.168.2.211:5800 in /var/www/htdocs/3.php on line 13 heres my script: -- html body ?php $rede=192.168.2.; $portNumber=5800; for ($i=209;$i212;$i++){ $targetIP= $rede . $i; $a[$i]=_scanport ($targetIP, $portNumber); //echo $a[$i]; } function _scanPort ($targetIP, $portNumber) { $handle = fsockopen($targetIP, $portNumber, $errno, $errstr, 2); if ($handle) { fclose($handle); echo o port . $portNumber . em a href=\http://;. $targetIP .:. $portNumber . \. $targetIP . /a. está abertobr/; } return 0; } ? /html - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Are $_POST and $_GET interchangable?
I understand the difference between how they process from data. Most application seem to reply on $_GET which display the session/from/cookie values in the URL windows. What I'm not clear on are there times when you have to either $_POST or $_GET? TX, david -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to make sure a redirect works
Hi All, I want to randomly select a desitniation page and use cookies to ensure that refreshes and return visits on the same machine always return to that desination (assuming the cookie is intact). Imagine that we have an array of URL's $url=array(1=dest1.html, dest2.html, dest3.html); // I'm using the 1= so that I don't need to store 0 in a cookie! and that we have a variable $index which has a value in it (either set to a cookie value, if this is a refresh or return visit, or a random value [1-3] if this is the first visit My question is are there problems with: ?php header(Location: .$url[$index]); ? Might some browsers fail to redirect to the required destination? If so under what circumstances? Can I use belt and braces and employ HTML and javascript methods afterwards without introducing problems? i.e. ?php header(Location: .$url[$index]); ? !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN HTML HEAD SCRIPT !-- window.location.replace=?php echo $url[$index]; ?; window.location=?php echo $url[$index]; ?; // for NS = 2.x no support for replace // -- /SCRIPT meta http-equiv=REFRESH content=0;URL=?php echo $url[$index]; ? TITLEForward Page/TITLE meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /HEAD frameset cols='100%,*' border='0' framespacing='0' frameborder='NO' FRAME SRC='?php echo $url[$index]; ?' NAME='mainframe' FRAMEBORDER='0' NORESIZE='noresize' SCROLLING='AUTO'/ FRAME src=blank.html FRAMEBORDER='0' SCROLLING='NO' NORESIZE='noresize'/ /frameset NOFRAMES BODY Your browser appears not to support any form of automatic redirect. Pleasea href=?php echo $url[$index]; ?click here/a to be redirected to the web site. /BODY /NOFRAMES /HTML Any comments or suggestions would be greatly appreciated. Henry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Are $_POST and $_GET interchangable?
Hi You can use both $_GET and $_POST at the same time. As an example imagine that you had a script that generated a HTML form for collecting data. And image that that script generated different forms on the basis of a parameter passed in the URL (i.e. a $_GET value). Of the top of my head like this: form metod=post ?php switch($_GET['formid']) { case 1: echo 'enter your name:input type=text name=name value='.$_POST['name'].'/; break; case 2: echo 'enter you telephone number:input type=text name=tel value='.$_POST['tel'].'/; break; default: echo oops, no form ID; break; } ? input type=submit/ /form you could imagine calling this as follow: http://www.yoursite.com/form.php?formid=1 or http://www.yoursite.com/form.php?formid=2 HTH Henry David Jackson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I understand the difference between how they process from data. Most application seem to reply on $_GET which display the session/from/cookie values in the URL windows. What I'm not clear on are there times when you have to either $_POST or $_GET? TX, david -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strip down Warnings
Use '@' before any function to avoid echoing warnings (JUST warnings) -- Miguel J. Jiménez ISOTROL, S.A. (Área de Internet) Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA) [EMAIL PROTECTED] TLFNO. 955036800 ext. 111 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ob_ output buffering ...
[snip] I want to use the output buffering to replace one important string before the output starts. How can i do this? [/snip] Wouldn't you rather use str_replace()? http://www.php.net/str_replace -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Warning: Cannot modify header information - headers already sent by (output sta
Hi The problem is that the header requires that no output be generated by your script before it is invoked. It makes this clear in the error message when it indicates that on line 6 you produced output! Try this instead (although the code seems a little confused). ?php session_start(); include_once(lib/lib_main.php); dbConnect($host, $user, $pass); $password = $_POST['password']; $username = $_POST['username']; $sql_login = mysql_query(SELECT id from user WHERE username='$username' and password=password('$password')); if(mysql_num_rows($sql_login)) { header(Location: http://www.index.php;); } echo FORM ACTION=\$PHP_SELF\ METHOD=\POST\; ? table align=center trtdUsername:/tdtd input type=username name=username/td/tr trtdPassword:/tdtd input type=password name=password/td/tr trtd/tdtd align=centerinput type=submit name=submit value=Submit/tdtr ?php echo /FORM; ? Mike Mapsnac [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This code below gives me this error message: Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/account.php:6) in /var/www/html/account.php on line 17 The script check in the database if user exists and than redirect the page to the home index.php page. I know the problem exist in the header() .. But I don't understand why? ?php session_start(); include_once(lib/lib_main.php); dbConnect($host, $user, $pass); echo FORM ACTION=\$PHP_SELF\ METHOD=\POST\;? table align=center trtdUsername:/tdtd input type=username name=username/td/tr trtdPassword:/tdtd input type=password name=password/td/tr trtd/tdtd align=centerinput type=submit name=submit value=Submit/tdtr ?php echo /FORM; $password = $_POST['password']; $username = $_POST['username']; $sql_login = mysql_query(SELECT id from user WHERE username='$username' and password=password('$password')); if(mysql_num_rows($sql_login)) { header(Location: http://www.index.php;); } ? _ Find things fast with the new MSN Toolbar - includes FREE pop-up blocking! http://clk.atdmt.com/AVE/go/onm00200414ave/direct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] AI:Categorizer
Is there avaiable something alike a port of PERL AI:Categorizer? -- Seks, seksi, seksolatki... news:pl.soc.seks.moderowana https://hyperreal.info/pomoc/ { 1488 } WiNoNa = ) ( Szatan, Szatan...http://666-666.0-700.pl foReVeR( * ) Poznaj jej zwiewne ksztaty... http://www.opera.com 007 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gd for windows not working
Hi Joe! Don't be surprise or strange, 'cause default value of display_errors is Off, so nothing errors will display. This directive related to security consideration, to display it you must set it to On on php.ini. display_errors = On Anyway, I'm Indonesian. :) Good luck, Firman - Original Message - From: Joe Patiani [EMAIL PROTECTED] To: Firman Wandayandi [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, March 11, 2004 6:28 AM Subject: Re: [PHP] gd for windows not working Yes it true, now in running my php without php.ini, but why it still working without error. It strange for me, are you too. -- joe patiani Geophysic and Meteorology Department Institut Teknologi Bandung Labtex XI Jl. Ganesha 10 Bandung 40132 Indonesia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wysiwyg editor
Hello Outbound, Wednesday, March 10, 2004, 8:16:23 AM, you wrote: O do you have any recommendation about what wysiwyg html(javascript) O editor to use in php projects ? People usually don't like textareas O and want to increate usability :-/ EditWorks Professional - www.sitecubed.com isn't too bad at all. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Are $_POST and $_GET interchangable?
Hello DAvid, Wednesday, March 10, 2004, 11:08:01 AM, you wrote: DJ I understand the difference between how they process from data. DJ Most application seem to reply on $_GET which display the DJ session/from/cookie values in the URL windows. Just to re-cap where they come from: It depends on how the data is being sent to your script. For example, variables passed on the query string - i.e.: http://www.site.com/file.php?a=hellob=world Those variables (a and b) will only be visible via $_GET. Where-as values passed from a form that uses the POST method: form action=file.php method=post /form These will only be available in $_POST. DJ What I'm not clear on are there times when you have to either $_POST or DJ $_GET? Well that depends on the script in question more than anything. If you're trying to pass values to a script that is expecting them to be in $_GET then you have to pass those values on the query string. What situation do you have that makes you ask this question? Perhaps with a little more detail we can explain further? -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Warning: Cannot modify header information - headers already sent by (o
Thank for your help .. One more question: I include header to the acount.php page. And it gives the same error, but in this situation I don't have any outputs. Also, I start session in header, not in the account. ?php //Account.php //session_start(); include_once(lib/lib_main.php); dbConnect($host, $user, $pass); include_once 'header_account.php'; $password = $_POST['password']; $username = $_POST['username']; $sql_login = mysql_query(SELECT id from user WHERE username='$username' and password=password('$password')); if(mysql_num_rows($sql_login)) { $_SESSION['login'] = 'register'; $_SESSION['name'] = $username; Header(Location: .index.php); } echo FORM ACTION=\$PHP_SELF\ METHOD=\POST\; ? table align=center trtdUsername:/tdtd input type=username name=username/td/tr trtdPassword:/tdtd input type=password name=password/td/tr trtd/tdtd align=centerinput type=submit name=submit value=Submit/tdtr/table ?php echo /FORM; ? //File: header_account.php ?php session_start(); ? LINK REL=stylesheet HREF=style.css TYPE=text/css table width=100% align=center border=1 cellpadding=0 cellspacing=0 trtd bgcolor=#5bb9f7nbsp;/td/tr trtd align=center bgcolor=FF bA HREF=/ CLASS=pointerBarHome/Anbsp;nbsp;nbsp;nbsp;A HREF=resize.php CLASS=pointerBarResize/A/tdtr trtd bgcolor=#5bb9f7nbsp;/td/tr /table From: Chris W. Parker [EMAIL PROTECTED] To: Mike Mapsnac [EMAIL PROTECTED],[EMAIL PROTECTED] Subject: RE: [PHP] Warning: Cannot modify header information - headers already sent by (output sta Date: Tue, 9 Mar 2004 17:46:21 -0800 Mike Mapsnac mailto:[EMAIL PROTECTED] on Tuesday, March 09, 2004 5:42 PM said: This code below gives me this error message: Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/account.php:6) in /var/www/html/account.php on line 17 The script check in the database if user exists and than redirect the page to the home index.php page. I know the problem exist in the header() .. But I don't understand why? the error is telling you that you cannot output anything to the client BEFORE modifying the headers, i.e. redirecting. you have a lot of output starting on line 6 in /var/www/html/account.php. hth, chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ FREE pop-up blocking with the new MSN Toolbar get it now! http://clk.atdmt.com/AVE/go/onm00200415ave/direct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gd for windows not working
Yes I know, that you doesn't use any php.ini. I think you don't understand what I said. PHP always run, with or without php.ini, sure phpinfo() too. But if nothing php.ini can found by PHP, PHP will be use default configuration value that's built-in/defined in PHP self. If you still found the problems. simply leave me the message. I'm at my home at Bandung. Regards, Firman - Original Message - From: Joe Patiani [EMAIL PROTECTED] To: Firman Wandayandi [EMAIL PROTECTED] Sent: Thursday, March 11, 2004 9:52 AM Subject: Re: [PHP] gd for windows not working Ok then. But actually in this case I`m absolutely not use php.ini. I`ve renamed all php.ini into something other. But the php still working, I don`t which another php.ini that used by phpinfo(). I did this in order to check whether phpinfo() use php.ini or not, and the conclusion is phpinfo() not use it. How come, I don`t. If the phpinfo() use php.ini , it must be something wrong with my server. The php.ini and phpinfo() doesn`t match anyway. I don`t know, it just happen. Well, may be you can visit my website to check it. http://labkom4.labkom.geoph.itb.ac.id/tes.php; if I don`t turn it yet. I would be appreciated and much thank you. BTW, where are you now and where are you came from --- joe patiani Geophysic and Meteorology Department Institut Teknologi Bandung Labtex XI Jl. Ganesha 10 Bandung 40132 Indonesia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strip down Warnings
On 10 Mar 2004 dmesg wrote: How can i tell fsockopen() to skip to echo this warnings? Here's a repeat of something I just posted the other day on this ... Here's an approach I have used to avoid any error messages at all -- presumably you could also set a flag in the error handler to indicate what happened, if you need that. You need to both disable error reporting and set a do-nothing error handler. . $olderr = error_reporting(0); set_error_handler(ignoreerrhandler); $fp = fsockopen(.) restore_error_handler(); error_reporting($olderr); if ($fp) { [worked] } else { [failed] } . function ignoreerrhandler($errno, $errstr, $errfile, $errline) { return; } -- Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Return value efficiency question
On 10 Mar 2004 Robert Cummings wrote: Overhead is minimal since PHP doesn't actually copy the contents of the container until an attempt to modify it is made. At which time the contents are only actually copied if the internal reference count is greater than 0. Generally this means it won't be copied since your returning function will no longer be referencing it. This is not to be confused with references as programmers work with them in scripts themselves. Rob I have a related question, if you know ... what is the point at which passing objects by reference instead of by value provides a performance benefit? It sounds from the above like if you are not modifying the object in the called code then passing by value is always best because this is treated as a pass by reference unless and until there is a modification, so there is no performance cost. (I udnerstand that if modifying it then it must be passed by reference.) If that's right, then ... - does the same apply to arrays? - what happens if you pass an object by value and then call one of its methods which does not modify any data? Does the object get copied? Thanks for any insights ... -- Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to make sure a redirect works
On 10 Mar 2004 Henry Grech-Cini wrote: My question is are there problems with: ?php header(Location: .$url[$index]); ? As long as no other headers have been sent that should work fine. Location: is the standard method for redirection -- I'm not aware of any circumstances in which it won't work. Perhaps others are. If you output a location header then I don't know what the browser will do with text sent after that. Hopefully nothing! -- Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Are $_POST and $_GET interchangable?
David Jackson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I understand the difference between how they process from data. Most application seem to reply on $_GET which display the session/from/cookie values in the URL windows. What I'm not clear on are there times when you have to either $_POST or $_GET? TX, david That's a good question. Your post prompted me to check the manual. Searching the different categories at www.php.net for $_GET[], I found indirect references (documentation of other subjects that use $_GET[] and $_POST[] ) but no documentation focusing directly on either. Is there on line documentation specifically dedicated to these two phenomena? tia Dale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Return value efficiency question
Kelly Hallman wrote: Consider this method: function xyz() { return $this-data = unserialize($this-serial); } Maybe I'm just being stupid, but wouldn't that simply return true if the assignment was successful, and false otherwise? [ trimmed ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to make sure a redirect works
Henry Grech-Cini wrote: Hi All, I want to randomly select a desitniation page and use cookies to ensure that refreshes and return visits on the same machine always return to that desination (assuming the cookie is intact). Imagine that we have an array of URL's $url=array(1=dest1.html, dest2.html, dest3.html); // I'm using the 1= so that I don't need to store 0 in a cookie! and that we have a variable $index which has a value in it (either set to a cookie value, if this is a refresh or return visit, or a random value [1-3] if this is the first visit My question is are there problems with: ?php header(Location: .$url[$index]); ? Might some browsers fail to redirect to the required destination? If so under what circumstances? In this example, it will not work because Location: expects the target to be a fully qualified URL. Other than that, I don't see why it wouldn't work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Return value efficiency question
On 10 March 2004 13:48, Burhan Khalid wrote: Kelly Hallman wrote: Consider this method: function xyz() { return $this-data = unserialize($this-serial); } Maybe I'm just being stupid, but wouldn't that simply return true if the assignment was successful, and false otherwise? Nope. The value of an assignment expression is the value assigned, so that will return whatever was assigned into $this-data. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Are $_POST and $_GET interchangable?
[snip] for $_GET[], I found indirect references (documentation of other subjects that use $_GET[] and $_POST[] ) but no documentation focusing directly on either. Is there on line documentation specifically dedicated to these two phenomena? [/snip] This is more of a general web programming question (see the info at http://www.w3c.org) GET and POST are two different methods of moving data from client to server. The GET method utilizes the URL for passing data and is limited in size (I forget the total number of characters allowed in the URL). It is also makes spoofing a little easier. Let us say I am an employee of a company and my app designers have done a poor job at security. I go to employee information at http://www.foo.com/employee.php?eid=jsmith If I have some snap and I want to see some other employee's info I can then type it into the URL http://www.foo.com/employee.php?eid=bstreisand POST removes the information from the view of the user, and IIRC you can pass tons of information to the server. The rules for usage come down to this - A little common sense goes a long way. There are really no specific rules. For web apps at my company I set the rules, I have seen other companies with other rules for the use of these two. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Return value efficiency question
On Wed, Mar 10, 2004 at 04:48:06PM +0300, Burhan Khalid wrote: Kelly Hallman wrote: Consider this method: function xyz() { return $this-data = unserialize($this-serial); } Maybe I'm just being stupid, but wouldn't that simply return true if the assignment was successful, and false otherwise? no, the return-value of the assignment is the right side of the assignment (the value that was assigned). [ trimmed ] -- 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: Are $_POST and $_GET interchangable? MORE
[snip] stuff [/snip] From http://www.w3.org/TR/html4/interact/forms.html#h-17.13.1 17.13.1 Form submission method The method attribute of the FORM element specifies the HTTP method used to send the form to the processing agent. This attribute may take two values: get: With the HTTP get method, the form data set is appended to the URI specified by the action attribute (with a question-mark (?) as separator) and this new URI is sent to the processing agent. post: With the HTTP post method, the form data set is included in the body of the form and sent to the processing agent. The get method should be used when the form is idempotent (i.e., causes no side-effects). Many database searches have no visible side-effects and make ideal applications for the get method. If the service associated with the processing of a form causes side effects (for example, if the form modifies a database or subscription to a service), the post method should be used. Note. The get method restricts form data set values to ASCII characters. Only the post method (with enctype=multipart/form-data) is specified to cover the entire [ISO10646] character set. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] what does this mean?
$this-styles['shadow'] = (boolean)$bool; what does (boolean)$bool mean? mfg. harry wiens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what does this mean?
The () operator means 'cast into' so (boolean)$bool means cast this into a booolean. Harry Wiens wrote: $this-styles['shadow'] = (boolean)$bool; what does (boolean)$bool mean? mfg. harry wiens -- Raditha Dissanayake. --- http://www.radinks.com/upload/ Drag and Drop Upload thousands of files and folders in a single transfer. (HTTP or FTP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what does this mean?
Hello Harry, Wednesday, March 10, 2004, 12:55:44 PM, you wrote: $this-styles['shadow'] = (boolean)$bool; HW what does (boolean)$bool mean? It's casting the value ($bool) to a boolean (i.e. TRUE or FALSE). -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what does this mean?
That's a boolean casting; used for forcing a variable to become boolean... Hope it helps... Harry Wiens wrote: $this-styles['shadow'] = (boolean)$bool; what does (boolean)$bool mean? mfg. harry wiens -- Miguel J. Jiménez ISOTROL, S.A. (Área de Internet) Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA) [EMAIL PROTECTED] TLFNO. 955036800 ext. 111 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing array from class to class produces more than one result...
I'm writing a DBI class with the following function function Select($sql) { $this-setResultID(@mysql_query($sql,$this-getDBConn())); if ($this-getResultID() == false) Error::fatalError(__FILE__.' ('.__LINE__.') : Unable to run query : '.mysql_error().'('.mysql_errno().')'); $this-setNumRows(@mysql_num_rows($this-getResultID())); $this-setArray(@mysql_fetch_array($this-getResultID())); } When I call this, I want to be able to run while($data = $objDBI-FetchArray) { echo $data['username']; } but the results I get are jvillajvillajvillajvillajvillajvillajvillajvillajvillajvillajvillajvillaetc my $sql query is simple SELECT username FROM staff; and there are four rows in the db... For some reason, I can't pass the value of mysql_fetch_array out of the Select function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Control Structure Syntax Question
$x ? xxx : xxx But it makes your code less readable IMHO and offers no tangible benefit whatsoever. It offers the tangible benefit of evaluating to something: return (isset($foo) ? $foo : $bar); $query = select * from foo .(isset($bar) ? where bar = ${bar} : ''); $foo = ((count($bar) 1) ? 'bars' : 'bar); - 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] Warning: Cannot modify header information - headers already sent by (o
Mike Mapsnac mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 4:31 AM said: Thank for your help .. no problem. One more question: I include header to the acount.php page. And it gives the same error, but in this situation I don't have any outputs. yes you are. here is why: -- ?php // php code goes here ? table -- output tr -- output tda table/td -- output /tr -- output /table-- output -- your files are sending plain HTML. the bottom line is that when you get errors like this trust the php compiler with your life. i've never seen it inaccurately report where output has started. hth, chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Return value efficiency question
On Wed, 2004-03-10 at 08:30, [EMAIL PROTECTED] wrote: On 10 Mar 2004 Robert Cummings wrote: Overhead is minimal since PHP doesn't actually copy the contents of the container until an attempt to modify it is made. At which time the contents are only actually copied if the internal reference count is greater than 0. Generally this means it won't be copied since your returning function will no longer be referencing it. This is not to be confused with references as programmers work with them in scripts themselves. Rob I have a related question, if you know ... what is the point at which passing objects by reference instead of by value provides a performance benefit? Passing by reference appears to provide a small amount of speed increase though IMHO very small. Check the following three scripts: ? $initial = array(); for( $i = 0; $i 10; $i++ ) { $initial[$i] = $i; } for( $i = 0; $i 1000; $i++ ) { $foo = $initial; } linux time command: 7.46user 0.02system 0:07.58elapsed 98%CPU ? for( $i = 0; $i 10; $i++ ) { $initial = $i; } for( $i = 0; $i 1000; $i++ ) { $foo = $initial; } linux time command: 7.25user 0.00system 0:07.25elapsed 99%CPU ? $initial = array(); for( $i = 0; $i 10; $i++ ) { $initial[$i] = $i; } for( $i = 0; $i 1000; $i++ ) { $foo = $initial; } linux time command: 6.85user 0.02system 0:06.87elapsed 99%CPU As you can see copying by value regardless of the value is pretty much the same (I think the time discrepency is due to a slightly longer time to populate the $initial array than to assign an integer value 10 times to $initial (which makes sense O( lg n ) versus O( 1 )). It seems passing by reference provides a small amount of advantage (about 5% as shown above). Even though references may be faster I would say now that it depends on what you want to do and who is maintaining the code :) Also copies are definitely a good choice when you are passing data that shouldn't affect some centralized storage variable (such is usually the case for Singleton factories). Also don't forget that the above example is assigning the data 10 million times, generally the difference would be almost negligible. It sounds from the above like if you are not modifying the object in the called code then passing by value is always best because this is treated as a pass by reference unless and until there is a modification, so there is no performance cost. (I udnerstand that if modifying it then it must be passed by reference.) Passing references everywhere when a reference isn't needed can make your code more difficult to read since others reading it will constantly be asking, is this being passed as a reference for a reason? Does changing the value outside of the function returning it or receiving it have some transient effect?. If that's right, then ... - does the same apply to arrays? Yes as shown above. - what happens if you pass an object by value and then call one of its methods which does not modify any data? Does the object get copied? I checked with the internals list for this answer since I thought it would work the same, and indeed it turns out that objects in PHP 4 do work this way. However this is not quite true with PHP 5 which uses the concept of object-handles. Nonetheless, Derick Rethans informed had the following to say: in php 5 it is true for object-handles and not objects, but that shouldn't be of any concern. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] magic_quotes_sybase - Windows MSSQL
My ISP has the following settings in their php.ini file: magic_quotes_gpc = ON magic_quotes_sybase = OFF I am using a Windows Server and a SQL Server database. I need to set magic_quotes_sybase to ON so that quotes will be escaped with another quote instead of a slash. However, I do not have access to the php.ini file. Is there something like the .htaccess file that can be used on a Windows server? My ISP is using PHP v4.3.0. Thank you! Jeremy Markman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to make sure a redirect works
If you output a location header then I don't know what the browser will do with text sent after that. Hopefully nothing! I experienced some strange behaviour(=no redirect at all!!) with a script that send data after the location header. Best to do this header(Location: http://somesite.nl;); die(); Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] wysiwyg editor
I use http://www.fredck.com/FCKeditor/ Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Are $_POST and $_GET interchangable?
Jay Blanchard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [snip] for $_GET[], I found indirect references (documentation of other subjects that use $_GET[] and $_POST[] ) but no documentation focusing directly on either. Is there on line documentation specifically dedicated to these two phenomena? [/snip] This is more of a general web programming question (see the info at http://www.w3c.org) GET and POST are two different methods of moving data from client to server. The GET method utilizes the URL for passing data and is limited in size (I forget the total number of characters allowed in the URL). It is also makes spoofing a little easier. Let us say I am an employee of a company and my app designers have done a poor job at security. I go to employee information at http://www.foo.com/employee.php?eid=jsmith If I have some snap and I want to see some other employee's info I can then type it into the URL http://www.foo.com/employee.php?eid=bstreisand POST removes the information from the view of the user, and IIRC you can pass tons of information to the server. The rules for usage come down to this - A little common sense goes a long way. There are really no specific rules. For web apps at my company I set the rules, I have seen other companies with other rules for the use of these two. I googled a few different queries and can't find any direct documentation. http://www.w3c.org has a lot of info, but none that I can find' on this subject (they need a 'search this site' option) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] small business inventory management package
OSSUITE: http://sourceforge.net/projects/ossuite/ or just browse through sourceforge projects: http://sourceforge.net/softwaremap/trove_list.php?form_cat=129discrim=183 -Original Message- From: Christian Calloway [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 09, 2004 1:38 AM To: [EMAIL PROTECTED] Subject: [PHP] small business inventory management package Hey, Not looking to reinvent the wheel.. I am looking for an inventory management software package (written in PHP of course) that would be suitable for a small business. So in otherwords, nothing with any bells or whistles, just something that is easily modified/extensible. Any suggestions, Thanks in advance Christian -- 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] new to php question
I'm new to php but want to use it for a music club's website I'm working on. Specifically, I want to create an online form that the booking agent can fill out with information like Date, Time, Cover Charge, Band Name, Description, etc and have this data populate the calendar page in chronological order. For an example of what I'm trying to do check out: http://www.schubas.com/calendar.asp Any suggestions? Thanks for your help, Luke http://www.brindleybrothers.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Letters and Numbers limitation
Form takes parameter username, so I want to accept username taht includes only numbers and letters. How can I check if variable contains only letters and numbers? _ FREE pop-up blocking with the new MSN Toolbar get it now! http://clk.atdmt.com/AVE/go/onm00200415ave/direct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Are $_POST and $_GET interchangable?
Mar 10 at 9:45am, Five wrote: If I have some snap and I want to see some other employee's info I can then type it into the URL http://www.foo.com/employee.php?eid=bstreisand The rules for usage come down to this - A little common sense goes a long way. There are really no specific rules. On that note, something to keep in mind is that GET variables (being part of the URL) are written to server logs. Depending on the data being passed, this could be a security issue (especially in a shared hosting environment where untrusted users may have access to the logs). -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Letters and Numbers limitation
Form takes parameter username, so I want to accept username taht includes only numbers and letters. How can I check if variable contains only letters and numbers? Use regular expressions. See the PHP manual (for PCRE or POSIX) for more. You'll also find a number of tutorials online about validating form input with regex, I suspect. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] new to php question
Luke Brindley mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 10:37 AM said: Specifically, I want to create an online form that the booking agent can fill out with information like Date, Time, Cover Charge, Band Name, Description, etc and have this data populate the calendar page in chronological order. [snip] Any suggestions? are you looking for a premade app or did you have a specific question? here are some things to think about. 1. do you know how to create a database? 2. do you know how to write SQL queries? 3. do you know how to retrieve data from a database with php? if you answered no to any of those questions you are probably not ready to create such a thing. otherwise, ask a more specific question and we will try to help you out. hth, chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] get_browser() - browscap.ini for Linux
I am running Apache 1.3.29 on a Linux platform. I am trying to use PHP's get_browser function which needs a file called browscap.ini on the server. It *seems* that there is no such file available for Linux (I have checked the manual and the link that it mentions). Can anyone point me to a source for a working, up-to-date Linux version of browscap.ini Thanks in advance, Shaunak -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] get_browser() - browscap.ini for Linux
Shaunak Kashyap mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 11:21 AM said: I am running Apache 1.3.29 on a Linux platform. I am trying to use PHP's get_browser function which needs a file called browscap.ini on the server. It *seems* that there is no such file available for Linux (I have checked the manual and the link that it mentions). Can anyone point me to a source for a working, up-to-date Linux version of browscap.ini i'm just guessing with this but are you sure you need a linux version of browscap.ini? afaik it's just a plain text file. chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] arrays, loops, vars and props
Jason Davidson mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 12:25 AM said: would the following example be faster or slower had i simply done $this-myArray[$i] = $i; class MyClass { var $myArray = array(); function MyClass() { $myTempArray = array(); for($i=0;$i100;$i++) $myTempArray[$i] = $i; $this-myArray = $myTempArray; } } here's how i would do it (coding styles aside): function MyClass() { $limit = 100; $i = -1; while(++$i $limit) { $this-myArray[] = $i; } } chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] error_log set but still writing to syslog and the apache error_log
I have set error_log to /var/logs/php_error.log and no matter what it keeps writing to syslog. I have restarted the server and it shows up in the phpinfo(); correctly but it won't write to the it keeps writing to syslog. I have changed the owner to apache.apache and I have kept it to root.root but still nothing. I would appreciate any help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Passing array from class to class produces more than one result...
mmmh... i think its not coded the right way, first of all, you shouldn't put this: $this-setArray(@mysql_fetch_array($this-getResultID())); in the Select method, you should do it in your FetchArray method, every time it gets called, and return the value directly or false if there are no more rows, an example: function FetchArray() { return @mysql_fetch_array($this-getResultID()); } or something like that Jonathan Villa [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] I'm writing a DBI class with the following function function Select($sql) { $this-setResultID(@mysql_query($sql,$this-getDBConn())); if ($this-getResultID() == false) Error::fatalError(__FILE__.' ('.__LINE__.') : Unable to run query : '.mysql_error().'('.mysql_errno().')'); $this-setNumRows(@mysql_num_rows($this-getResultID())); $this-setArray(@mysql_fetch_array($this-getResultID())); } When I call this, I want to be able to run while($data = $objDBI-FetchArray) { echo $data['username']; } but the results I get are jvillajvillajvillajvillajvillajvillajvillajvillajvillajvillajvillajvilla etc my $sql query is simple SELECT username FROM staff; and there are four rows in the db... For some reason, I can't pass the value of mysql_fetch_array out of the Select function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] arrays, loops, vars and props
i would do it this way function MyClass() { $this-myArray = range(0, 99); } luis. Chris W. Parker [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] Jason Davidson mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 12:25 AM said: would the following example be faster or slower had i simply done $this-myArray[$i] = $i; class MyClass { var $myArray = array(); function MyClass() { $myTempArray = array(); for($i=0;$i100;$i++) $myTempArray[$i] = $i; $this-myArray = $myTempArray; } } here's how i would do it (coding styles aside): function MyClass() { $limit = 100; $i = -1; while(++$i $limit) { $this-myArray[] = $i; } } chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] get_browser() - browscap.ini for Linux
On Wed, Mar 10, 2004 at 02:21:19PM -0500, Shaunak Kashyap wrote: I am running Apache 1.3.29 on a Linux platform. I am trying to use PHP's get_browser function which needs a file called browscap.ini on the server. It *seems* that there is no such file available for Linux (I have checked the manual and the link that it mentions). Can anyone point me to a source for a working, up-to-date Linux version of browscap.ini Thanks in advance, Shaunak I pick up mine from http://www.GaryKeith.com and use it fine under Linux. -- Jim Kaufman Linux Evangelist public key 0x6D802619 http://www.linuxforbusiness.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] arrays, loops, vars and props
here's how i would do it (coding styles aside): function MyClass() { $limit = 100; $i = -1; while(++$i $limit) { $this-myArray[] = $i; } } Don't forget poor old range: $this-myArray = range(0, 99); - 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] arrays, loops, vars and props
Luis Mirabal mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 12:30 PM said: i would do it this way function MyClass() { $this-myArray = range(0, 99); } guys (luis), guys (mike), let's not try to one-up each other... ... ... but i would take it a step further. :P function MyClass($limit = 100) { $this-myArray = range(0, $limit-1); } c. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: what does this mean?
the casting is as follows, any value distinct from zero, null or empty string is converted to true, else the it is converted to false Harry Wiens [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] $this-styles['shadow'] = (boolean)$bool; what does (boolean)$bool mean? mfg. harry wiens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] arrays, loops, vars and props
Im fully aware of diffrent ways of doing it, my question is, in the 2 ways i mentioned, which is more efficient. Ill take the question to the internals list. Thanks for your responses. Jason Chris W. Parker [EMAIL PROTECTED] wrote: Luis Mirabal mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 12:30 PM said: i would do it this way function MyClass() { $this-myArray = range(0, 99); } guys (luis), guys (mike), let's not try to one-up each other... ... ... but i would take it a step further. :P function MyClass($limit = 100) { $this-myArray = range(0, $limit-1); } c. -- 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] perl, cgi and php
Hello, First let me say, I know very little about perl and cgi. I have a friend who is moving his site to a new hosting company. One of his php pages has the following line of code: ?php virtual(./timeline/ganttChart.cgi?user={$gallery-session-username}); ? but when the page is displayed all that shows up is the content of the .cgi script. Is this a configuration issue? 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] perl, cgi and php
On Wed, Mar 10, 2004 at 04:07:28PM -0500, Edward Peloke wrote: First let me say, I know very little about perl and cgi. I have a friend who is moving his site to a new hosting company. One of his php pages has the following line of code: ?php virtual(./timeline/ganttChart.cgi?user={$gallery-session-username}); ? but when the page is displayed all that shows up is the content of the .cgi script. Is this a configuration issue? The new hosting company's web servers don't appear to have their servers setup to parse *.cgi files through CGI. They will need to fix that, or he will need to move ganttChart.cgi into a directory that is setup to handle CGI files -- sometimes you'll have a cgi-bin directory for this purpose. joel -- [ joel boonstra | gospelcom.net ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] If Using PHP CLI to Query Oracle8I DB, is Version Number Critical?
We use PHP 4.3.4 (cli) to query a Microsoft SQL database server with no problem. We are now going to attempt the same sort of thing, only with a Pinnacle server running an Oracle8I data base. The php installation is on a FreeBSD UNIX platform and the Pinnacle server is on a Windows platform. Being very new to all this, my question is simply whether or not this should work? I am concerned that php comes with an Oracle7 client, but the data base I need to query and write back to is Oracle8I which might, someday, upgrade to a higher version. If I am using the PHP CLI to extract data from the server with, of course, correct syntax, does the Oracle version even matter? What we are going to do is extract information from work orders and then build scripts, using this information to control a telephone switch as well as create logs, etc. The php engine is simply going to let us pull and push data back and forth between this UNIX system and the Pinnacle server. If this can't work, then I am wasting my/our time. If it should work, then I'll set it up and make it work. We will most likely be running a php script which starts out like: #!/usr/local/bin/php -q ? //Set env variables putenv(SYBASE=/usr/local/etc/freetds); putenv(TDSVER=70); //Login to SQL $numero= mssql_connect(sqlserver , UID , password ); //Process each record $result=mssql_query(SELECT * FROM NatRegLog WHERE process='no',$numero ); //Logout of SQL mssql_close($numero); ? The script that will handle the Oracle DB will be similar to this example, only running the appropriate Oracle SQL commands. Many thanks. If this is in the archives, I could have missed it. The php web manual's Oracle section says, Introduction This extension adds support for Oracle database server access. See also the OCI8 extension. Martin McCormick WB5AGZ Stillwater, OK OSU Information Technology Division Network Operations Group -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP on Novell server
Hi, I'm putting together a proposal to design a website that is to be hosted on a Novell Enterprise 5.1 webserver - I'm told its an off-shoot of the Netscape Enterprise server. I've spoken with the network admin, and we're playing some phone tag right now, so I thought I'd ask here - is it possible to install PHP on this server? Now part two which is most likely unrelated to this group, but maybe someone has come across this problem. As of now, there is no database installed - the client wants to be able to update the content of all their sites by themselves ... with no database, this presents a problem as I see it. I've only dabbled in Perl years ago until I found PHP to be much easier and faster for me to use. Is there a way that ppl know of where I could let the client update their own content using only Perl (no idea what version) and no database? I suppose there's some sick method of editing text files, but that seems a little bit more hokey than I'd like to get into. Thanks -Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] get_browser() - browscap.ini for Linux
Thanks for the prompt reply. I downloaded the file from www.GaryKeith.com and set up the php.ini entry to point to it. Then I called get_browser() and it returned nothing. Once again, my configuration is as under: OS: Linux Red Hat Enterprise WS PHP: 4.2.3 Web server: Apache 1.3.29 Have you tried using PHP's get_browser function? If that worked for you, could you please let me know what your system configuration is? Thanks, Shaunak -Original Message- From: James Kaufman [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 3:31 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] get_browser() - browscap.ini for Linux On Wed, Mar 10, 2004 at 02:21:19PM -0500, Shaunak Kashyap wrote: I am running Apache 1.3.29 on a Linux platform. I am trying to use PHP's get_browser function which needs a file called browscap.ini on the server. It *seems* that there is no such file available for Linux (I have checked the manual and the link that it mentions). Can anyone point me to a source for a working, up-to-date Linux version of browscap.ini Thanks in advance, Shaunak I pick up mine from http://www.GaryKeith.com and use it fine under Linux. -- Jim Kaufman Linux Evangelist public key 0x6D802619 http://www.linuxforbusiness.net -- 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] ASP to PHP language problems
Hi , What is the equavilant in PHP to creating a recordset in ASP using a query? This is what I do in PHP: .. dim Type Type = CStr(Request.QueryString(action)) (getting parameter from URL) Dim cnn ' ADO connection Dim rst ' ADO recordset Dim strDBPath ' path to my Access database (*.mdb) file strDBPath = Server.MapPath(/_database/database.mdb) Set cnn = Server.CreateObject(ADODB.Connection) cnn.Open Provider=Microsoft.Jet.OLEDB.4.0;Data Source= strDBPath ; Set rst = cnn.Execute(SELECT * FROM table WHERE Type =' type ' order by style) .. I can then call any field and display it in the html by using : %=rst.fields(whatever).value% .. I can also create a loop: %Do While Not rstSimple.EOF% do something % rstSimple.MoveNext Loop % Please can someone show me how to do the same thing in PHP? Alistair -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ASP to PHP language problems
I don't know ASP but I think this is what you want: $sql = SELECT * FROM table WHERE Type = \ type \ order by style;; $resultID = mysql_query($sql, DBlink); // send the query and returns a pointer to the results while ($row = mysql_fetch_assoc($resultID)) // while there are results give them to me as an associative array // results could also be returned as an array, object, or row // see mysql_fetch_array, mysql_fetch_object, and mysql_fetch_row respectively { Here is a loop } Alistair Hayward [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi , What is the equavilant in PHP to creating a recordset in ASP using a query? This is what I do in PHP: .. dim Type Type = CStr(Request.QueryString(action)) (getting parameter from URL) Dim cnn ' ADO connection Dim rst ' ADO recordset Dim strDBPath ' path to my Access database (*.mdb) file strDBPath = Server.MapPath(/_database/database.mdb) Set cnn = Server.CreateObject(ADODB.Connection) cnn.Open Provider=Microsoft.Jet.OLEDB.4.0;Data Source= strDBPath ; Set rst = cnn.Execute(SELECT * FROM table WHERE Type =' type ' order by style) .. I can then call any field and display it in the html by using : %=rst.fields(whatever).value% .. I can also create a loop: %Do While Not rstSimple.EOF% do something % rstSimple.MoveNext Loop % Please can someone show me how to do the same thing in PHP? Alistair -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ASP to PHP language problems
This is what I get when I try to create the recordset Notice: Use of undefined constant DBlink - assumed 'DBlink' in D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on line 24 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on line 24 Ligaya Turmelle wrote: I don't know ASP but I think this is what you want: $sql = SELECT * FROM table WHERE Type = \ type \ order by style;; $resultID = mysql_query($sql, DBlink); // send the query and returns a pointer to the results while ($row = mysql_fetch_assoc($resultID)) // while there are results give them to me as an associative array // results could also be returned as an array, object, or row // see mysql_fetch_array, mysql_fetch_object, and mysql_fetch_row respectively { Here is a loop } Alistair Hayward [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi , What is the equavilant in PHP to creating a recordset in ASP using a query? This is what I do in PHP: .. dim Type Type = CStr(Request.QueryString(action)) (getting parameter from URL) Dim cnn ' ADO connection Dim rst ' ADO recordset Dim strDBPath ' path to my Access database (*.mdb) file strDBPath = Server.MapPath(/_database/database.mdb) Set cnn = Server.CreateObject(ADODB.Connection) cnn.Open Provider=Microsoft.Jet.OLEDB.4.0;Data Source= strDBPath ; Set rst = cnn.Execute(SELECT * FROM table WHERE Type =' type ' order by style) .. I can then call any field and display it in the html by using : %=rst.fields(whatever).value% .. I can also create a loop: %Do While Not rstSimple.EOF% do something % rstSimple.MoveNext Loop % Please can someone show me how to do the same thing in PHP? Alistair -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: ASP to PHP language problems
Alistair Hayward mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 2:46 PM said: This is what I get when I try to create the recordset Notice: Use of undefined constant DBlink - assumed 'DBlink' in D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on line 24 well you're going to need to do a *little* research on your own. oh what the heck... DBlink is the same as your cnn in your asp code. in other words you still need to create a connection to a database. chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ASP to PHP language problems
Thanks Chris, Believe me, I have been doing research non-stop for a few days now and this is my last resort. The problem is the language. I can't find what I'm looking for on the net because I don't know what it's called. I have worked out how to create a connection to a mySQL server and database. (after spending so much time configuring and installing PHP and mySQL for the first time) I now know how to use include files. I can not figure out how to create a recordset and call fields from the record set while performing a loop. I have done heaps of research, but have not found what I need. Chris W. Parker wrote: Alistair Hayward mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 2:46 PM said: This is what I get when I try to create the recordset Notice: Use of undefined constant DBlink - assumed 'DBlink' in D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on line 24 well you're going to need to do a *little* research on your own. oh what the heck... DBlink is the same as your cnn in your asp code. in other words you still need to create a connection to a database. chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ASP to PHP language problems
This is what I have: ?php $connection = mysql_connect(localhost,root,batman); if (!$connection) { echo Couldn't make a connection!; exit; } $db = mysql_select_db(sealhouse, $connection); if (!$db) { echo Couldn't select database!; exit; } $type = $_GET['type']; $sql = SELECT * FROM tbCategory WHERE Type =$type order by style; $resultID = mysql_query($sql, DB); ? Chris W. Parker wrote: Alistair Hayward mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 2:46 PM said: This is what I get when I try to create the recordset Notice: Use of undefined constant DBlink - assumed 'DBlink' in D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on line 24 well you're going to need to do a *little* research on your own. oh what the heck... DBlink is the same as your cnn in your asp code. in other words you still need to create a connection to a database. chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: ASP to PHP language problems
Not trying to sound rude or anything, but have you looked up the mysql functions at http://php.net/mysql in your research? I would start with mysql_connect(), mysql_query(), and mysql_fetch_array()/mysql_result(). There are lots of user notes on each page as well which should be of assistance. HTH! --Sam Alistair Hayward wrote: Thanks Chris, Believe me, I have been doing research non-stop for a few days now and this is my last resort. The problem is the language. I can't find what I'm looking for on the net because I don't know what it's called. I have worked out how to create a connection to a mySQL server and database. (after spending so much time configuring and installing PHP and mySQL for the first time) I now know how to use include files. I can not figure out how to create a recordset and call fields from the record set while performing a loop. I have done heaps of research, but have not found what I need. Chris W. Parker wrote: Alistair Hayward mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 2:46 PM said: This is what I get when I try to create the recordset Notice: Use of undefined constant DBlink - assumed 'DBlink' in D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on line 24 well you're going to need to do a *little* research on your own. oh what the heck... DBlink is the same as your cnn in your asp code. in other words you still need to create a connection to a database. chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
Hello Alistair, Wednesday, March 10, 2004, 10:26:03 PM, you wrote: AH dim Type AH Type = CStr(Request.QueryString(action)) (getting parameter from URL) unset($type); $type = $_GET['action']; (Please note - you don't HAVE to unset each variable, but if you are working in a Register Globals ON environment, it's a good safety measure). AH strDBPath = Server.MapPath(/_database/database.mdb) MySQL doesn't work the same way as MDB files (thank goodness), so you need to create a connection to the MySQL database: $link = mysql_connect('localhost', 'username', 'password'); AH Set cnn = Server.CreateObject(ADODB.Connection) AH cnn.Open Provider=Microsoft.Jet.OLEDB.4.0;Data Source= strDBPath ; mysql_select_db('database_name', $link); AH Set rst = cnn.Execute(SELECT * FROM table WHERE Type =' type ' AH order by style) $sql= SELECT * FROM table WHERE type='$type' ORDER BY style; $result = mysql_query($sql); You now have the entire record set in $result. To obtain the first row of data, do this: AH %Do While Not rstSimple.EOF% AH do something AH % AH rstSimple.MoveNext AH Loop A few ways to do this: $total_records = mysql_num_rows($result); for ($i=0; $i $total_records; $i++) { $data = mysql_fetch_assoc($result); print_r($data); } $data will now be an array holding the first set of information. The print_r line just displays it so you can see it easily. Instead of a FOR loop you could do a while loop checking to see the end of the $result set, i.e.: while ($row = mysql_fetch_array($result, MYSQL_NUM)) { // do stuff print_r($row); } AH %=rst.fields(whatever).value% ?=$data['whatever']? -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
Richard: Thank you so much! Richard Davey wrote: Hello Alistair, Wednesday, March 10, 2004, 10:26:03 PM, you wrote: AH dim Type AH Type = CStr(Request.QueryString(action)) (getting parameter from URL) unset($type); $type = $_GET['action']; (Please note - you don't HAVE to unset each variable, but if you are working in a Register Globals ON environment, it's a good safety measure). AH strDBPath = Server.MapPath(/_database/database.mdb) MySQL doesn't work the same way as MDB files (thank goodness), so you need to create a connection to the MySQL database: $link = mysql_connect('localhost', 'username', 'password'); AH Set cnn = Server.CreateObject(ADODB.Connection) AH cnn.Open Provider=Microsoft.Jet.OLEDB.4.0;Data Source= strDBPath ; mysql_select_db('database_name', $link); AH Set rst = cnn.Execute(SELECT * FROM table WHERE Type =' type ' AH order by style) $sql= SELECT * FROM table WHERE type='$type' ORDER BY style; $result = mysql_query($sql); You now have the entire record set in $result. To obtain the first row of data, do this: AH %Do While Not rstSimple.EOF% AH do something AH % AH rstSimple.MoveNext AH Loop A few ways to do this: $total_records = mysql_num_rows($result); for ($i=0; $i $total_records; $i++) { $data = mysql_fetch_assoc($result); print_r($data); } $data will now be an array holding the first set of information. The print_r line just displays it so you can see it easily. Instead of a FOR loop you could do a while loop checking to see the end of the $result set, i.e.: while ($row = mysql_fetch_array($result, MYSQL_NUM)) { // do stuff print_r($row); } AH %=rst.fields(whatever).value% ?=$data['whatever']? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: ASP to PHP language problems
Since I am assuming Type is a text field, you will want to enclose it in single quotes. Also, because I am anal retentive, I like to also use the addslashes() function on any input coming in on the GET string or via a POST. Also, since all variables are preceded by a $ character, your call to mysql_query will fail. So, I would change your code to something like this: $type = addslashes($_GET['type']); $sql = SELECT * FROM tbCategory WHERE Type ='$type' order by style; $resultID = mysql_query($sql, $db); HTH! --Sam Alistair Hayward wrote: This is what I have: ?php $connection = mysql_connect(localhost,root,batman); if (!$connection) { echo Couldn't make a connection!; exit; } $db = mysql_select_db(sealhouse, $connection); if (!$db) { echo Couldn't select database!; exit; } $type = $_GET['type']; $sql = SELECT * FROM tbCategory WHERE Type =$type order by style; $resultID = mysql_query($sql, DB); Chris W. Parker wrote: Alistair Hayward mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 2:46 PM said: This is what I get when I try to create the recordset Notice: Use of undefined constant DBlink - assumed 'DBlink' in D:\Development\Completed\Sealhouse\phpSealTest\ProductSpecs.php on line 24 well you're going to need to do a *little* research on your own. oh what the heck... DBlink is the same as your cnn in your asp code. in other words you still need to create a connection to a database. chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
Richard Davey wrote: A few ways to do this: $total_records = mysql_num_rows($result); for ($i=0; $i $total_records; $i++) { $data = mysql_fetch_assoc($result); print_r($data); } $data will now be an array holding the first set of information. The print_r line just displays it so you can see it easily. Instead of a FOR loop you could do a while loop checking to see the end of the $result set, i.e.: while ($row = mysql_fetch_array($result, MYSQL_NUM)) { // do stuff print_r($row); } AH %=rst.fields(whatever).value% ?=$data['whatever']? I get this error: mysql_num_rows(): supplied argument is not a valid MySQL result resource Question: Where you have the //do stuff comment, I assume this is where my HTML code will go. But can I put it between the open brackets? I.E: { html code } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] ASP to PHP language problems
Hello Alistair, Wednesday, March 10, 2004, 11:26:53 PM, you wrote: AH I get this error: mysql_num_rows(): supplied argument is not a valid AH MySQL result resource Then your database connection failed OR the SQL query did. Check those steps over before anything else. Maybe post that part of your code so we can see? AH Question: Where you have the //do stuff comment, I assume this is where AH my HTML code will go. But can I put it between the open brackets? I.E: AH { AH html code AH } Yes like so: { ? html here ? } Just like in ASP :) -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Unique ID system - need help/ideas
I was given a database that has uniques IDs such as: AL1 AL2 AR1 AR2 MI1 etc... The first two letters are based on the state they live in, then it would need to look at the next 5 characters to determine the next ID. My problem is how do I recreate this in PHP to make sure any newly added records follow this same unique ID? So if I insert another Alabama record the id would be: AL3 Or insert a record from a new state would be: NY1 (so NY0 is the default starting point) Any ideas? Thank you in advance! __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Unique ID system - need help/ideas
J J mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 3:46 PM said: Any ideas? Thank you in advance! does it all have to be in the same field? can you not just combine two fields? one field would be called 'id' and it would be auto-incrementing. second field would be 'state' and it would contain the two letter abbreviation. i can think of a few other ways to get it all into one field, but they're a bit less efficient. then again i'm no sql expert. chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Unique ID system - need help/ideas
I'd like to keep it in one field if possible since that's how their database is now and data will be going back and forth. Plus there should be allowed two of the same numbers, so like: AL3 KY3 So any state with more than one record can be sequential and not jump around like KY3, AL4, KY5, etc. Make sense? --- Chris W. Parker [EMAIL PROTECTED] wrote: J J mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 3:46 PM said: Any ideas? Thank you in advance! does it all have to be in the same field? can you not just combine two fields? one field would be called 'id' and it would be auto-incrementing. second field would be 'state' and it would contain the two letter abbreviation. i can think of a few other ways to get it all into one field, but they're a bit less efficient. then again i'm no sql expert. chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Unique ID system - need help/ideas
J J mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 4:03 PM said: I'd like to keep it in one field if possible since that's how their database is now and data will be going back and forth. [snip] So any state with more than one record can be sequential and not jump around like KY3, AL4, KY5, etc. Make sense? yeah that makes sense. hmm.. well i'll give you my idea.. but it's very possible there's a better way to do it (than what i'm going to suggest). ok. one field will be used. it'll be a text (varchar) field. before you do an insert you'll need to find out what's in there ahead of time and then adjust accordingly. i'd select the last record that contained the two letter abbreviation, find out what the number was, increment it, then reconstruct the id and insert the new one. this of course won't prevent the exact same process from happening at the exact same time. i mean, two sessions could pull the same id and then reconstruct the (new, but) same id. make sense? chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Unique ID system - need help/ideas
Will it be able to figure out what the last number is if it's a character type and the number is something like 3? So it'll add one to make it 4 and not something like 10003. ?? --- Chris W. Parker [EMAIL PROTECTED] wrote: yeah that makes sense. hmm.. well i'll give you my idea.. but it's very possible there's a better way to do it (than what i'm going to suggest). ok. one field will be used. it'll be a text (varchar) field. before you do an insert you'll need to find out what's in there ahead of time and then adjust accordingly. i'd select the last record that contained the two letter abbreviation, find out what the number was, increment it, then reconstruct the id and insert the new one. this of course won't prevent the exact same process from happening at the exact same time. i mean, two sessions could pull the same id and then reconstruct the (new, but) same id. make sense? chris. __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Unique ID system - need help/ideas
J J mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 4:22 PM said: Will it be able to figure out what the last number is if it's a character type and the number is something like 3? So it'll add one to make it 4 and not something like 10003. php knows. you'll just have to pad the string with zeros. ?php $number = 01; ++$number; echo $number; ? that will output 2 not 101. chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
Hi. There is an ADO simulator for PHP (i think it's called ADODB PHP but i can't remember the link). There is also a asp to php converter called (can you guess? ) asp2php. Alistair Hayward wrote: Hi , What is the equavilant in PHP to creating a recordset in ASP using a query? This is what I do in PHP: .. dim Type Type = CStr(Request.QueryString(action)) (getting parameter from URL) Dim cnn ' ADO connection Dim rst ' ADO recordset Dim strDBPath ' path to my Access database (*.mdb) file strDBPath = Server.MapPath(/_database/database.mdb) Set cnn = Server.CreateObject(ADODB.Connection) cnn.Open Provider=Microsoft.Jet.OLEDB.4.0;Data Source= strDBPath ; Set rst = cnn.Execute(SELECT * FROM table WHERE Type =' type ' order by style) .. I can then call any field and display it in the html by using : %=rst.fields(whatever).value% .. I can also create a loop: %Do While Not rstSimple.EOF% do something % rstSimple.MoveNext Loop % Please can someone show me how to do the same thing in PHP? Alistair -- Raditha Dissanayake. --- http://www.radinks.com/upload/ Drag and Drop Upload thousands of files and folders in a single transfer. (HTTP or FTP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Unique ID system - need help/ideas
At 04:10 PM 3/10/2004 -0800, Chris W. Parker wrote: J J mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 4:03 PM said: I'd like to keep it in one field if possible since that's how their database is now and data will be going back and forth. [snip] So any state with more than one record can be sequential and not jump around like KY3, AL4, KY5, etc. Make sense? yeah that makes sense. hmm.. well i'll give you my idea.. but it's very possible there's a better way to do it (than what i'm going to suggest). ok. one field will be used. it'll be a text (varchar) field. before you do an insert you'll need to find out what's in there ahead of time and then adjust accordingly. i'd select the last record that contained the two letter abbreviation, find out what the number was, increment it, then reconstruct the id and insert the new one. this of course won't prevent the exact same process from happening at the exact same time. i mean, two sessions could pull the same id and then reconstruct the (new, but) same id. make sense? chris. Yes Chris, that's the right idea. The problem is that this is being done across the 'Net. Ideally you try and get a lock on the row for a given state, fetch the value and increment/update, then release the lock. In a web environment locks are a little tricky - what happens if a connection is lost or times out? For the original poster: Having said all this, make certain that there is a unique, system-generated, primary key for each table. As these keys *never* have to be seen by the public, don't get tampered with, etc., they can be safely relied on for inter-table relationships. Down the road they will save your bacon. If the purpose of having separate numbering sequences for each state is to keep track of a count, why bother? Just select for a count on each state. If it's a matter of ego, in that if I have a lower registration number I have higher status, well fill your boots with whatever scheme will work. Really look at this v. closely. Quite often clients insist on wacko numbering schemes which they are convinced are important, but frequently result only because that's the way it's always been done. Also remember there should be no data encoding within a field - that's why so many columns are possible. Example, membership numbers like MABT082003BM2, where the first four characters are my initials, the next six the date I joined, and each of the next the colour of my eyes, marital status and number of children, ARE FORBIDDEN. All that information belongs in separate fields. This is what you are tending towards with AL0003 and KY00107. Bad practice. As I'm Canadian, if I stepped on any toes I'll apologize in advance. g Cheers - Miles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to mesure response time of php pages
Hi there, can anybody recommend tools to messure page loading time of php pages. I am working on a new site and it apears to me that the old one loads much faster. Are there any tools around to break this down to hard numbers? thanx for any hint, merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to mesure response time of php pages
Merlin mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 5:05 PM said: can anybody recommend tools to messure page loading time of php pages. I am working on a new site and it apears to me that the old one loads much faster. Are there any tools around to break this down to hard numbers? you can time your scripts on the command line to see how long they execute. maybe that will shed some light? $ time php myscript.php another idea is that maybe the old server was gzipping the data before it went over the pipe and now it's not? chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
Richard Davey wrote: Hello Alistair, Wednesday, March 10, 2004, 11:26:53 PM, you wrote: AH I get this error: mysql_num_rows(): supplied argument is not a valid AH MySQL result resource Then your database connection failed OR the SQL query did. Check those steps over before anything else. Maybe post that part of your code so we can see? AH Question: Where you have the //do stuff comment, I assume this is where AH my HTML code will go. But can I put it between the open brackets? I.E: AH { AH html code AH } Yes like so: { ? html here ? } Just like in ASP :) ?php unset($type); $type = $_GET['type']; $link = mysql_connect('localhost', 'user', 'password'); if (!$link) { echo Couldn't make a connection!; exit; } $db = mysql_select_db(sealhouse, $link); if (!$db) { echo Couldn't select database!; exit; } $sql= SELECT * FROM table WHERE type=$type ORDER BY style; $result = mysql_query($sql); $total_records = mysql_num_rows($result); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
Sorry, was the query! Richard Davey wrote: Hello Alistair, Wednesday, March 10, 2004, 11:26:53 PM, you wrote: AH I get this error: mysql_num_rows(): supplied argument is not a valid AH MySQL result resource Then your database connection failed OR the SQL query did. Check those steps over before anything else. Maybe post that part of your code so we can see? AH Question: Where you have the //do stuff comment, I assume this is where AH my HTML code will go. But can I put it between the open brackets? I.E: AH { AH html code AH } Yes like so: { ? html here ? } Just like in ASP :) ?php unset($type); $type = $_GET['type']; $link = mysql_connect('localhost', 'user', 'password'); if (!$link) { echo Couldn't make a connection!; exit; } $db = mysql_select_db(sealhouse, $link); if (!$db) { echo Couldn't select database!; exit; } $sql= SELECT * FROM table WHERE type=$type ORDER BY style; $result = mysql_query($sql); $total_records = mysql_num_rows($result); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to mesure response time of php pages
You can also use something like Turck MMCache to accelerate the scripts. There is a class at http://pear.php.net for benchmarking PHP scripts and you can use a web client that times how long it takes to download a page. I would look at template caching and Turck MMCache to increase performance. jason -Original Message- From: Chris W. Parker [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 6:15 PM To: Merlin; [EMAIL PROTECTED] Subject: RE: [PHP] How to mesure response time of php pages Merlin mailto:[EMAIL PROTECTED] on Wednesday, March 10, 2004 5:05 PM said: can anybody recommend tools to messure page loading time of php pages. I am working on a new site and it apears to me that the old one loads much faster. Are there any tools around to break this down to hard numbers? you can time your scripts on the command line to see how long they execute. maybe that will shed some light? $ time php myscript.php another idea is that maybe the old server was gzipping the data before it went over the pipe and now it's not? chris. -- 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] proxy of sorts
two files proxy.php and image.php proxy downloads the website and image downloads the pictures proxy.php-- ?php /\ * Check to see if a web address is present...* * iproxy is where the imagaes are loaded * * myproxy is the addres of the proxy php page* \/ if(isset($_GET['web'])) { $stimer = explode( ' ', microtime() ); $stimer = $stimer[1] + $stimer[0]; $web = $_GET['web']; $iproxy = 'http://www.website.com/image.php?image='; $myproxy = 'http://www.website.com/proxy.php?web='; $site = 'a href='.$myproxy.$web; /\ * opens the remote page for reading * * and loads it into alltext * \/ $fd = fopen($web,rb); $alltext = ; do { $data = fread($fd, 8192); if (strlen($data) == 0) { break; } $alltext .= $data; } while (true); fclose($fd); /\ * strips the address down to its root* * unless it already is * \/ $web1 = dirname ($web); if($web1 !== http:) { $web = $web1; } /\ * removes current web address from tags and * * checks for all variants of spacing and quotes * * and then prints it out onto the screen * \/ $pattern = array( '{src[ ]*=[ ]*(|\')}i', '{src=(|\')'.$web.'}i', '{src=(|\')/}i', '{src=(|\')http}i', '{src=(|\')}i', '{(|\'):::}i', '{\.src[ ]*=[ ]*}i', '{\.src='.$web.'}i', '{\.src=/}i', '{\.src=http}i', '{\.src=}i', '{:::}i', '{newImage\((|\')'.$web.'}i', '{newImage\((|\')/}i', '{newImage\((|\')}i', '{a href[ ]*=[ ]*(|\')}i', '{a href=(|\')'.$web.'}i', '{a href=(|\')/}i', '{a href=(|\')http}i', '{a href=(|\')}i', '{(|\'):::}i', '{url\(}i', '{background[ ]*=[ ]*(|\')}i', '{background=(|\')'.$web.'}i', '{background=(|\')/}i', '{background=(|\')}i', '{(\w)(\w)}i' ); $replace = array( 'src=\1', 'src=\1', 'src=\1', '\1:::', 'src=\1'.$iproxy.$web.'/', 'src=\1'.$iproxy.'http', '.src=', '.src=', '.src=', ':::', '.src= '.$iproxy.$web.'/ + ', 'src='.$iproxy.'http'.' + ', 'newImage(\1', 'newImage(\1', 'newImage(\1'.$iproxy.$web.'/', 'a href=\1', 'a href=\1', 'a href=\1', '\1:::', 'a href=\1'.$myproxy.$web.'/', 'a href=\1'.$myproxy.'http', 'url('.$iproxy.$web.'/', 'background=\1', 'background=\1', 'background=\1', 'background=\1'.$iproxy.$web.'/', '\1 \2' ); $alltext = preg_replace($pattern, $replace, $alltext); $alltext = preg_replace('{a href=(|\')http://www\.website\.com/proxy\.php\?web=([^]*)(gif|jpeg)}i', 'a href=\1'.$iproxy.'\2\3', $alltext); //- $etimer = explode( ' ', microtime() ); $etimer = $etimer[1] + $etimer[0]; echo 'p style=margin:auto; text-align:center'; printf( Script timer: b%f/b seconds. Parsed .strlen($alltext). chars., ($etimer-$stimer) ); echo '/p'; echo $alltext; } ? image.php-- ?php /\ * gets the image name an location from proxy.php * * loads the image as image.php for proxy to call * \/ $img = $_GET['image']; $img = preg_replace({ }, , $img); $fd = fopen($img,rb); $alltext = ; do { $data = fread($fd, 8192); if (strlen($data) == 0) { break; } $alltext .= $data; //set_time_limit(1); } while (true); fclose($fd); echo $alltext; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
On Wednesday 10 March 2004 18:54, Raditha Dissanayake wrote: Hi. There is an ADO simulator for PHP (i think it's called ADODB PHP but i can't remember the link). There is also a asp to php converter called (can you guess? ) asp2php. http://php.weblogs.com/ And Pear::DB must work too :P http://pear.php.net/package/DB http://www.onlamp.com/pub/a/php/2001/11/29/peardb.html -- roche -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Are $_POST and $_GET interchangable? MORE
Jay Blanchard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [snip] stuff [/snip] From http://www.w3.org/TR/html4/interact/forms.html#h-17.13.1 17.13.1 Form submission method The method attribute of the FORM element specifies the HTTP method used to send the form to the processing agent. This attribute may take two values: get: With the HTTP get method, the form data set is appended to the URI specified by the action attribute (with a question-mark (?) as separator) and this new URI is sent to the processing agent. post: With the HTTP post method, the form data set is included in the body of the form and sent to the processing agent. The get method should be used when the form is idempotent (i.e., causes no side-effects). Many database searches have no visible side-effects and make ideal applications for the get method. If the service associated with the processing of a form causes side effects (for example, if the form modifies a database or subscription to a service), the post method should be used. Note. The get method restricts form data set values to ASCII characters. Only the post method (with enctype=multipart/form-data) is specified to cover the entire [ISO10646] character set. I'm begining to see. The definitions of $_POST and $_GET are word for word identical as predefined variables: http://ca.php.net/reserved.variables However they are designed to be paired with post and get form methods, the $_GET to be used with a href query string (after the '?' in a url) as mentioned in the page you supplied above (reposted below): http://www.w3.org/TR/html4/interact/forms.html#h-17.13.1 So apparently, one of the morals to the story is that the $_GET method is more prone to security breach? I still don't see the whole picture, but for what I'm doing now I don't really need to. Dale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] ASP to PHP language problems
Hello Alistair, Thursday, March 11, 2004, 1:25:47 AM, you wrote: AH ?php AH unset($type); AH $type = $_GET['type']; AH $link = mysql_connect('localhost', 'user', 'password'); AH if (!$link) { AH echo Couldn't make a connection!; AH exit; AH } AH $db = mysql_select_db(sealhouse, $link); AH if (!$db) { AH echo Couldn't select database!; AH exit; AH } AH $sql= SELECT * FROM table WHERE type=$type ORDER BY style; AH $result = mysql_query($sql); AH $total_records = mysql_num_rows($result); Try and put single quotes around the $type in your query. Especially if it's not numeric: $sql = SELECT blah WHERE type='$type'; Otherwise, the code is fine. So assuming the database exists and the query is valid (i.e. works from MySQL itself) then it should work. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Unique ID system - need help/ideas
Yeah thanks for the feedback, I'm already including a primary key auto_increment field in place to tie the tables together with an ID I *know* will be unique. This other ID scheme is just to work within their existing system that uses this. I'm just trying to mirror/maintain that scheme for their purpose. --- Miles Thompson [EMAIL PROTECTED] wrote: For the original poster: Having said all this, make certain that there is a unique, system-generated, primary key for each table. As these keys *never* have to be seen by the public, don't get tampered with, etc., they can be safely relied on for inter-table relationships. Down the road they will save your bacon. If the purpose of having separate numbering sequences for each state is to keep track of a count, why bother? Just select for a count on each state. If it's a matter of ego, in that if I have a lower registration number I have higher status, well fill your boots with whatever scheme will work. Really look at this v. closely. Quite often clients insist on wacko numbering schemes which they are convinced are important, but frequently result only because that's the way it's always been done. Also remember there should be no data encoding within a field - that's why so many columns are possible. Example, membership numbers like MABT082003BM2, where the first four characters are my initials, the next six the date I joined, and each of the next the colour of my eyes, marital status and number of children, ARE FORBIDDEN. All that information belongs in separate fields. This is what you are tending towards with AL0003 and KY00107. Bad practice. As I'm Canadian, if I stepped on any toes I'll apologize in advance. g Cheers - Miles -- __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php