Re: [PHP] page redirect question
The keyword you are looking for is ob_start() Or Output Buffering ! Check that out. On Wed, 10 Nov 2004 09:39:06 +0530, Zareef Ahmed [EMAIL PROTECTED] wrote: Hi, Alas there is no any other way to redirect the page without sending headers in PHP. You may use javascript for this purpose. Well it is matter of programming practice. We must do processing before presenting the content to users. It will be helpful in many situations. So instead of doing 1.Draw header 2. Draw middle bar upon user input and according to business logic. 3. Draw footer We Must Use 1. Make Business logic and process user input and do required task such as redirection 2. Store result of step 1 in any entities like variables. 3. Draw Header 4. Make Middle bar using set entities. 5. Draw footer. This is just a overview of approach. You may need to process more things along with middle bar, but it is good idea to do logical processing before presentation. Zareef Ahmed -Original Message- From: Victor C. [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 09, 2004 9:37 PM To: [EMAIL PROTECTED] Subject: [PHP] page redirect question Hi, Is there anyway to redirect php page other than using HEADER(LOCATION:URL) ? Header can only be called if nothing is written to HTML... Is there anyway around it? Thanks, -- -- Zareef Ahmed :: A PHP develoepr in Delhi ( India ) Homepage :: http://www.zasaifi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- M.Saleh.E.G 97150-4779817 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie: string to char array
Hi, I wonder if it is possible to convert a given string into an array of chars without using a separator. That is, is there a function mySplit with mySplit('example') == array('e', 'x', 'a', 'm', 'p' 'l' 'e') ? Thanks Horst Horst Jäger Schaafenstr. 25 50676 Köln Tel: 0221/93187015 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie: string to char array
Horst Jäger wrote: Hi, I wonder if it is possible to convert a given string into an array of chars without using a separator. That is, is there a function mySplit with mySplit('example') == array('e', 'x', 'a', 'm', 'p' 'l' 'e') ? $chars_array = preg_split('//', 'example', -1, PREG_SPLIT_NO_EMPTY); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] POST losing SESSION vars?
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 09 November 2004 18:21 Pass your session along with your form action... i.e $s = SID; echo form action=\.$_SERVER['PHP_SELF'].?$s\ method=post You shouldn't need to do this, unless you've changed your PHP configuration to not add the session ID to a form submission. Contrariwise, you *should* add the SID to all Location: headers: header(Location: index.php? . SID); Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, 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
[PHP] Shell Script error
Hi, I have a small problem with a PHP script with Pear DB The problem is the following: I'm creating a shell script in PHP that access one interbase database. The problem is that if i run it on a webserver the script run correctly but if i runit in the command line it reports one error (DB Error: connect failed). Does anybody know what is the problem ? Thanks in advance Rui Francisco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php mail() error
Im using the php mail() function to try send an email to a user that has just registered. mail($HTTP_POST_VARS['emailaddress1'], 'Matchmakers Website Registration' , 'Welcome'); But when I get the following error back.: Warning: mail(): SMTP server response: 550 5.7.1 Unable to relay for [EMAIL PROTECTED] Can someone help me out, by telling me what it means or what Im doing wrong? Thanx Garth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shell Script error
well maybe you are trying to connect to localhost which could be fine for the server but not from commandline... send more info. Rui Francisco [EMAIL PROTECTED] 11/10/2004 2:06:09 PM Hi, I have a small problem with a PHP script with Pear DB The problem is the following: I'm creating a shell script in PHP that access one interbase database. The problem is that if i run it on a webserver the script run correctly but if i runit in the command line it reports one error (DB Error: connect failed). Does anybody know what is the problem ? Thanks in advance Rui Francisco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Do You Need addslashes() When Using Bind Variables
Hi Francis No. Thats one of the great things about bind variables. cheers Simon On Wednesday 10 November 2004 05:45, Francis Chang wrote: Hi, I'm using the Oracle database though I think this question is generic to all databases. If you're using bind variables and preparing the SQL statements ahead of time, do you still need to call addslashes() before binding the strings to the bind variables? Thanks in advance. Francis -- ~~ Simon Rees | [EMAIL PROTECTED] | ORA-03113: end-of-file on communication channel ~~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] link in ModalDialog
i'm working at some kind of HTLM editor for a web-page, and have in page, some js code which showModalDialog('upload_img.php') and read the window return values and paste-it in page (text area). the upload_img.php uploads img and returns the value to pe paste in page (remote location of uploaded file). the problem is any link, redirect I do in ModalDialog, a new page is open ... any ideea .. how to resolve this .. ? PS: question is a little bit offtopic, but pls help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: basic script
* A Garcia [EMAIL PROTECTED]: I just want the URL that is on the navigator bar be printed... this is my script but it just does not do it... why,.. please help, cheers HTML TITLEFirst Variables Example/TITLE BODY ?php echo VALUE IS: $x;? /BODY /HTML Not exactly sure what you're trying to accomplish here, but if you're trying to get something like: http://localhost/script.php?x=2 to then print VALUE IS: 2 it most likely won't work with recent versions of PHP (e.g., PHP = 4). This is because the default settings in the php.ini file have register_globals turned off for security reasons. You can still accomplish that you want to do; simply change the php line to: ?php echo VALUE IS: . $_GET['x']; ? If that's not what you're trying to do... explain in more detail. -- Matthew Weier O'Phinney | mailto:[EMAIL PROTECTED] Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Shell Script error
* Rui Francisco [EMAIL PROTECTED]: I have a small problem with a PHP script with Pear DB The problem is the following: I'm creating a shell script in PHP that access one interbase database. The problem is that if i run it on a webserver the script run correctly but if i runit in the command line it reports one error (DB Error: connect failed). Does anybody know what is the problem ? Are you running the script on the same server as the webserver process? If not, you may need to set up additional permissions on the database to run it from the new machine. -- Matthew Weier O'Phinney | mailto:[EMAIL PROTECTED] Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie: string to char array
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -Original Message- From: Horst Jäger [mailto:[EMAIL PROTECTED] Sent: 10 November 2004 09:51 I wonder if it is possible to convert a given string into an array of chars without using a separator. That is, is there a function mySplit with mySplit('example') == array('e', 'x', 'a', 'm', 'p' 'l' 'e') ? Do you absolutely need it as an array? If indexing by character would suffice, just use PHP's {} syntax: $s = 'example'; echo $s{0};// e echo $s{1};// x // etc. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, 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
[PHP] RDF/XML Parser: SimpleRDF
Hi all, I was looking for an easy RDF parser writen in PHP but I failed. There are some parsers out there but I could not find the right one for me... I decided to write an RDF parser by myself... not easy ;-)... I created SimpleRDF parser on sourceforge.net under BSD license and I'd like to ask you guys for help. If you have time to play little bit with RDF or you are looking for RDF/PHP parser - test mine (even if you don't expect to use it - just try it, please). I'm currently working on version 0.2 that has the ability to save (for now it can only read/parse and save N-Triples) RDF/XML documents. SimpleRDF is based on PHP5/XSL. XSL part simplifies the RDF/XML source to allow easy parsing (XSL part can be used as standalone XSL stylesheet if you need). PHP5 part provides really simple API - my goal was really KISS (keep it simple, stupid). It is well commented. Thanks for any testing/feedback... Link: sf.net/projects/simplerdf elixon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple(?) array of form input data needs to get into MySQL
I have a problem (the core of it being that I am VERY new at PHP and MySQL), wondering if anyone can suggest solutions. I've been charged with handling creation of new web pages for entering kids' data into a database for a local parents' club, for babysitting co-ops and such. What we want to do: a) The registration form will ask for parents' name and contact info (I'm not having any problem handling that), and ask them how many children they have. b) After submitting this, PHP puts these values into a MySQL database (again, no problem) and will give them a second form, with one set of form inputs for each child (I haven't figured out how to do this yet; it sounds simple enough though). For example, if you said you have 3 kids, the next form might look like this: Child # First NameMiddle Name Last Name Gender DoB School Name 1 _ ___ _ _ ___ 2 _ ___ _ _ ___ 3 _ ___ _ _ ___ Where the fields will be named Child1Number, Child1FirstName, etc., all the way through Child3SchoolName. The PHP script that processes this form after it is submitted needs to a) create a childID for each child (this is simply main account-holder's ID with c, d, e, etc., appended, and b) enter the data for each child into the database, in the child table. I have *THREE* PHP MySQL books, and so far cannot figure out how to do this in a sensible way, which I understand should be an array. The array chapters and examples all give sample code that is completely useless for my purposes (generally the examples are of pre-determined data, like tires and spark plugs and oil cans in an automotive catalog, and how to print them out of the array into a web page). Me, I'm trying to take fresh input from the user, put it into an array somehow, and have a loop (that I don't know how to write yet), generate a childID for each child in turn, and enter each child's information in turn into the database, keyed to that childID, and do so in an efficient way. (The inefficient way would be to, say, assume a maximum of 15 children, and, not using an array, then have the script ask, Does child #1 exist in the form? Yes? Then create its user ID; now enter its data in the database. Does child #2 exist? Hardly good program design. Even I know that, and I can't program my way out of paper bag (I'm an HTML/CSS guy, not a programmer. Yet.) And, this should be an associative array, not a numerically indexed one, since other people who probably won't be programmers will need to be able to look at this down the road and understand precisely what it does with what data and why. The other issue would be how to create the child form so that it only has the number of fields required for the number of children they say they have. The whole for and each loop construction stuff is very, very fuzzy in my head, in the absence of good examples. PS: AFTER registration and login, if people want to be able to edit this info, e.g. to add a new child in the family, there needs to be a form that will load all of their existing family data and allow them to edit it. No problem. But is there a way with PHP to have the how many children do you have selector auto-reload the page with a new, empty field for an additional child, if they had 3 kids but go to this profile editing form and change it to say 4 kids? I could do this with Javascript, but if PHP itself can do it, that would be cool. I suspect that without JS, the best I can do is either a) always have a blank child field just in case (but what if they just had twins?; not such a great solution) or b) allow them to edit everything so far entered into the DB, and if they change the number of kids have the form come back after they submit it, with a new line of form fields for a new child and a note at the top to add the new child's info. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Does anyone have a valid magic.mime file?
Hi everyone! I've been trying to get mime_magic to work with PHP 5.0.2, but it seems to complain about the magic file being valid. I've tried both with the Apache 2.0.52 version of magic and with the PHP5 Win32 version of magic.mime, but it still says that they're invalid. Please, does anyone have a magic.mime file which is known to be working with PHP 5 on some variant of UNIX/Linux? If so, I'd very much appreciate getting a copy to try with. Many thanks in advance! Best regards, Björn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question on functions
My question is in regard to passing global variables to a function. Here is my code, any idea why it is not working? I suppose my understanding of a global variable being able to be used within a function is off? global $array = array( 0 = hostname, 1 = username, 2 = password ); function database() { $dbase = mysql_pconnect( $array[0], $array[1], $array[2] )or die( mysql_error()); if( connection_status() != 1 ) { echo connection failed; } } call_user_func( database ); -- Jason Gerfen [EMAIL PROTECTED] And remember... If the ladies don't find you handsome, they should at least find you handy... ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Jason wrote: My question is in regard to passing global variables to a function. Here is my code, any idea why it is not working? I suppose my understanding of a global variable being able to be used within a function is off? global $array = array( 0 = hostname, 1 = username, 2 = password ); function database() { You need to declare it global within the function... function database() { global $array; ... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
John Holmes wrote: Jason wrote: My question is in regard to passing global variables to a function. Here is my code, any idea why it is not working? I suppose my understanding of a global variable being able to be used within a function is off? global $array = array( 0 = hostname, 1 = username, 2 = password ); function database() { You need to declare it global within the function... function database() { global $array; ... thanks, it figures it is something easy like that... =) -- Jason Gerfen [EMAIL PROTECTED] And remember... If the ladies don't find you handsome, they should at least find you handy... ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shell Script error
Its a simple script $_SERVER['utilizador']='user'; $_SERVER['pass']='pass'; $_SERVER['host']='localhost or IP address'; $_SERVER['db_name']='c:/path/dbname.fdb'; include_once('DB.php'); $dsn=ibase://.$_SERVER['utilizador'].:.$_SERVER['pass'].@.$_SERVER['host']./.$_SERVER['db_name']; $ligacaoBD=DB::connect($dsn); if (DB::isError($ligacaoBD)) { die($ligacaoBD-getMessage()); } The user has admin right on the database, and the database doesn't implement security measures like Mysql for access from other hosts. The problem is that if i run the script on the browser it works, but on the command line on Windows machine it doesn't work Thanks in advance Rui Francisco Angelo Zanetti wrote: well maybe you are trying to connect to localhost which could be fine for the server but not from commandline... send more info. Rui Francisco [EMAIL PROTECTED] 11/10/2004 2:06:09 PM Hi, I have a small problem with a PHP script with Pear DB The problem is the following: I'm creating a shell script in PHP that access one interbase database. The problem is that if i run it on a webserver the script run correctly but if i runit in the command line it reports one error (DB Error: connect failed). Does anybody know what is the problem ? Thanks in advance Rui Francisco -- Rui Francisco - [EMAIL PROTECTED] FCCN - Fundação para a Computação Científica Nacional Av. Brasil, 101 1700-066 Lisboa - Portugal Tel: +351 218440100 Fax: +351 218472167 - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Or you can use superglobal variable $GLOBALS that is array containing all GLOBAL variables. This variable is superglobal thus does not need to be declared global using 'global $GLOBALS;' statement. Works anywhere. function database() { ... $GLOBALS['array'][0], $GLOBALS['array'][1] ... } elixon Tip: I recommend to not use GLOBALS for this type of data. Better use function parameters - function database($host, $user, $pwd, $db) {...} It will save you time when your application grows and starts clashing with other global variables or third party pieces of code ;-) Jason Gerfen wrote: John Holmes wrote: Jason wrote: My question is in regard to passing global variables to a function. Here is my code, any idea why it is not working? I suppose my understanding of a global variable being able to be used within a function is off? global $array = array( 0 = hostname, 1 = username, 2 = password ); function database() { You need to declare it global within the function... function database() { global $array; ... thanks, it figures it is something easy like that... =) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help: Database Search
I am creating a database search form and results. Running into a problem though. I have two form elements, both that are fed by tables that have int values (1, 2 , etc) my sql statement is such: SELECT vendorjobs.PostStart, vendorjobs.JobTitle, vendorjobs.Industry, vendorjobs.VendorID, vendorjobs.LocationCity, vendorjobs.TaxTerm FROM vendorjobs WHERE vendorjobs.Industry = '$Ind' AND Date_Sub(Curdate(), interval '$Days' day) = PostStart But if the user decides to only use one of the elements, then I don't want the query to return nothing because of the And in the where clause so I have these 2 statements that set a default value (shown here as 0 in the event one of the two elements aren't selected: (Having no luck as the form still only works correctly if I've set both elements) $Ind = 0; if (isset($_POST['Ind'])) { $Ind = (get_magic_quotes_gpc()) ? $_POST['Ind'] : addslashes($_POST['Ind']); } $Days = 0; if (isset($_POST['Days'])) { $Days = (get_magic_quotes_gpc()) ? $_POST['Days'] : addslashes($_POST['Days']); Thank you , Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shell Script error
* Rui Francisco [EMAIL PROTECTED]: Its a simple script $_SERVER['utilizador']='user'; $_SERVER['pass']='pass'; $_SERVER['host']='localhost or IP address'; $_SERVER['db_name']='c:/path/dbname.fdb'; Why are you using the $_SERVER array? This is supposed to provide information regarding the web server environment, such as headers, script and path locations, and other items in the CGI specifications; it shouldn't be used for storing application data. In addition, it may or may not be available on the command line, which could be causing the issue you're seeing. If you simply need a global array... set up an array and then initialize it in your functions/classes using the global keyword. Alternately, $_ENV might be a better place to store this information. include_once('DB.php'); $dsn=ibase://.$_SERVER['utilizador'].:.$_SERVER['pass'].@.$_SERVER['host']./.$_SERVER['db_name']; $ligacaoBD=DB::connect($dsn); if (DB::isError($ligacaoBD)) { die($ligacaoBD-getMessage()); } The user has admin right on the database, and the database doesn't implement security measures like Mysql for access from other hosts. The problem is that if i run the script on the browser it works, but on the command line on Windows machine it doesn't work well maybe you are trying to connect to localhost which could be fine for the server but not from commandline... send more info. Rui Francisco [EMAIL PROTECTED] 11/10/2004 2:06:09 PM Hi, I have a small problem with a PHP script with Pear DB The problem is the following: I'm creating a shell script in PHP that access one interbase database. The problem is that if i run it on a webserver the script run correctly but if i runit in the command line it reports one error (DB Error: connect failed). -- Matthew Weier O'Phinney | mailto:[EMAIL PROTECTED] Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [PHP-WIN] Re: [PHP] Shell Script error
not too sure but can your database name be a path?? Rui Francisco [EMAIL PROTECTED] 11/10/2004 4:28:21 PM Its a simple script $_SERVER['utilizador']='user'; $_SERVER['pass']='pass'; $_SERVER['host']='localhost or IP address'; $_SERVER['db_name']='c:/path/dbname.fdb'; include_once('DB.php'); $dsn=ibase://.$_SERVER['utilizador'].:.$_SERVER['pass'].@.$_SERVER['host']./.$_SERVER['db_name']; $ligacaoBD=DB::connect($dsn); if (DB::isError($ligacaoBD)) { die($ligacaoBD-getMessage()); } The user has admin right on the database, and the database doesn't implement security measures like Mysql for access from other hosts. The problem is that if i run the script on the browser it works, but on the command line on Windows machine it doesn't work Thanks in advance Rui Francisco Angelo Zanetti wrote: well maybe you are trying to connect to localhost which could be fine for the server but not from commandline... send more info. Rui Francisco [EMAIL PROTECTED] 11/10/2004 2:06:09 PM Hi, I have a small problem with a PHP script with Pear DB The problem is the following: I'm creating a shell script in PHP that access one interbase database. The problem is that if i run it on a webserver the script run correctly but if i runit in the command line it reports one error (DB Error: connect failed). Does anybody know what is the problem ? Thanks in advance Rui Francisco -- Rui Francisco - [EMAIL PROTECTED] FCCN - Fundação para a Computação Científica Nacional Av. Brasil, 101 1700-066 Lisboa - Portugal Tel: +351 218440100 Fax: +351 218472167 - -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help: Database Search
You might want to try looking up the syntax for left join queries. I think this might be what you are after. http://dev.mysql.com/doc/mysql/en/JOIN.html On Wednesday 10 November 2004 14:37, Stuart Felenstein wrote: I am creating a database search form and results. Running into a problem though. I have two form elements, both that are fed by tables that have int values (1, 2 , etc) my sql statement is such: SELECT vendorjobs.PostStart, vendorjobs.JobTitle, vendorjobs.Industry, vendorjobs.VendorID, vendorjobs.LocationCity, vendorjobs.TaxTerm FROM vendorjobs WHERE vendorjobs.Industry = '$Ind' AND Date_Sub(Curdate(), interval '$Days' day) = PostStart But if the user decides to only use one of the elements, then I don't want the query to return nothing because of the And in the where clause so I have these 2 statements that set a default value (shown here as 0 in the event one of the two elements aren't selected: (Having no luck as the form still only works correctly if I've set both elements) $Ind = 0; if (isset($_POST['Ind'])) { $Ind = (get_magic_quotes_gpc()) ? $_POST['Ind'] : addslashes($_POST['Ind']); } $Days = 0; if (isset($_POST['Days'])) { $Days = (get_magic_quotes_gpc()) ? $_POST['Days'] : addslashes($_POST['Days']); Thank you , Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help: Database Search
--- Jon Hill [EMAIL PROTECTED] wrote: You might want to try looking up the syntax for left join queries. I think this might be what you are after. http://dev.mysql.com/doc/mysql/en/JOIN.html It has nothing to do with left joins. It works fine provided I do one of two things, make selections on both form elements, or change the where statement to or instead of and. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php mail() error
On Wednesday 10 November 2004 12:36, Garth Hapgood - Strickland wrote: Im using the php mail() function to try send an email to a user that has just registered. mail($HTTP_POST_VARS['emailaddress1'], 'Matchmakers Website Registration' , 'Welcome'); But when I get the following error back.: Warning: mail(): SMTP server response: 550 5.7.1 Unable to relay for [EMAIL PROTECTED] Can someone help me out, by telling me what it means or what Im doing wrong? This is a VERY FAQ. googling the error message will tell you what it means. Searching the archives will give you some solutions. Or you can wait for Manuel Lemos' reply :) -- 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 -- /* He who is content with his lot probably has a lot. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error logging problem
On Wed, 10 Nov 2004 10:49:29 -0500, Al [EMAIL PROTECTED] wrote: ini_set(error_log, /AutoSch/error.log); Looks like this might be a path relative to your domain or your vhost definition? I'd go with a full system path if that's the case. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie: string to char array
Ford, Mike wrote: To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm are you in a position to impose any terms (not that i have visited your link) on an email that get's distributed to thousands of readers, get's archived on hundreds of sites and possibly ends up in the inbox of bots designed to harvest email addresses? -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php mail() error
On Wed, 10 Nov 2004 23:14:43 +, Jason Wong [EMAIL PROTECTED] wrote: Or you can wait for Manuel Lemos' reply :) Good one. :) -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Could you give me a good example of the tip you recommend or point me to a good tutorial on it? Elixon wrote: Or you can use superglobal variable $GLOBALS that is array containing all GLOBAL variables. This variable is superglobal thus does not need to be declared global using 'global $GLOBALS;' statement. Works anywhere. function database() { ... $GLOBALS['array'][0], $GLOBALS['array'][1] ... } elixon Tip: I recommend to not use GLOBALS for this type of data. Better use function parameters - function database($host, $user, $pwd, $db) {...} It will save you time when your application grows and starts clashing with other global variables or third party pieces of code ;-) Jason Gerfen wrote: John Holmes wrote: Jason wrote: My question is in regard to passing global variables to a function. Here is my code, any idea why it is not working? I suppose my understanding of a global variable being able to be used within a function is off? global $array = array( 0 = hostname, 1 = username, 2 = password ); function database() { You need to declare it global within the function... function database() { global $array; ... thanks, it figures it is something easy like that... =) -- Jason Gerfen Student Computing Marriott Library 801.585.9810 [EMAIL PROTECTED] And remember... If the ladies don't find you handsome, they should at least find you handy... ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Multiple session_start()s / Is it a problem??
I guess that session_id() method will return null if session is not started (not tested) so theoreticaly you can use: if (!session_id()) session_start(); elixon Al wrote: Is there a problem issuing multiple session_start()s for a given script? I can't find anything in the manual that says one way or the other. I have some scripts that call more than one functions include file and for convenience put a session_start() on each one. This gives me a Notice error. Of course I can simply use @session_start() to negate the Notice; but, I want to be certain this is good practice. Al. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple session_start()s / Is it a problem??
On Wed, 10 Nov 2004 10:40:17 -0500, Al [EMAIL PROTECTED] wrote: Of course I can simply use @session_start() to negate the Notice; but, I want to be certain this is good practice. I haven't tried it but you might try wrapping session_start() that with if ( !isset ($_SESSION) ) if you don't like using the @ error suppression. I usually have a single common file like config.php or something that I do session_start() in, so I've never actually ran across this issue. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Multiple session_start()s / Is it a problem??
And I think that $_SESSION does not exist unless session is started = if (!is_array($_SESSION)) session_start(); might do the job as well. elixon Al wrote: Is there a problem issuing multiple session_start()s for a given script? I can't find anything in the manual that says one way or the other. I have some scripts that call more than one functions include file and for convenience put a session_start() on each one. This gives me a Notice error. Of course I can simply use @session_start() to negate the Notice; but, I want to be certain this is good practice. Al. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help: Database Search
On Wednesday 10 November 2004 14:37, Stuart Felenstein wrote: But if the user decides to only use one of the elements, then I don't want the query to return nothing because of the And in the where clause so I have these 2 statements that set a default value (shown here as 0 in the event one of the two elements aren't selected: (Having no luck as the form still only works correctly if I've set both elements) Why not build your sql query according to whether or not whatever you want is selected or not. That way debugging is easier as you won't be looking at queries that contain redundant ... AND 0 -- 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 -- /* This system will self-destruct in five minutes. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help: Database Search
On Wednesday 10 November 2004 15:37, Stuart Felenstein wrote: --- Jason Wong [EMAIL PROTECTED] wrote: Why not build your sql query according to whether or not whatever you want is selected or not. That way debugging is easier as you won't be looking at queries that contain redundant ... AND 0 Jason, How would I do that ? Care to share a short exmaple ? A simplistic pseudo-code version: $sql = SELECT blah WHERE 1; if ($something = selected) { $sql .= AND something; } ... ... $sql .= ... rest of query; Anyway, someone has already posted a more detailed example. -- 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 -- /* Hmm... Which would do a better job at driving physicists crazy? Travel faster than light, or a floating-point boolean value? -- Michael Mol */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help: Database Search
What about doing something like: $sql = SELECT * FROM my_table WHERE col1=$var1; if (isset($var2)) $sql .= AND col2='$var2'; HTH Graham -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: 10 November 2004 14:37 To: [EMAIL PROTECTED] Subject: [PHP] Help: Database Search I am creating a database search form and results. Running into a problem though. I have two form elements, both that are fed by tables that have int values (1, 2 , etc) my sql statement is such: SELECT vendorjobs.PostStart, vendorjobs.JobTitle, vendorjobs.Industry, vendorjobs.VendorID, vendorjobs.LocationCity, vendorjobs.TaxTerm FROM vendorjobs WHERE vendorjobs.Industry = '$Ind' AND Date_Sub(Curdate(), interval '$Days' day) = PostStart But if the user decides to only use one of the elements, then I don't want the query to return nothing because of the And in the where clause so I have these 2 statements that set a default value (shown here as 0 in the event one of the two elements aren't selected: (Having no luck as the form still only works correctly if I've set both elements) $Ind = 0; if (isset($_POST['Ind'])) { $Ind = (get_magic_quotes_gpc()) ? $_POST['Ind'] : addslashes($_POST['Ind']); } $Days = 0; if (isset($_POST['Days'])) { $Days = (get_magic_quotes_gpc()) ? $_POST['Days'] : addslashes($_POST['Days']); Thank you , Stuart -- 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] Re: php mail() error
Hello, On 11/10/2004 10:36 AM, Garth Hapgood - Strickland wrote: Im using the php mail() function to try send an email to a user that has just registered. mail($HTTP_POST_VARS['emailaddress1'], 'Matchmakers Website Registration' , 'Welcome'); But when I get the following error back.: Warning: mail(): SMTP server response: 550 5.7.1 Unable to relay for [EMAIL PROTECTED] Can someone help me out, by telling me what it means or what Im doing wrong? (Thank you Jason for the introduction! :-) That means your SMTP server requires authentication to relay messages. The mail function does not support SMTP authentication. Alternatively, you may want to try this class that comes with a wrapper function named smtp_mail(). It works like the mail() function but lets you specify the authentication user name and password. http://www.phpclasses.org/mimemessage You also need these two: http://www.phpclasses.org/smtpclass http://www.phpclasses.org/sasl -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie: string to char array
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 10 November 2004 13:37, Horst Jäger wrote: (Please keep this on list -- others may be able to help better/faster than me!) mySplit('example') == array('e', 'x', 'a', 'm', 'p' 'l' 'e') ? Do you absolutely need it as an array? If indexing by character would suffice, just use PHP's {} syntax: $s = 'example'; echo $s{0};// e echo $s{1};// x // etc. I am thinking about complexity. How is a string implemented in PHP? A dequechar or a char* ? Pass -- this looks like a question for PHP's developers, not the denizens of php-general who are mostly just humble users. But I would expect a char*. How does $s{n} acces the n-th char? 1. Does it go to the beginning of the string and then jump from one char to the next, counting the instances and return when the n-th ionstance is reached? 2. Or does it jump to the n-th char directly? Given the nature of PHP, I'd be astonished if it did 1. But again, this looks more like a question for the PHP developers, not php-general. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, 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
[PHP] Re: Help: Database Search
Stuart Felenstein wrote: I am creating a database search form and results. Running into a problem though. I have two form elements, both that are fed by tables that have int values (1, 2 , etc) my sql statement is such: SELECT vendorjobs.PostStart, vendorjobs.JobTitle, vendorjobs.Industry, vendorjobs.VendorID, vendorjobs.LocationCity, vendorjobs.TaxTerm FROM vendorjobs WHERE vendorjobs.Industry = '$Ind' AND Date_Sub(Curdate(), interval '$Days' day) = PostStart But if the user decides to only use one of the elements, then I don't want the query to return nothing because of the And in the where clause so I have these 2 statements that set a default value (shown here as 0 in the event one of the two elements aren't selected: (Having no luck as the form still only works correctly if I've set both elements) $Ind = 0; if (isset($_POST['Ind'])) { $Ind = (get_magic_quotes_gpc()) ? $_POST['Ind'] : addslashes($_POST['Ind']); } $Days = 0; if (isset($_POST['Days'])) { $Days = (get_magic_quotes_gpc()) ? $_POST['Days'] : addslashes($_POST['Days']); $where = array(); if ( isset($_POST['Ind']) ) { $where[] = 'vendorjobs.Industry = ' . (int) $_POST['Ind']; } if ( isset($_POST['Days']) ) { $where[] = 'Date_Sub(Curdate(), interval ' . (int) $_POST['Days'] . ' day) = PostStart'; } $sql = ' SELECT ... FROM vendorjobs WHERE ' . implode( ' AND ', $where ); -- Sebastian Mendel www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com www.sf.net/projects/phpdatetimewww.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error logging problem
Greg Donald wrote: On Wed, 10 Nov 2004 10:49:29 -0500, Al [EMAIL PROTECTED] wrote: ini_set(error_log, /AutoSch/error.log); Looks like this might be a path relative to your domain or your vhost definition? I'd go with a full system path if that's the case. Hey Greg, that did it. It's obvious now. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array to $_GET variable
I am trying to cache a database recordset so users can sort, etc without hitting the database everytime. I'm using ADODB to access a MSSQL database. $s = SELECT id, part, description FROM parts\n; $r = $db-Execute($s); $parts = array(id=array(),part=array(),desc=array()) while(!$r-EOF){ array_push($parts['id'],$r-fields[0]); array_push($parts['part'],$r-fields[0]); array_push($parts['desc'],$r-fields[0]); $r-MoveNext(); } // print_r($parts) displays array data. Here's what I'm doing: $v = serialize($parts); echo a href=\{$_SERVER['PHP_SELF']}?getvar=$v\Link/a\n; If($_GET['getvar']){ $newvar = unserialize($_GET['getvar']); //This does nothing echo $newvar; print_r($newvar); } Am i missing something very simple? Should I make the array a $_SESSION variable, or how do others cache a recordset? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Jason wrote: Could you give me a good example of the tip you recommend or point me to a good tutorial on it? $GLOBALS holds all variables defined in main(), main() meaning outside any function or class //main() $my_var = 'test'; function myFunction() { echo $GLOBALS['my_var']; // is the same as: global $my_var echo $my_var; // 'global' just creates a local reference to the global variable // global $my_var; is the same as: $my_var = $GLOBALS['my_var']; echo $my_var; } -- Sebastian Mendel www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com www.sf.net/projects/phpdatetimewww.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multiple session_start()s / Is it a problem??
Is there a problem issuing multiple session_start()s for a given script? I can't find anything in the manual that says one way or the other. I have some scripts that call more than one functions include file and for convenience put a session_start() on each one. This gives me a Notice error. Of course I can simply use @session_start() to negate the Notice; but, I want to be certain this is good practice. Al. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error logging problem
My site is on a virtual host and I'd like to log errors to a file while I'm debugging. Can't get it to work. Here is the code at the top of my script: ini_set(display_errors, on); //also tried Off ini_set(error_log, /AutoSch/error.log); $ini_array= ini_get_all(); error_reporting(E_ALL ^ E_WARNING ); //On for debuging only print_r($ini_array); Printing $ini_array shows my ini_set() statements are working; but, the errors are not being appended to error.log. I put a error.log in the folder, assuming the error handler needed one to append to. I don't want to turn on error logging for the whole site; just the folder I'm working on. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Array to $_GET variable
Mike Smith wrote: I am trying to cache a database recordset so users can sort, etc without hitting the database everytime. I'm using ADODB to access a MSSQL database. $s = SELECT id, part, description FROM parts\n; $r = $db-Execute($s); $parts = array(id=array(),part=array(),desc=array()) while(!$r-EOF){ array_push($parts['id'],$r-fields[0]); array_push($parts['part'],$r-fields[0]); array_push($parts['desc'],$r-fields[0]); $r-MoveNext(); } // print_r($parts) displays array data. Here's what I'm doing: $v = serialize($parts); echo a href=\{$_SERVER['PHP_SELF']}?getvar=$v\Link/a\n; If($_GET['getvar']){ $newvar = unserialize($_GET['getvar']); //This does nothing echo $newvar; print_r($newvar); } Am i missing something very simple? Should I make the array a $_SESSION variable, or how do others cache a recordset? i would prefer $_SESSION! btw. - do you see the ...?getvar=... in the URL ? - what does var_dump( $_GET['getvar'] ); - do you tried urlencode(); -- Sebastian Mendel www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com www.sf.net/projects/phpdatetimewww.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help: Database Search
--- Jason Wong [EMAIL PROTECTED] wrote: Why not build your sql query according to whether or not whatever you want is selected or not. That way debugging is easier as you won't be looking at queries that contain redundant ... AND 0 Jason, How would I do that ? Care to share a short exmaple ? Thank you Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple session_start()s / Is it a problem??
Al wrote: Is there a problem issuing multiple session_start()s for a given script? I can't find anything in the manual that says one way or the other. Then you have not looked good enough ;-) I have some scripts that call more than one functions include file and for convenience put a session_start() on each one. This gives me a Notice error. You'll find this in the documentation of session_start(): Note: As of PHP 4.3.3, calling session_start() while the session has already been started will result in an error of level E_NOTICE. Also, the second session start will simply be ignored. So there is no problem with multiple calls to session_start(). You can safely ignore the notice. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML Parser doesn't work when moved....
Below is the code that work on a PHP 4.2.1 test server. For some reason it is not working and not throwing errors(set to E_ALL) on 4.3.7 server. Has anyone experienced this kind of error? Or can someone point me in the right direction? TVMIA! /* create a parser */ if(!($covadParser = xml_parser_create())){ echo Failed to create parserbr\n; exit(); } /* set handlers for parser */ xml_set_element_handler($covadParser, StartTag, EndTag); xml_set_character_data_handler($covadParser, DataHandler); /* let's parse! */ if($readXML = fopen(XMLDIR.testRecp.xml, r)){ while($lineXML = fread($readXML, 4096)){ //echo $lineXML . br\n; xml_parse($covadParser, $lineXML, feof($readXML)); } } else { echo COULD NOT READ XML FILE\n; } /* clear the parser */ xml_parser_free($covadParser); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array to $_GET variable
Mike Smith wrote: I am trying to cache a database recordset so users can sort, etc without hitting the database everytime. I'm using ADODB to access a MSSQL database. $s = SELECT id, part, description FROM parts\n; $r = $db-Execute($s); $parts = array(id=array(),part=array(),desc=array()) while(!$r-EOF){ array_push($parts['id'],$r-fields[0]); array_push($parts['part'],$r-fields[0]); array_push($parts['desc'],$r-fields[0]); $r-MoveNext(); } // print_r($parts) displays array data. Here's what I'm doing: $v = serialize($parts); echo a href=\{$_SERVER['PHP_SELF']}?getvar=$v\Link/a\n; If($_GET['getvar']){ $newvar = unserialize($_GET['getvar']); //This does nothing echo $newvar; print_r($newvar); } Am i missing something very simple? You did not tell what is the problem, so I only guess - urlencode? Or the recordset exceeds allowed size for query string? (But I've once seen 3 or 4 EULAs in one link on microsofts site :)) Should I make the array a $_SESSION variable, or how do others cache a recordset? I don't as it gives more trouble than help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie: string to char array
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 10 November 2004 16:19, raditha dissanayake wrote: Ford, Mike wrote: To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm are you in a position to impose any terms (not that i have visited your link) on an email that get's distributed to thousands of readers, get's archived on hundreds of sites and possibly ends up in the inbox of bots designed to harvest email addresses? No. But I'm also not in a position to prevent this ludicrosity from being prefixed to all outgoing mail from where I work. I would suppress it if I could, but I can't. Sorry. You'll just have to judge whether the general standard of my replies warrants putting up with the noise factor, but I would understand entirely if you filtered me to /dev/null. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, 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] Question on functions
Yeah the global stuff I understand and can use fine. What I would like more information about is the use of arguments to functions i.e. function( $user, $pass, $db ) { $db = @mysql_connect( $user, $pass, $db ); } I understand parts but googling for the proper use of functions in php hasn't gotten me anywhere... Sebastian Mendel wrote: Jason wrote: Could you give me a good example of the tip you recommend or point me to a good tutorial on it? $GLOBALS holds all variables defined in main(), main() meaning outside any function or class //main() $my_var = 'test'; function myFunction() { echo $GLOBALS['my_var']; // is the same as: global $my_var echo $my_var; // 'global' just creates a local reference to the global variable // global $my_var; is the same as: $my_var = $GLOBALS['my_var']; echo $my_var; } -- Jason Gerfen Student Computing Marriott Library 801.585.9810 [EMAIL PROTECTED] And remember... If the ladies don't find you handsome, they should at least find you handy... ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Callback function as parameter
Hi everybody, I want to wrote a function that receives another function as parameter that will be used as a Callback. Well, better a bit of code than thousand words: class TreeNode { ... function Traverse ( CallBack ) { $rtn = CallBack ($this); foreach ($this-Sons as $Son) { $Son-Traverse ( CallBack ); } return $rtn; } ... } And later I'll do something as: function CallBack ( $Node ) { echo $Node-Name; } $MyTreeNode-Traverse ( CallBack ); ... Hope you understand what I'm trying to do. Can it be done as is or am I on the wrong way? Thx. a million in advance, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] XML Parser doesn't work when moved....
[snip] /* let's parse! */ if($readXML = fopen(XMLDIR.testRecp.xml, r)){ while($lineXML = fread($readXML, 4096)){ //echo $lineXML . br\n; xml_parse($covadParser, $lineXML, feof($readXML)); } } else { echo COULD NOT READ XML FILE\n; } /* clear the parser */ xml_parser_free($covadParser); [/snip] Having added the following line echo XML Error . xml_error_string(xml_get_error_code($covadParser)) . br\n; just after the xml_parse PHP is reporting not well-formed (invalid token) so I will have to explore. Seems that one server is not as strict as the other. Is there a way to reduced strictness of xml validation? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
On Wed, 10 Nov 2004 10:10:37 -0700, Jason [EMAIL PROTECTED] wrote: Yeah the global stuff I understand and can use fine. What I would like more information about is the use of arguments to functions i.e. function( $user, $pass, $db ) { $db = @mysql_connect( $user, $pass, $db ); } I understand parts but googling for the proper use of functions in php hasn't gotten me anywhere... Looks like you understand already. Did you have some broken code you wanted help with? -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Greg Donald wrote: On Wed, 10 Nov 2004 10:10:37 -0700, Jason [EMAIL PROTECTED] wrote: Yeah the global stuff I understand and can use fine. What I would like more information about is the use of arguments to functions i.e. function( $user, $pass, $db ) { $db = @mysql_connect( $user, $pass, $db ); } I understand parts but googling for the proper use of functions in php hasn't gotten me anywhere... Looks like you understand already. Did you have some broken code you wanted help with? yeah.. I should have posted it first. Here it is: /* User Defined Variables */ $defined = array( 0 = localhost, 1 = user, 2 = password ); /* Database connection */ function db() { global $defined; if( connection_status() != 0 ) { $db = @mysql_pconnect( $defined[9], $defined[1], $defined[2] )or die( font face=\arial\bphpDHCPAdmin currently not active, is under repair or is not configured correctly./bbrbrError Number: . mysql_errno( $db ) . brError Message: . mysql_error( $db ) . brEmail Administrator: a href=\mailto:$defined[5]\;$defined[5]/a/font ); @mysql_select_db( $defined[3] )or die( font face=\arial\bCould not connect to database: $defined[3]/bbrError Me\ ssage: . @mysql_error( $db ) . br . Error Number: . @mysql_errno( $db ) . brEmail Administrator: a href=\mailt\ o:$defined[5]\$defined[5]/a/font ); } } /* Logging function */ function logs() { global $defined; call_user_func( db ); $pagecount = 1; $tble = logs; $sql = @mysql_query( SELECT * FROM $tble WHERE session = \$_SESSION[hash]\, $db )or die( font face=\arial\bError\ occured when searching logs for session id:/b $_SESSION[hash]brError Message: . @mysql_error( $db ) . br . Error\ Number: . @mysql_errno( $db ) . brEmail Administrator: a href=\mailto:$defined[5]\;$defined[5]/a/font ); while( $row = @mysql_fetch_array( $sql ) ) { $id = $row[session]; } if( @mysql_num_rows( $sql ) == 0 ) { $insert = @mysql_query( INSERT INTO $tble VALUES (\\,\$_SESSION[date]\,\$_SESSION[hour]\,\$_SESSION[ipaddy]\,\\ $_SESSION[host]\,\$_SESSION[ref]\,\$_SERVER[HTTP_USER_AGENT]\,\$_SERVER[PHP_SELF]\,\$pagecount\,\$_SESSION[msg]\\ ,\$_SESSION[hash]\), $db )or die( font face=\arial\bError occured creating logs for $_SESSION[hash]/bbrError M\ essage: . @mysql_error( $db ) . br . Error Number: . @mysql_errno( $db ) . brEmail Administrator: a href=\mail\ to:$defined[5]\$defined[5]/a/font ); } elseif( @mysql_num_rows( $sql ) != 0 ) { if( ( $_SESSION['hash'] == $id ) || ( empty( $pagecount ) ) ) { $pagecount++; $update = @mysql_query( UPDATE $tble SET date=\$_SESSION[date]\, time=\$_SESSION[hour]\, ip=\$_SESSION[ipaddy]\\ , host=\$_SESSION[host]\, referer=\$_SESSION[ref]\, agent=\$_SERVER[HTTP_USER_AGENT]\, page=CONCAT(page,\.:||:.$_SERV\ ER[PHP_SELF]\), pagecount=\$pagecount\, message=\$_SESSION[msg]\, session=\$_SESSION[hash]\ WHERE session=\$id\, $\ db )or die( font face=\arial\bError occured while updating logs for $_SESSION[hash]/bbrError Message: . @mysql_\ error( $db ) . br . Error Number: . @mysql_errno( $db ) . brEmail Administrator: a href=\mailto:$defined[5]\;$d\ efined[5]/a/font ); } else { call_user_func( exit_app ); } } else { call_user_func( exit_app ); } } the result is that trying to call a function from within a function seems to be giving me problems. I get no error message or code. Any help is appreciated -- Jason Gerfen [EMAIL PROTECTED] And remember... If the ladies don't find you handsome, they should at least find you handy... ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] displaying repetitive results
Given a database query thats returns results from a linking (or xref) table which includes repetition because of the joins: ++--+--+ | id | title| subject | ++--+--+ | 1 | Collected Poems of Keats | poetry | | 2 | Spy High | suspense | | 3 | Sci Fi Spies | suspense | | 3 | Sci Fi Spies | sci-fi | ++--+--+ What is the best way to go about displaying this for the user so that the record looks complete: ID: 3 title: Sci Fi Spies Subjects: suspense, scifi or something similar? Or is there some better way to query? It's also a problem in terms of limiting the query because if I limit the query to 10 records I might be chopping off some subjects for the last book? The query and tables are simple: select books.id, books.title, subjects.subject from books, subjects, books_subjects where books_subjects.bid = books.id and books_subjects.sid = subjects.id BOOKS 1. collected poems of keats 2. spy high 3. sci-fi spies SUBJECTS: 1. poetry 2. suspense 3. sci-fi 4. horror 5. mystery BOOKS_SUBJECTS bid sid 11 22 32 33 c -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Load testing for PHP Applications
Hi folks. I'm wondering if anyone out there can recommend a good tool for load testing a large php application? Ideally it would be something fairly intelligent, that would follow links, remember what links it has followed and where any problems occurred, etc. Can anyone provide any recommendations? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] should basic data validation go outside a function or inside?
hi. call me stupid but i can't decide which option is better (actually don't call me stupid because it will hurt my feelings and i might cry). and having said that, maybe neither option is better than the other? whatever the answer, i just want some outside input on this because for some reason my brain is getting caught up on it and it's bothering me. should basic data validation come before a function call or be performed within the function? example of validation outside the function: ?php if(is_numeric($this-id) !empty($this-id)) { $new_number = my_function($this-id); } else { $new_number = false; } ? example of validation inside the function: ?php function my_function($number) { if(is_numeric($number) !empty($number)) { // perform some calculations } else { return false; } } $new_number = my_function($this-id) ? thanks, chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Load testing for PHP Applications
On Wed, 10 Nov 2004 10:15:33 -0800, Pablo Gosse [EMAIL PROTECTED] wrote: Hi folks. I'm wondering if anyone out there can recommend a good tool for load testing a large php application? Ideally it would be something fairly intelligent, that would follow links, remember what links it has followed and where any problems occurred, etc. Can anyone provide any recommendations? If you use Apache, you can use the Apache benchmark tool `ab`. If you just want to slam a site with requests, you could use htdig to index it or maybe something like: while(true); do wget -m -np http://yahoo.com/; done -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copyright law, how to protect your investment, how to protect your work... Was - RE: [PHP-DB] Please point me in the right direction.......
I'm surprised I havn't seen this question come up before (might have just missed it) but it's an excellent question so forgive the crossposting as it's extremely relevant to coders and those purchasing services of coders. Anyone who's gotten married and hired a wedding photographer is probably familiar with the idea of You can't make your own reprints, the photos are owned by the photographer. What kind of BS is that eh? It was your wedding! You paid the guy, right? I read a really interesting article talking about this a while ago and found out that they key words you want to use (if you want to own what you pay for) are the words work for hire. Usually this would be put in the contract or even on the check you use to pay for the services.. Signing this check constitutes the payee's acknowledgement that the services performed and the final output/art/photos/etc is considered a Work for Hire or something like that. It's not good enough to say All copy rights transfer to the client apparently. How I understand it is this... Any artist (musician, coder, author, painter, etc) has an implicit copyright on whatever they make as soon as they make it. While in the process of making something, it's considered a Work in progress and has additional rights under certain laws (see the Steve Jackson case with the Secret Service about them seizing electronic copies of a game manual that was in progress as a suspected guide to hacking. The electronic copies weren't protected back then whereas a printed copy would have been.. But they may be protected from seizure in legal cases these days... Not sure). Anyway... So you write this code and you own it. Regardless of whether someone paid you to write it. Unless of course you have an intellectual property thing with the company you work for (like I do.. It says whatever I create for the company... On company time... Is theirs). So all those websites and PHP scripts that you set up for people... They're yours. Unless the client specifies that it's a work for hire in your contract or on the check you gotta sign to get your bucks. Now from the client's side of things.. Because we don't always write our own stuff.. It's important to know about this as well so you can protect your investment. I don't know that a coder can legally demand that you stop using their code, but it means that if you want to re-sell what you had developed, you need to clear it with the coder first. A lot of people don't know this stuff and it's hard to find out when someone's pirating code that technically belongs to you.. But it's good to know what rights you do have. Doing a quick search on Yahoo for work for hire and copyright, I found a TON of sites that seem to cover the subject. I don't have time to read them, but at a glance, some of these sounded like good things to check up on: http://www.weblawresources.com/Work-For-Hire-Clause.htm http://www.gigalaw.com/articles/2000/loc-2000-02.html http://www.copylaw.com/new_articles/wfh.html http://repositories.cdlib.org/boaltwp/55/ http://www.keytlaw.com/Copyrights/wfhire.htm http://www.copyright.gov/circs/circ1.html http://www.music-law.com/workforhire.html Hope this helps and maybe informs a few people. You can ask me questions if you want, but this is literally all I know about the subject. You're better off reading up on the sites above (and Googling for others) and talking to a copyright lawyer about the matter if you want more details. Good luck everyone! -TG -Original Message- From: Michael Cortes [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 2:12 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Please point me in the right direction... I have a question about contracts or agreements. I am considering hiring a local company to do some coding for us in LAMP to augment what we have done already. I have a problem with the standard we own the code and copyright clause in thier service agreement. Can someone point me to the correct mailing list as I don't wish to start an inapropriate thread. Thank you. -- Michael Cortes Fort LeBoeuf School District 34 East Ninth Street PO Box 810 Waterford PA 16441-0810 814.796.4795 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Callback function as parameter
* Francisco M. Marzoa Alonso [EMAIL PROTECTED]: I want to wrote a function that receives another function as parameter that will be used as a Callback. Well, better a bit of code than thousand words: class TreeNode { ... function Traverse ( CallBack ) { $rtn = CallBack ($this); foreach ($this-Sons as $Son) { $Son-Traverse ( CallBack ); } return $rtn; } ... } And later I'll do something as: function CallBack ( $Node ) { echo $Node-Name; } $MyTreeNode-Traverse ( CallBack ); ... Hope you understand what I'm trying to do. Can it be done as is or am I on the wrong way? Two ways to do it: 1) Pass a string that is the callback function's name; then call it a dynamic variable function: function Traverse($callback) { $rtn = $callback($this); ... } 2) Use a PHP callback pseudotype (http://php.net/pseudo-types): function Traverse($callback) { // Calls the callback with $this as its argument: $rtn = call_use_func($callback, $this); ... } Callbacks can be either a string containing a function name or an array with the first element either a class name or object reference and the second argument a method name (the first does a static method call, the second an object method call). -- Matthew Weier O'Phinney | mailto:[EMAIL PROTECTED] Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] LINUX: Problem with php installation
I installed latest version of PHP from the source on a AMD ATHELON64 system with REDHAT 9.0 installed with apache server 2. There were no error upon running configure or make or make install I have checked the instalation procedures many times now but I get a blank screen on the mozilla browser. Upon viewing the source it shows the source of a blank html page. The server works well with html pages. Only the problem is with any php page. I have made the mentioned additions to be done in the httpd.conf file namely LoadModule and AddType. The error log file is showing Segmentation fault. ___ Moving house? Beach bar in Thailand? New Wardrobe? Win 10k with Yahoo! Mail to make your dream a reality. Get Yahoo! Mail http://uk.mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] chmod difficulties...
Hi, I'm using the AIX or UNIX system... When I tried the ... --snip-- passthru('chmod -R a+rw ../WebHelp/* 21'); --snip-- I get an error message, Operation Is Not Permitted.. So, I tried other option... --snip-- chmod(../WebHelp/, 0755); --snip-- I get an error message, Warning: chmod(): Not owner in filepath on line 13.. Problem here is that Apache use hte account, nobody and is used as other when it come to file permission. (Not the file owner or group)... The rest of the website files are in a different user account and have different ownership:group... Does anyone encountered this situation and does anyone every have a workaround to it to your knowledge?? Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: chmod difficulties...
you can have apache SU to a user with enough permissions to do what you are trying :) (passthru('SU ...')) Scott Fletcher wrote: Hi, I'm using the AIX or UNIX system... When I tried the ... --snip-- passthru('chmod -R a+rw ../WebHelp/* 21'); --snip-- I get an error message, Operation Is Not Permitted.. So, I tried other option... --snip-- chmod(../WebHelp/, 0755); --snip-- I get an error message, Warning: chmod(): Not owner in filepath on line 13.. Problem here is that Apache use hte account, nobody and is used as other when it come to file permission. (Not the file owner or group)... The rest of the website files are in a different user account and have different ownership:group... Does anyone encountered this situation and does anyone every have a workaround to it to your knowledge?? Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: chmod difficulties...
I tried that before and it doesn't work... Here's the response.. --snip-- 3004-501 Cannot su to webacct : Authentication is denied. --snip-- Scott M. Sokolewicz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] you can have apache SU to a user with enough permissions to do what you are trying :) (passthru('SU ...')) Scott Fletcher wrote: Hi, I'm using the AIX or UNIX system... When I tried the ... --snip-- passthru('chmod -R a+rw ../WebHelp/* 21'); --snip-- I get an error message, Operation Is Not Permitted.. So, I tried other option... --snip-- chmod(../WebHelp/, 0755); --snip-- I get an error message, Warning: chmod(): Not owner in filepath on line 13.. Problem here is that Apache use hte account, nobody and is used as other when it come to file permission. (Not the file owner or group)... The rest of the website files are in a different user account and have different ownership:group... Does anyone encountered this situation and does anyone every have a workaround to it to your knowledge?? Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] XML Parser doesn't work when moved....
[snip] Having added the following line echo XML Error . xml_error_string(xml_get_error_code($covadParser)) . br\n; just after the xml_parse PHP is reporting not well-formed (invalid token) so I will have to explore. [/snip] Having beaten my head against the wall for severqal hours now, I am thouroughly stumped and have a major headache. I have turned over all of the rocks that I can and cannot even come up with a clean explanation of the error itself. Does anyone have anything that can help me clean this up? Unfortunately I have no control over the XML as it is a received document that I am trying to parse. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] displaying repetitive results
Don't know what version of MySQL you are using, but I upgraded to 4.1 so that I could use the GROUP_CONCAT function, which does what you are looking for. http://dev.mysql.com/doc/mysql/en/GROUP-BY-Functions.html Otherwise, your front-end will need to do the rolling up of the records. On Nov 10, 2004, at 1:04 PM, Chris Lott wrote: Given a database query thats returns results from a linking (or xref) table which includes repetition because of the joins: ++--+--+ | id | title| subject | ++--+--+ | 1 | Collected Poems of Keats | poetry | | 2 | Spy High | suspense | | 3 | Sci Fi Spies | suspense | | 3 | Sci Fi Spies | sci-fi | ++--+--+ What is the best way to go about displaying this for the user so that the record looks complete: ID: 3 title: Sci Fi Spies Subjects: suspense, scifi or something similar? Or is there some better way to query? It's also a problem in terms of limiting the query because if I limit the query to 10 records I might be chopping off some subjects for the last book? The query and tables are simple: select books.id, books.title, subjects.subject from books, subjects, books_subjects where books_subjects.bid = books.id and books_subjects.sid = subjects.id BOOKS 1. collected poems of keats 2. spy high 3. sci-fi spies SUBJECTS: 1. poetry 2. suspense 3. sci-fi 4. horror 5. mystery BOOKS_SUBJECTS bid sid 11 22 32 33 c -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] should basic data validation go outside a function or inside?
On Wed, 10 Nov 2004 11:00:12 -0800, Chris W. Parker [EMAIL PROTECTED] wrote: should basic data validation come before a function call or be performed within the function? advice type=record status=b0rken value=Benchmark them both and see which way is faster. then post back and tell us. :) / -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php mail() error
Garth Hapgood - Strickland wrote: But when I get the following error back.: Warning: mail(): SMTP server response: 550 5.7.1 Unable to relay for [EMAIL PROTECTED] Can someone help me out, by telling me what it means or what Im doing wrong? Your mail server is not set up to send mail from (or relay) for redpoint.co.za. Consult your mail server documentation for help (i.e. not a PHP issue). -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Programmatic Browser Rendering Engine?
Please Cc: me, as it's been quite some time since I posted 50 emails per day to this list... :-^ I'm interested in anybody's experience, good or bad, in what I am naively coining as a Programmatic Browser Rendering Engine: In an ideal world, it would be a PHP function definition not unlike this: bool imagesurfto(resource image, string url, [int width, int height]); This function surfs to the given URL, as if a browser window the dimensions (imagesx, imagesy) of image were opened to that URL, and places in image a representation of what the user would see if they surfed to that site. If width and height are provided, the surfing is done as if the browser window were the provided width and height, and the result is then scaled to fit into image. Example: ?php $image = imagecreatetruecolor(800, 600); imagesurfto($image, 'http://php.net'); header(Content-type: image/jpeg); imagejpeg($image); ? This displays what a user would see surfing to the PHP home page, if their browser window was open to 800x600. ?php $image = imagecreatetruecolor(400, 300); imagesurfto($image, 'http://php.net'); header(Content-type: image/jpeg); imagejpeg($image); ? This displays the same image as the first example, only scaled down to half-size. In my case, I have a GUI to admin a web-site by adding links, and I want to give the user some Interface Feedback that the URL they have typed as a destination for their link looks like what they expect. If this is all known technology and everybody is already doing it, please tell me what everybody else has decided is the correct term for this, as I've got No Clue. :-) I'm also very very very open to other ideas how to achieve my goal: The user should see an image of what the link goes to, so they will notice if it's not the right URL, as they edit/review their link choices. This could be useful in sites that allow administrators maintain a Links Page semi-automatically. It could be particularly useful these days now that domain squatters and speculators are taking over every expired domain and throwing a bunch of advertisement/pay-per-click links on them. Just checking that a link is valid is no longer Good Enough to know that you are linking to what you want to link to. But that's only one portion of the problem I want to address, so keeping an eye on domain expiration records would solve this case, but not the more general issue. And, of course, if you somehow magically allowed another optional argument of which browser to use... Wow! I could visually compare side-by-side the images of what my layout looks like on all the browsers? Sign me up! Okay, so this is probably NOT do-able. But the rest doesn't seem like it should be that tricky... Hm. Does a frame allow a scaling factor? Might actually make me want to use frames [shudder] if they do. PS If somebody familiar with, say, Mozilla, were to create a PHP function such as I described above, you'd have instant fame and glory. Hint, hint. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Programmatic Browser Rendering Engine?
[snip] This function surfs to the given URL, as if a browser window the dimensions (imagesx, imagesy) of image were opened to that URL, and places in image a representation of what the user would see if they surfed to that site. If width and height are provided, the surfing is done as if the browser window were the provided width and height, and the result is then scaled to fit into image. Example: ?php $image = imagecreatetruecolor(800, 600); imagesurfto($image, 'http://php.net'); header(Content-type: image/jpeg); imagejpeg($image); ? [/snip] Perhaps an iframe? The problem here is that you would have to be able to get an image of a remote site without having a 'printscreen' available. You could dynamically control an iframe, but the remote would not stretch or shrink to fit. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] displaying repetitive results
On Wed, 10 Nov 2004 09:04:27 -0900, Chris Lott [EMAIL PROTECTED] wrote: Given a database query thats returns results from a linking (or xref) table which includes repetition because of the joins: ++--+--+ | id | title| subject | ++--+--+ | 1 | Collected Poems of Keats | poetry | | 2 | Spy High | suspense | | 3 | Sci Fi Spies | suspense | | 3 | Sci Fi Spies | sci-fi | ++--+--+ What is the best way to go about displaying this for the user so that the record looks complete: ID: 3 title: Sci Fi Spies Subjects: suspense, scifi You might normalize the data a bit. I'd go with three tables: books, subjects, and a books_subjects_xref table. The subjects table would contain the subject_id and the subject. The books table would contain the book_id and book_title. The books_subjects_xref table will contain the book_id and subject_id, with a two-field unique constraint on book_id and subject_id. You would have an entry for each subject a book is in. As far as the sql, I'd suggest something but you didn't say what db you're using. Looks like MySQL output but I could be wrong. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] should basic data validation go outside a function or inside?
On Wed, 10 Nov 2004 11:00:12 -0800, Chris W. Parker [EMAIL PROTECTED] wrote: hi. call me stupid but i can't decide which option is better (actually don't call me stupid because it will hurt my feelings and i might cry). and having said that, maybe neither option is better than the other? whatever the answer, i just want some outside input on this because for some reason my brain is getting caught up on it and it's bothering me. should basic data validation come before a function call or be performed within the function? I would do the validation inside the function. This avoids repeating the validation everywhere the function is called. It also makes the function more self-contained. It expects a certain input and complains, or returns false, if it doesn't get it. Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LINUX: Problem with php installation
On Wed, 10 Nov 2004 20:34:46 + (GMT), abhilash kumar [EMAIL PROTECTED] wrote: The error log file is showing Segmentation fault. Did you happen to try display_startup_errors = On in your php.ini.. I'm not sure but it might provide a more informative error message. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Programmatic Browser Rendering Engine?
-- Original message -- From: Richard Lynch [EMAIL PROTECTED] Please Cc: me, as it's been quite some time since I posted 50 emails per day to this list... :-^ I'm interested in anybody's experience, good or bad, in what I am naively coining as a Programmatic Browser Rendering Engine: In an ideal world, it would be a PHP function definition not unlike this: bool imagesurfto(resource image, string url, [int width, int height]); This function surfs to the given URL, as if a browser window the dimensions (imagesx, imagesy) of image were opened to that URL, and places in image a representation of what the user would see if they surfed to that site. You might want to look at webthumb http://www.boutell.com/webthumb/ It is a linux command line utility that creates thumbnails of webpages. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: chmod difficulties...
Oh I see. I tried a different experiment through the telnet and I noticed I get this error if I use the wrong password. So, I get the impression that it is a timing issues or something because I may be sending out the password too early or too late... Sigh!! More work for me Boy!! Scott Scott Fletcher [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I tried that before and it doesn't work... Here's the response.. --snip-- 3004-501 Cannot su to webacct : Authentication is denied. --snip-- Scott M. Sokolewicz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] you can have apache SU to a user with enough permissions to do what you are trying :) (passthru('SU ...')) Scott Fletcher wrote: Hi, I'm using the AIX or UNIX system... When I tried the ... --snip-- passthru('chmod -R a+rw ../WebHelp/* 21'); --snip-- I get an error message, Operation Is Not Permitted.. So, I tried other option... --snip-- chmod(../WebHelp/, 0755); --snip-- I get an error message, Warning: chmod(): Not owner in filepath on line 13.. Problem here is that Apache use hte account, nobody and is used as other when it come to file permission. (Not the file owner or group)... The rest of the website files are in a different user account and have different ownership:group... Does anyone encountered this situation and does anyone every have a workaround to it to your knowledge?? Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] header variable ?
What variable header use? If I send something in header, what GLOBAL variable header use? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Programmatic Browser Rendering Engine?
You might want to look at webthumb http://www.boutell.com/webthumb/ It is a linux command line utility that creates thumbnails of webpages. or khtml2png: http://www.babysimon.co.uk/khtml2png/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header variable ?
Hi, Thursday, November 11, 2004, 8:51:49 AM, you wrote: JS What variable header use? If I send something in header, what GLOBAL JS variable header use? If you are talking about redirection You have to use the GET method then look in $_GET or $_REQUEST $url = 'http://somewhere.com/test.php?variable=hello'; header(Location: $url); exit; //test.php if(isset($_GET['variable'])) echo 'Variable = '.$_GET['variable'].'br'; -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header variable ?
Don't understand what you are asking. Respectfully, Ligaya Turmelle Jerry Swanson wrote: What variable header use? If I send something in header, what GLOBAL variable header use? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php mail() error
Hi, Problem is realted to your smtp server. Make sure it allowed outgoing mail without authenctication. You must also set a header in fourth parameter of mail function, it is good practice and can save you from some basic indentification problems. In windows you can set default send mail from in php.ini Try Mail([EMAIL PROTECTED],test subject,test body,from:[EMAIL PROTECTED]); If it fails contact your ISP. Additionally read http://www.chilkatsoft.com/faq/Smtp550.html Zareef ahmed -Original Message- From: Garth Hapgood - Strickland [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 6:06 PM To: [EMAIL PROTECTED] Subject: [PHP] php mail() error Im using the php mail() function to try send an email to a user that has just registered. mail($HTTP_POST_VARS['emailaddress1'], 'Matchmakers Website Registration' , 'Welcome'); But when I get the following error back.: Warning: mail(): SMTP server response: 550 5.7.1 Unable to relay for [EMAIL PROTECTED] Can someone help me out, by telling me what it means or what Im doing wrong? Thanx Garth -- Zareef Ahmed :: A PHP develoepr in Delhi ( India ) Homepage :: http://www.zasaifi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php mail() error
Hi, Well this time I will take the responsibility :) Here is the link about mail sending in PHP . http://www.phpclasses.org/browse/package/9.html Zareef ahmed -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 8:48 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] php mail() error On Wed, 10 Nov 2004 23:14:43 +, Jason Wong [EMAIL PROTECTED] wrote: Or you can wait for Manuel Lemos' reply :) Good one. :) -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- Zareef Ahmed :: A PHP develoepr in Delhi ( India ) Homepage :: http://www.zasaifi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Array to $_GET variable
Hi, Yes it is a good idea to store this value in $_SESSION array. $_GET value sometime (depend on php setting) add slashes to all values, Those slashes will create the problem at the time of unserialization. Doing urlencode and decode also can be help full but in my view $_SESSION are best way to manage this as sometime value may be too long to store in $_GET variable. Do You get any error on unserialization? Zareef ahmed -Original Message- From: Mike Smith [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 10:14 PM To: [EMAIL PROTECTED] Subject: [PHP] Array to $_GET variable I am trying to cache a database recordset so users can sort, etc without hitting the database everytime. I'm using ADODB to access a MSSQL database. $s = SELECT id, part, description FROM parts\n; $r = $db-Execute($s); $parts = array(id=array(),part=array(),desc=array()) while(!$r-EOF){ array_push($parts['id'],$r-fields[0]); array_push($parts['part'],$r-fields[0]); array_push($parts['desc'],$r-fields[0]); $r-MoveNext(); } // print_r($parts) displays array data. Here's what I'm doing: $v = serialize($parts); echo a href=\{$_SERVER['PHP_SELF']}?getvar=$v\Link/a\n; If($_GET['getvar']){ $newvar = unserialize($_GET['getvar']); //This does nothing echo $newvar; print_r($newvar); } Am i missing something very simple? Should I make the array a $_SESSION variable, or how do others cache a recordset? -- Zareef Ahmed :: A PHP develoepr in Delhi ( India ) Homepage :: http://www.zasaifi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Join PHPExperts
Hi all, We starts a great user forum for PHP users. We gurantee the urgent solution of your problem regarding PHP, MySQL and It's extensions. Visit our group and be a proud member of our group visit: http://groups.yahoo.com/group/phpexperts Thank you all --Evelin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Join PHPExperts
On Thursday 11 November 2004 05:03, Hasin Hayder wrote: We starts a great user forum for PHP users. We gurantee the urgent solution of your problem regarding PHP, MySQL and It's extensions. Visit our group and be a proud member of our group visit: http://groups.yahoo.com/group/phpexperts Great! An alternative place for people to send their off topic posts to. Hope that means there will be fewer for this list ;-) -- 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 -- /* sugar daddy, n.: A man who can afford to raise cain. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Error logging problem
-Original Message- From: Al [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 9:19 PM To: [EMAIL PROTECTED] Subject: [PHP] Error logging problem My site is on a virtual host and I'd like to log errors to a file while I'm debugging. Can't get it to work. Here is the code at the top of my script: ini_set(display_errors, on); //also tried Off ini_set(error_log, /AutoSch/error.log); This problem may be related to your path. Try to user $_SERVER['DOCUMENT_ROOT']./AutoSch/error.log AutoSch must be in your document root . Zareef ahmed $ini_array= ini_get_all(); error_reporting(E_ALL ^ E_WARNING ); //On for debuging only print_r($ini_array); Printing $ini_array shows my ini_set() statements are working; but, the errors are not being appended to error.log. I put a error.log in the folder, assuming the error handler needed one to append to. I don't want to turn on error logging for the whole site; just the folder I'm working on. Thanks -- -- Zareef Ahmed :: A PHP develoepr in Delhi ( India ) Homepage :: http://www.zasaifi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie: string to char array
On Wed, 10 Nov 2004 15:56:28 -, Ford, Mike [EMAIL PROTECTED] wrote: On 10 November 2004 13:37, Horst Jger wrote: (Please keep this on list -- others may be able to help better/faster than me!) I am thinking about complexity. How is a string implemented in PHP? A dequechar or a char* ? char * in a zval (and you really shouldn't use dequechar, given the existance of string) How does $s{n} acces the n-th char? 1. Does it go to the beginning of the string and then jump from one char to the next, counting the instances and return when the n-th ionstance is reached? 2. Or does it jump to the n-th char directly? I haven't benchmarked it, but I would assume strings derefing is signficantly faster than arrays, as arrays in php are actually hashtables, while $a{5} is just a straight deref. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ http://www.smempire.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Join PHPExperts
On Thu, 2004-11-11 at 11:03 +0600, Hasin Hayder wrote: Hi all, We starts a great user forum for PHP users. We gurantee the urgent solution of your problem regarding PHP, MySQL and It's extensions. Visit our group and be a proud member of our group visit: http://groups.yahoo.com/group/phpexperts Thank you all --Evelin brilliant. you should start an irc channel next. :-p -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / signature.asc Description: This is a digitally signed message part