Re: [PHP] Unable to upload multiple files
You don't even have a file form element, or an element named userfile so your FOR loop will never run... ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ Yes I do. I just forgot to put it here. input class='nappi' size='20' type='file' name='userfile[]' -antti -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Introduction
Hello Julie Have you checked what is passed in your post / get request??? A Simple way of doing this is using a script similar to this one ?PHP while(list($key, $value) = each($_POST)) // use $_GET for get request { echo 'br'.$key.'='.$value; // this prints to the browser } ? This will show you a simple list of all variables being passed to your script. I had a problem once with forms that for empty fields the variables were set to contain an empty string so a call to isset($var) still returns true. Not sure how this happend or why but it did... If you run the above script you can at least see if the form returns the variables that are set and what they contain. Before I forget don't run this script before your header() or else you will get an error stating that headers have allready been send. Hope it helps Stefan Langer P.S.: As stated before for security reasons it is better to rely on $_POST and $_GET global arrays and register_globals turned off.
Re: [PHP] Introduction
On Saturday 01 February 2003 17:39, [EMAIL PROTECTED] wrote: Hello Julie Have you checked what is passed in your post / get request??? A Simple way of doing this is using a script similar to this one ?PHP while(list($key, $value) = each($_POST)) // use $_GET for get request { echo 'br'.$key.'='.$value; // this prints to the browser } ? A easier way to achieve the above is simply: print_r($_POST); -- 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 -- /* Unix: Some say the learning curve is steep, but you only have to climb it once. -- Karl Lehenbauer */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange_session-problem_with_php-file_in_img_src
fredagen den 31 januari 2003 kl 18.08 skrev Chris Shiflett: Instead of trying to tell us what the problem is, just explain what trouble you are having. We can then tell *you* what the problem is. Could the problem have something to do with the fact that the function that returns the value of the session is called from within another function, and that it's defined outside this function? Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question on listbox.
Hello friends. I have a listbox which I populate from a query with the database. It is working fine. But additinally, I want the first item to be Select category. Can someone please help me how to modify by below written code to do the above? My code : Quote : ?php //connecting to the database $link = mysql_connect(localhost,MyDomain,MyPass); if ($link){ Print ; } else { Print No connection to the database; } if (!mysql_select_db(MyDomain_com)){ Print Couldn't connect database; } else { Print .br\n; } $sql=SELECT DISTINCT CategoryName From Categories ORDER BY CategoryName; $result=mysql_query($sql); While($Category=mysql_fetch_array($result)) { Print(OPTION VALUE=\$Category[0]\$Category[0]\n); } ? Unquote Thanks very much Denis
[PHP] Strange problem
Hello friends. I have the following script. Both the errors show green font when actually the first error should give a red font. Am I doing something wrong here? Quote: if($CategoryName==){ Print font color=\#FF\You have not entered the category name. Please go back and enter the category name./font; Exit; } if($password==){ Print font color=\#00FF00\You have not entered the password. Please go back and enter the password./font; Exit; } Unquote Thanks Denis
[PHP] Function Stack
Is there any way to access the Function Stack from php? I would really like it for debugging, ala java style or C debugging style, where I could get a list of function like From afunction line 83 From bfunction line 179 From cfunction line 345 Error here.. If I could somehow access the function stack as an array that woul dbe superb!! Does anyone know if this kind of functionality exists? Is there a function stack in Zend that I could create a module to access? Josh. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question on listbox.
On Saturday 01 February 2003 19:08, Denis L. Menezes wrote: Hello friends. I have a listbox which I populate from a query with the database. It is working fine. But additinally, I want the first item to be Select category. Can someone please help me how to modify by below written code to do the above? My code : Quote : ?php //connecting to the database $link = mysql_connect(localhost,MyDomain,MyPass); if ($link){ Print ; } else { Print No connection to the database; } if (!mysql_select_db(MyDomain_com)){ Print Couldn't connect database; } else { Print .br\n; } echo option ...; $sql=SELECT DISTINCT CategoryName From Categories ORDER BY CategoryName; $result=mysql_query($sql); While($Category=mysql_fetch_array($result)) { Print(OPTION VALUE=\$Category[0]\$Category[0]\n); } ? Unquote -- 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 -- /* If you are good, you will be assigned all the work. If you are real good, you will get out of it. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 1 Feb 2003 12:21:46 -0000 Issue 1857
php-general Digest 1 Feb 2003 12:21:46 - Issue 1857 Topics (messages 133843 through 133865): Re: Delete files via PHP 133843 by: Jason Wong Re: another problem with 4.3.0 : imagecreatefromjpeg undefined 133844 by: Jason Wong 4.3 Install on Solaris 133845 by: Weston Houghton 133857 by: Philip Olson I would like to display a list of the same products only if productPublic = staff or members. 133846 by: Philip J. Newman 133847 by: Tom Rogers Screen Size detect?? 133848 by: Dade Register 133850 by: Maxim Maletsky 133851 by: Maxim Maletsky 133856 by: Sean Malloy Bug? 133849 by: Todd Barr 133854 by: Jason Sheets 133855 by: Sean Malloy fputs / fwrites ? 133852 by: Lee Herron 133853 by: Maxim Maletsky Re: Unable to upload multiple files 133858 by: Antti Re: Introduction 133859 by: SLanger.spirit21.de 133860 by: Jason Wong Re: Strange_session-problem_with_php-file_in_img_src 133861 by: Victor Spång Arthursson question on listbox. 133862 by: Denis L. Menezes 133865 by: Jason Wong Strange problem 133863 by: Denis L. Menezes Function Stack 133864 by: Joshua Moore-Oliva Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- On Saturday 01 February 2003 03:23, Miguel Brás wrote: Hey, thx for your speech In a matter of fact, I have 2 books about PHP and all they say about the unlink function (I use it in my upload system) is that it is suposed to force the delete of the temporary file that it is created during the upload process. So, i was never thinking that the unlink fuction was able to do it. Could you tell us which books they are? They seem to be giving very poor advice. Uploaded files are _automatically_ deleted when the script ends. There is no need to force deletion of those temporary files. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* The best laid plans of mice and men are held up in the legal department. */ ---End Message--- ---BeginMessage--- On Friday 31 January 2003 23:22, Robert Mena wrote: Hello again, another problem with 4.3.0. I have gd support but after the upgrade my scripts started complaing : Fatal error: Call to undefined function: imagecreatefromjpeg() My ./configure (the same used for ages). './configure' '--with-apxs' '--with-ttf' '--with-xml' '--with-gd' '--with-ftp' '--enable-session' '--enable-trans-sid' '--with-zlib' '--enable-inline-optimization' '--with-mcrypt' '--enable-sigchild' '--with-config-file-path=/etc' '--with-freetype' You probably need to add --with-jpeg-dir as well (and make sure you really do have libjpeg installed). -- 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 -- /* To love is good, love being difficult. */ ---End Message--- ---BeginMessage--- All, I seem to be getting a silly error on Solaris when trying to do a PHP 4.3 make. I get an error that looks to me like the liner arguments are just too long. to be honest, I'm a bit stupified as to why this is happening or how to fix it. FWIW, I have compiled 4.23 just fine on that box. Thanks, Wes p.s. here's the last bit of the error: /bin/sh libtool --silent --mode=link gcc -export-dynamic -g -O2 -avoid-version -module -L/usr/ucblib -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1 -L/export/home/oracle/OraHome/lib -R /usr/ucblib -R /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1 -R /export/home/oracle/OraHome/lib ext/ctype/ctype.lo ext/ftp/php_ftp.lo ext/ftp/ftp.lo ext/mysql/php_mysql.lo ext/mysql/libmysql/libmysql.lo ext/mysql/libmysql/errmsg.lo ext/mysql/libmysql/net.lo ext/mysql/libmysql/violite.lo ext/mysql/libmysql/password.lo ext/mysql/libmysql/my_init.lo ext/mysql/libmysql/my_lib.lo ext/mysql/libmysql/my_static.lo ext/mysql/libmysql/my_malloc.lo ext/mysql/libmysql/my_realloc.lo ext/mysql/libmysql/my_create.lo ext/mysql/libmysql/my_delete.lo ext/mysql/libmysql/my_tempnam.lo ext/mysql/libmysql/my_open.lo ext/mysql/libmysql/mf_casecnv.lo ext/mysql/libmysql/my_read.lo ext/mysql/libmysql/my_write.lo ext/mysql/libmysql/errors.lo
Re: [PHP] Function Stack
- Original Message - From: Joshua Moore-Oliva [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 7:08 AM Subject: [PHP] Function Stack Is there any way to access the Function Stack from php? Not built in, but you could manually add statement to do it yourself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question on listbox.
- Original Message - From: Denis L. Menezes [EMAIL PROTECTED] To: PHP general list [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 6:08 AM Subject: [PHP] question on listbox. Hello friends. I have a listbox which I populate from a query with the database. It is working fine. But additinally, I want the first item to be Select category. Can someone please help me how to modify by below written code to do the above? something like this would do it: $valueToSelect = 'foo'; { Print(OPTION VALUE=\{$Category[0]}\ $selected = ($Category[0] == $valueToSelect) ? ' selected' : ''; Print($selected); Print({$Category[0]}\n); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange problem
On Saturday 01 February 2003 20:08, Denis L. Menezes wrote: Hello friends. I have the following script. Both the errors show green font when actually the first error should give a red font. Am I doing something wrong here? Quote: if($CategoryName==){ Print font color=\#FF\You have not entered the category name. Please go back and enter the category name./font; Exit; } if($password==){ Print font color=\#00FF00\You have not entered the password. Please go back and enter the password./font; Exit; } Unquote Have a look the HTML output resulting from the above code. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* The herd instinct among economists makes sheep look like independent thinkers. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Processing - Multiple inputs of the same name
This worked perfectly. Thank you. As for the FAQ, I looked, but I guess not in the right place! Mike Tracy Finifter Rotton [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Change the name of your checkboxes in your HTML to something like: name=DeleteIDs[] This will make it an array, and you can access all the elements like $_POST['DeleteIDs'][0] etc. (This should really be in a FAQ somewhere...) -- tracy On 1/31/03 11:17 AM, Mike Potter [EMAIL PROTECTED] wrote: Is it possible to pass an group of input boxes of the same name, then get the values of all the checked boxes or filled out textboxes? How do I get ALL the IDs passed. Right now it only passes the last ID. Do I really have to give them all unique names? For example... html head /head body form action=testform.php method=post input type=checkbox value=0 name=DeleteIDs/input Jon Smithbr input type=checkbox value=1 name=DeleteIDs/input David Callowbr input type=checkbox value=2 name=DeleteIDs/input Peter Parkerbr . . . input type=submit value=Delete Users /form /body /html This list of DeleteIDs will be build dynamically. I want the user to be able to check the boxes they want to delete and pull the IDs on the posted page. How do I get ALL the IDs passed. Right now it only passes the last ID. Thanks, Mike -- Tracy F. Rotton [EMAIL PROTECTED] http://www.taupecat.com/ ... I like the 49ers because they're pure of heart, Seattle because they've got something to prove, and the Raiders because they always cheat. -- Lisa Simpson, Lisa the Greek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange problem
- Original Message - From: Denis L. Menezes [EMAIL PROTECTED] To: PHP general list [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 7:08 AM Subject: [PHP] Strange problem I have the following script. Both the errors show green font when actually the first error should give a red font. Am I doing something wrong here? Have you looked at the html? That green shows up with the color setting is screwed up. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP3 Web Architecture Framework
Hi, I browsed the web for many different web architecture and frameworks. I found many Interesting but all wants latest version of PHP at least PHP 4.0.6. I dont want to upgrade the PHP Version(4.0.5) that i have because many clients are using it and i dont want to mess it up. Its a Pain in PHP that to support any extension we need to recompile with appropriate extensions unlike Java where all you need to do is put the appropriate Jar files in the /Lib directory and it automatically gets SET in the classpath and works great but I do ADORE PHP for its ease and efficiency and ofcourse along with Apache it rocks. So please dont suggest me to upgrade my PHP or something other. Few of the techniques i was pretty impressed is 1) Smarty - which ofcourse says that it needs PHP 4.0.6 or higher for its latest release 2) Tadpole PHPTags - which ofcourse didnt work on PHP4.0.5 3) Pear which ofcourse needed recompilation with Pear support 4) PHPMVC but it also requires latest version of PHP What i m planning to do is follow PHP3 method of Coding. The version of PHP that i have is 4.0.5. Can somebody suggest Struts like framework for PHP3 type of coding. Hope i do make sense if not please comment. I will explain more. Have a great day. Karthikeyan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP3 Web Architecture Framework
On Saturday 01 February 2003 20:23, karthikeyan.balasubramanian wrote: I browsed the web for many different web architecture and frameworks. I found many Interesting but all wants latest version of PHP at least PHP 4.0.6. I dont want to upgrade the PHP Version(4.0.5) that i have because [snip] What i m planning to do is follow PHP3 method of Coding. The version of PHP that i have is 4.0.5. Can somebody suggest Struts like framework for PHP3 type of coding. Have a look at phplib. -- 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 -- /* There will be big changes for you but you will be happy. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question on listbox.
Thanks Jason. Looks like I am too dumb. I still cannot do it. can u please help me further? Thanks Denis - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 8:21 PM Subject: Re: [PHP] question on listbox. On Saturday 01 February 2003 19:08, Denis L. Menezes wrote: Hello friends. I have a listbox which I populate from a query with the database. It is working fine. But additinally, I want the first item to be Select category. Can someone please help me how to modify by below written code to do the above? My code : Quote : ?php //connecting to the database $link = mysql_connect(localhost,MyDomain,MyPass); if ($link){ Print ; } else { Print No connection to the database; } if (!mysql_select_db(MyDomain_com)){ Print Couldn't connect database; } else { Print .br\n; } echo option ...; $sql=SELECT DISTINCT CategoryName From Categories ORDER BY CategoryName; $result=mysql_query($sql); While($Category=mysql_fetch_array($result)) { Print(OPTION VALUE=\$Category[0]\$Category[0]\n); } ? Unquote -- 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 -- /* If you are good, you will be assigned all the work. If you are real good, you will get out of it. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange_session-problem_with_php-file_in_img_src
Problem solved. The error came because I was calling the function inside another function, outside the latter it worked good. So I simply passed the variable with the second function - works great! Thanks anyway for all your time trying to help me! /V -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question on listbox.
On Saturday 01 February 2003 20:40, Denis L. Menezes wrote: Please don't top-post. Looks like I am too dumb. I still cannot do it. can u please help me further? I could write out the complete code for you -- but then I'll have to charge you for it :-) OTOH I can walk you through the process (in doing so it will, hopefully, help you solve your own problems) -- not that there is much of a process as it is frankly, really basic HTML. I have a listbox which I populate from a query with the database. It is working fine. But additinally, I want the first item to be Select category. Can someone please help me how to modify by below written code to do the above? Can I assume that you are at least familiar with basic HTML? If not, then you really ought get up to speed on HTML before playing with PHP. OK, you want to display a select box. A properly written select box would look something like: select name=category option value=28Basket/option option value=21Bathroom/option option value=08Bird feeder/option /select You want to add an extra option to it, AND you want the extra item to be displayed first, so it would now look like: select name=category option value=%ANY CATEGORY/option option value=28Basket/option option value=21Bathroom/option option value=08Bird feeder/option /select So, look at your code and determine how/where you would insert that extra item. I've already indicated previously _where_ the extra code should go, and also hinted at _how_. It is a simple matter for you to fill in the blanks (or ... to be precise). Also, do note that your code at present does not output well formed HTML. You may want to fix that. My code : Quote : ?php //connecting to the database $link = mysql_connect(localhost,MyDomain,MyPass); if ($link){ Print ; } else { Print No connection to the database; } if (!mysql_select_db(MyDomain_com)){ Print Couldn't connect database; } else { Print .br\n; } echo option ...; $sql=SELECT DISTINCT CategoryName From Categories ORDER BY CategoryName; $result=mysql_query($sql); While($Category=mysql_fetch_array($result)) { Print(OPTION VALUE=\$Category[0]\$Category[0]\n); } ? Unquote -- 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 -- /* I hope you will find the courage to keep on living despite the existence of this feature. - Richard Stallman */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Time Delay?
Hi, Does anyone know if there is a way for me to produce a function in PHP to pause the processing of the script for 3 seconds for example without eating up the CPU bandwidth. I could do with quite accurate control. Is there a better way that doing it like this: ?php function pause_script($int){ $start_time = time(); while(time() = ($start_time+$int)){ // No functions take place inside the loop! } } echo The current time is . time() . \n; pause_script(10); echo The current time is . time() . \n; ? The output is: The current time is 1044105730 The current time is 1044105741 There is obviously an 11 second difference is the time that the two seperate lines were printed. Thing is, when I run this script the CPU usage goes to 100% Anyone got any ideas? Thanx Josh
[PHP] pause_script($int)??
Hi, Does anyone know if there is a way for me to produce a function in PHP to pause the processing of the script for 3 seconds for example without eating up the CPU bandwidth. I could do with quite accurate control. Is there a better way that doing it like this: ?php function pause_script($int){ $start_time = time(); while(time() = ($start_time+$int)){ // No functions take place inside the loop! } } echo The current time is . time() . \n; pause_script(10); echo The current time is . time() . \n; ? The output is: The current time is 1044105730 The current time is 1044105741 There is obviously an 11 second difference is the time that the two seperate lines were printed. Thing is, when I run this script the CPU usage goes to 100% Anyone got any ideas? Thanx Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Time Delay?
On Saturday 01 February 2003 21:27, OjMyStEr wrote: Hi, Does anyone know if there is a way for me to produce a function in PHP to pause the processing of the script for 3 seconds for example without eating up the CPU bandwidth. I could do with quite accurate control. Is there a better way that doing it like this: [snip] Try sleep(). -- 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 -- /* We wish you a Hare Krishna We wish you a Hare Krishna We wish you a Hare Krishna And a Sun Myung Moon! -- Maxwell Smart */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] question on listbox.
Might this be better? print select name=category_selection\n; print option value=0Select Category/option\n //Query $sql=SELECT DISTINCT CategoryName From Categories ORDER BY CategoryName; $result=mysql_query($sql); if ($result) { While($Category=mysql_fetch_array($result)) { PrintOPTION VALUE=\$Category['auto']\$Category['name']/option\n; } mysql_free_result($result[$a]); print /select\n; } Leonard. www.phpna.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pause_script($int)??
what about sleep() ? OjMyStEr wrote: Hi, Does anyone know if there is a way for me to produce a function in PHP to pause the processing of the script for 3 seconds for example without eating up the CPU bandwidth. I could do with quite accurate control. Is there a better way that doing it like this: ?php function pause_script($int){ $start_time = time(); while(time() = ($start_time+$int)){ // No functions take place inside the loop! } } echo The current time is . time() . \n; pause_script(10); echo The current time is . time() . \n; ? The output is: The current time is 1044105730 The current time is 1044105741 There is obviously an 11 second difference is the time that the two seperate lines were printed. Thing is, when I run this script the CPU usage goes to 100% Anyone got any ideas? Thanx Josh -- IPv6 + TCPA + wrecked Palladium server = NO COFFE! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function Stack
On Sat, 1 Feb 2003 07:08:05 -0500, you wrote: Is there any way to access the Function Stack from php? Starting with PHP 4.3.0 you can use debug_backtrace(), which returns an array of caller stack information. You might want to build a wrapper around it which formats the information the way you want. I use it in my custom error handler and it's a lifesaver! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading attachmentsl
hi well actually I know what is the mechanism of sending mime messages with atttachments works, the problem is that I don't know how to to read attachment. I tried to use Pear decode functions but it only gives me info that there are attachments in the message which is obviosly not enough. so I'm putting my question once again: how to read attachment from the mime message and how to save it on client hard drive??? thanks for any help brtek Uzytkownik Chris Hayes [EMAIL PROTECTED] wrote At 11:11 31-1-2003, you wrote: hi all I'm writing a mail client and I got problem with attachments. I have no idea how to read and save attachments. Mayby someone already did something like that a can help me with some advice or giving me link to some resourses. Maybe it helps to see how an attachment is send, then you can try to reverse the process to read in attachments. assume that $filedata holds the data you want to attach the encoding can done in many ways, so read the headers carefully //prepare mail body $filedata = chunk_split(base64_encode($filedata)); $type = application/octet-stream; $encoding = base64; mt_srand((double)microtime()*100); $boundary = '--b'.md5(uniqid(mt_rand())) . getmypid();//so the boundary line can be quite diverse $mailbody = From: PHP backup script by Arakrys\n .MIME-Version: 1.0\n .Content-Type: multipart/mixed; .boundary=\$boundary\\n\n .This is a MIME encoded message. \n\n .--$boundary\n .Content-Type: text/plain; //if ($this-charset != ) $mailbody .= ; charset=$this-charset; $mailbody .=\n .Content-Transfer-Encoding: 8bit\n\n .$message . \n\n\n--$boundary; $data = Content-Type: $type.; name = \$filename\ .\n .Content-Transfer-Encoding: $encoding .\n\n$filedata\n; $mailbody .= \n$data\n--$boundary .--\n; //send mail mail($mailto, $MYSQL_DB.' database backup '.date(d M Y H:i), ' ', $mailbody) or die ('Could not send email!'); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using custom button form element instead of standard submit?
Durwood Gafford [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... To make the issues more clear (assuming everyone's not totally burned out thinking about this one), I will submit links to working, example code in a followup post. I'm swamped with a proposal i'm working on for my 'day' job, however -- so stay tuned. you can go to http://www.berzerker.net/durwood/phptest and see 3 samples of a simple directory traversal php script ... this is, in essence, the problem i'm facing. Read the readme.txt file there for more info .. but basically there are 2 solutions that work but aren't optimal ... and one that don't work. and i couldn't figure out how to do the image version -- it's explained in teh readme file. so if anyone can come up with a better solution, let me know! thx, durwood -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading attachmentsl
On Saturday 01 February 2003 23:21, Bartosz Matosiuk wrote: well actually I know what is the mechanism of sending mime messages with atttachments works, the problem is that I don't know how to to read attachment. I tried to use Pear decode functions but it only gives me info that there are attachments in the message which is obviosly not enough. so I'm putting my question once again: how to read attachment from the mime message and how to save it on client hard drive??? 1) You can see whether the functions in IMAP, POP3 and NNTP functions are of any use. 2) You can dissect a working PHP webmail application to see how others have done it: www.squirrelmail.org etc 3) You can make use of commandline programs to do the dirty work: reformime etc. Personally, I've had good results using reformime. -- 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 -- /* Little prigs and three-quarter madmen may have the conceit that the laws of nature are constantly broken for their sakes. -- Friedrich Nietzsche */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calling other php scripts from inside a php script.
Hi, I am new to PHP and I am writing a script that evaluates input from a form then calls other PHP scripts depending on the input it receives. The login form is very simple and asks the user to enter a username and a password. It is used by two types of users, students and supervisors. In the PHP script I check to see what the value is for the username. If it equals student I need to call a script that displays the information for the correct student. Else a different script is called that allows the supervisor to select a particular student. I am not sure how I can call these scripts to run from inside my current script. I know that PHP includes can be used to display code from another script in the current page but I need to call the scripts to run and the content displayed in a separate new page. Any advice much appreciated! Thank you Jason Howlett _ Stay in touch with MSN Messenger http://messenger.msn.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading attachmentsl
hi thanks for advices I haven't ever heard about reformime, what is it? brtek - Original Message - From: Jason Wong [EMAIL PROTECTED] Newsgroups: php.general To: [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 4:40 PM Subject: Re: [PHP] reading attachmentsl On Saturday 01 February 2003 23:21, Bartosz Matosiuk wrote: well actually I know what is the mechanism of sending mime messages with atttachments works, the problem is that I don't know how to to read attachment. I tried to use Pear decode functions but it only gives me info that there are attachments in the message which is obviosly not enough. so I'm putting my question once again: how to read attachment from the mime message and how to save it on client hard drive??? 1) You can see whether the functions in IMAP, POP3 and NNTP functions are of any use. 2) You can dissect a working PHP webmail application to see how others have done it: www.squirrelmail.org etc 3) You can make use of commandline programs to do the dirty work: reformime etc. Personally, I've had good results using reformime. -- 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 -- /* Little prigs and three-quarter madmen may have the conceit that the laws of nature are constantly broken for their sakes. -- Friedrich Nietzsche */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sort List But NOT After Date Has Passed.
Hi guys, I have a script which looks in a directory, pulls out all the files and sorts them by reverse date order. The file name schema is mmdd-the rest of the file. Script: --- $interestingFile = array(); $interestingFiles = array(); $dir = opendir('/home/danceportal/www/uk/ian') or die( Could not open dir ); while($dirEntry = readdir($dir)){ if(ereg(summary, $dirEntry) || ereg(full, $dirEntry)){ array_push($interestingFile, $dirEntry); $date = explode(-, $dirEntry); $finished = explode(., $date[0]); array_push( $interestingFiles, $finished[0]); } } sort($interestingFile, SORT_REGULAR); $count = count($interestingFile); $k = $count; $j = 0; while($j $count) { $k --; include $interestingFile[$k]; echo p; $j ++; } --- What I want to do is get today's date, then check each line against the date and only show the rest of the files with the next one to expire and so on. Could someone help me with this please? Cheers, Ian. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL/PHP Associative Array Insert
A co-worker is teaching me to move to the next level in php. I have started using associative arrays for my scripts, but I am having a problem using them to do an insert into MySQL. Can someone give me an example of how to do an insert to the database using these arrays? My array is this...$item['itemID'] Thanks Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Calling other php scripts from inside a php script.
Hi Jason, ?php switch ($_REQUEST['username']) { case 'student' : include('student_script.php'); break; case 'supervisor' : include('supervisor_script.php'); break; } ? Better is to use $_POST if your form's method=post or $_GET if your form's method=get As long as the user type is available to the new page through a form variable, or request string like newpage.php?username=student, you can access it using $_REQUEST/$_GET/$_POST Take care, Greg -- phpDocumentor http://www.phpdoc.org Jason Howlett [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, I am new to PHP and I am writing a script that evaluates input from a form then calls other PHP scripts depending on the input it receives. The login form is very simple and asks the user to enter a username and a password. It is used by two types of users, students and supervisors. In the PHP script I check to see what the value is for the username. If it equals student I need to call a script that displays the information for the correct student. Else a different script is called that allows the supervisor to select a particular student. I am not sure how I can call these scripts to run from inside my current script. I know that PHP includes can be used to display code from another script in the current page but I need to call the scripts to run and the content displayed in a separate new page. Any advice much appreciated! Thank you Jason Howlett _ Stay in touch with MSN Messenger http://messenger.msn.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Screen Size detect??
On a slight side note to this, how can you pass javascript variables to PHP via POST? Newbie Powell On Saturday, February 1, 2003, at 12:21 PM, [EMAIL PROTECTED] wrote: From: Sean Malloy [EMAIL PROTECTED] Date: Sat Feb 1, 2003 6:48:26 AM Europe/London To: Dade Register [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP] Screen Size detect?? Create index.htm; script language=JavaScript var width = screen.width; var height = screen.height; window.location = 'index.php?width=' + width + 'height=' + height; /script and in index.php $width = $_GET['width']; $height = $_GET['height']; etc etc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] select unique values from an array
I am attempting to populate form elements from a text file which has been read and split into arrays. Some of the items are repeated many times: grade level, for example. Is there a way of just selecting unique values so that each value is displayed only once in the check boxes or radio buttons? Many thanks Peter Gumbrell [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] connecting to oracle 9i as user SYS
Hi, The topic says it all: How do you connect to oracle 9i as the user SYS? In the user comments about OCILogon() someone mentions that this is a little problematic with 9i, but doesn't really spell out the solution. Regards, Lukas Smith [EMAIL PROTECTED] ___ BackendMedia www.backendmedia.com [EMAIL PROTECTED] Linn Zwoch Smith GbR Reuchlinstr. 10-11 Raum 4.1.6 D-10553 Berlin (Tiergarten) Tel +49 30 83 22 50 00 Fax +49 30 83 22 50 07 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] select unique values from an array
In a message dated 2/1/2003 9:39:55 AM Pacific Standard Time, [EMAIL PROTECTED] writes: I am attempting to populate form elements from a text file which has been read and split into arrays. Some of the items are repeated many times: grade level, for example. Is there a way of just selecting unique values so that each value is displayed only once in the check boxes or radio buttons? Take a look at the function array_unique() which removes duplicate values from an array. Perhaps this function can help you. Janet -- Janet Valade Author, PHP MySQL for Dummies -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File upload problem
I tried but I can't upload any file. My form and code are as following: FORM METHOD=post TABLE TR TDFile:/TDTD INPUT TYPE=file SIZE=50 NAME=userfile/TD /TR TR TDnbsp;/TDTDINPUT TYPE=submit NAME=Submit VALUE=OKINPUT TYPE=submit NAME=Abort VALUE=Abort/TD /TR /TABLE /FORM SCRIPT LANGUAGE=php if (isset($_POST[Submit])){ echo name: .$_FILES[userfile][name].BR; echo size: .$_FILES[userfile][size].BR; echo tmpname: .$_FILES[userfile][tmpname].BR; echo error: .$_FILES[userfile][error].BR; } Now, whenever I try to upload a file, I get such output: Notice: Undefined index: userfile in c:\_www\bpm\admintools\downloads.php So I've no idea what's up. file_uploads: On upload_tpm_dir points to existing directory upload_max_filesize: 2M max_post_size: 8M Please help how to make it working. It's PHP 4.3 with Apache/1.3.24 on WinXP Pro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delete files via PHP
Hi, that's a negative They say that after uploading the file, the temp file on the tmp directory (usual) is deleted, anyway in order to confirm the deletion we should use unlink() function. Reading from one of the books, they say that the temp files are not deleted if a misconfiguration is found on php.ini or if the directory permissions aren't set as they should be. Miguel Jason Wong [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Saturday 01 February 2003 03:23, Miguel Brás wrote: Hey, thx for your speech In a matter of fact, I have 2 books about PHP and all they say about the unlink function (I use it in my upload system) is that it is suposed to force the delete of the temporary file that it is created during the upload process. So, i was never thinking that the unlink fuction was able to do it. Could you tell us which books they are? They seem to be giving very poor advice. Uploaded files are _automatically_ deleted when the script ends. There is no need to force deletion of those temporary files. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* The best laid plans of mice and men are held up in the legal department. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Long Email - Array Problems Causing My Baldness
Hello Everyone, I've been working on a small pet project of mine. It involves link management for my site. I want to be able to tell the program how many links to display from each of my link files. The program is then to go to that individual link file, randomly pick out how ever many links I've told it to get and then display a description of each link. The description is to be hyperlinked to the actual URL of that link. I have a directory that contains 5 text files. Those 5 files each contain 10 links. Each line in a file has two elements. The first being a url, the second being a description. The two elements are delimited by a comma. Here is what they would look like: http://www.File1.com/Link1,File 1 Link 1 http://www.File1.com/Link2,File 1 Link 2 http://www.File1.com/Link3,File 1 Link 3 My php code is actually two programs. The first program asks for my input. Basically it's a list of the file names with a text box next to each. In that text box I can choose how many links to display from each file. So let's say I choose to display 2 links from the first file, 0 links form the second file, 3 links from the third file, 0 links from the 4th file and 5 links from the fifth file. The program then writes the following to a simple text file: 2 0 3 0 5 The second program does all of the fun stuff. The first step being to open that text file and read the values: //open result file and read admin count into array $filepointer = fopen ($filename, r); $array_admin_count = file ($filename); fclose ($filepointer); The next step then opens the directory which contains the 5 files of links and reads each file name: //open directory and read file names $open = opendir ($dir); while ($files = readdir ($open)) { if ($files != . $files != ..) { $filesnames = $dir.$files; $array_of_files[] = $filesnames; } } closedir ($open); The final part is pretty beefy. This is where my problem is. This part is to open the individual link files, generate the proper amount of random links and then display the description which is hyperlinked to the url. It works if you only choose to display either 0 links from a file or 1 link from a file. If you choose anything over 1 random link, it displays the proper information, but it's mashed together. Here is the code for the final section of part two: //open files and grab random links for ($counter = 0; $counter count($array_admin_count); $counter++) { $array_admin_count[$counter] = rtrim($array_admin_count[$counter]); if ($array_admin_count[$counter] 0) { //Initialize: $res_string = ''; $res = array(); //expose url's in file $fileopen = fopen ($array_of_files[$counter], r); $array_of_links = file ($array_of_files[$counter]); fclose ($fileopen); //choose $number random lines from file $keys = array_rand($array_of_links,$array_admin_count[$counter]); //store random lines into $res array if(is_array($keys)) { foreach($keys as $key) { $res[] = $array_of_links[$key]; } }else{ $res[] = $array_of_links[$keys]; } //if randomize is on, randomize result array if($randomize_results==1) { shuffle($res); } //convert result array to string $res_string = implode(,$res); $getlink = explode(,, $res_string); print (a href='$getlink[0]'$getlink[1]/abr); Here's what I can figure out: Choosing 0 random links works for obvious reasons. Choosing to display 1 random link works because the array $res will look like this: http://www.File1.com/Link1,File 1 Link 1 The program then creates $res_string. Then the program explodes $res_string based on the comma delimiter into the array $getlink. Then the program displays the two elements of $getlink in the proper manner. If you choose to display more then 1 random link the program gets buggy. Let's say you choose to display 2 random links. When the program gets down to the $res array, the value of $res is: http://www.File1.com/Link1,File 1 Link 1 http://www.File1.com/Link2,File 1 Link 2 Once this happens, the next few lines of code $res_string (by implode) and the $getlink (by explode) creates havoc. I've been up all night trying to figure out a solution. I can't seem to arrive at one. Might any of you have any idea what I can do to resolve this array issue? Sorry this email is so long and my description is probably confusing. Thanks in advance, Roger PS if you wish to see the problem first hand, go here, and choose 1 link from each file. Then go back to it and choose more then 1 and see what happens: http://www.g-i-w-s.com/php/test31.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL/PHP Associative Array Insert
Yes Chris, When you add the item to the database, make sure to leave out the single quotes inside the brackets of the associative array. For example: Instead Of: $item['itemID'] Do This: $item[itemID] Example Query: $query = SELECT * FROM items WHERE '$item[itemID]'; Hope that helps. -Original Message- From: CDitty [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 01, 2003 10:26 AM To: [EMAIL PROTECTED] Subject: [PHP] MySQL/PHP Associative Array Insert A co-worker is teaching me to move to the next level in php. I have started using associative arrays for my scripts, but I am having a problem using them to do an insert into MySQL. Can someone give me an example of how to do an insert to the database using these arrays? My array is this...$item['itemID'] Thanks Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL/PHP Associative Array Insert
Oops, I forgot the double quotes at the end of the example query from the last email. This is how it should be: Example Query: $query = SELECT * FROM items WHERE '$item[itemID]'; -Original Message- From: @ Nilaab [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 01, 2003 1:00 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] MySQL/PHP Associative Array Insert Yes Chris, When you add the item to the database, make sure to leave out the single quotes inside the brackets of the associative array. For example: Instead Of: $item['itemID'] Do This: $item[itemID] Example Query: $query = SELECT * FROM items WHERE '$item[itemID]'; Hope that helps. -Original Message- From: CDitty [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 01, 2003 10:26 AM To: [EMAIL PROTECTED] Subject: [PHP] MySQL/PHP Associative Array Insert A co-worker is teaching me to move to the next level in php. I have started using associative arrays for my scripts, but I am having a problem using them to do an insert into MySQL. Can someone give me an example of how to do an insert to the database using these arrays? My array is this...$item['itemID'] Thanks Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File upload problem
On Saturday, February 1, 2003, at 10:58 AM, Tomator wrote: I tried but I can't upload any file. My form and code are as following: Try looking at: http://www.php.net/manual/en/features.file-upload.php There is a working example there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing Variables
Hi, Is there a way to pass a variable to a PHP script without using a form? I want to put several links on my main page that when clicked on goes to a PHP script - depending on what link was selected, will determine what part of the PHP script gets executed. TIA, Beauford -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Variables
On Sat, 1 Feb 2003, Beauford.2002 wrote: Hi, Is there a way to pass a variable to a PHP script without using a form? I want to put several links on my main page that when clicked on goes to a PHP script - depending on what link was selected, will determine what part of the PHP script gets executed. Yes, use GET: a href=foo.php?fruit=appleeat an apple/a See also if() and switch() http://www.php.net/else http://www.php.net/switch http://www.php.net/variables.external print $_GET['fruit']; Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MySQL/PHP Associative Array Insert
On Sat, 01 Feb 2003 10:26:10 -0600 [EMAIL PROTECTED] (Cditty) wrote: A co-worker is teaching me to move to the next level in php. I have started using associative arrays for my scripts, but I am having a problem using them to do an insert into MySQL. Can someone give me an example of how to do an insert to the database using these arrays? My array is this...$item['itemID'] try something like that: other-code ... i.e. connecting and so on mysql_query(INSERT INTO items SET itemcolumn='.$item['itemID'].'); or just mysql_query(INSERT INTO items (itemcolumn) VALUES('.$item['itemID'].')); Regards, -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] selecting items from an array
I have a text file which is read into an array $data using fgets(). The data is then split into further arrays by tab delimiter. I would like to find a way of extracting and printing items from $data using a form. The form fields (e.g. grade, subject) are populated from the arrays. When the user selects a subject and grade, then clicks the button, I would like to select and print only the data, in this case from the array $expect, where the grade is $grade_selected and the subject is $subject_selected. I would appreciate help with how to select and print the relevant data. Many thanks, Peter Gumbrell [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help needed building query string based on which form fields that are filled.
Hi, I've got a html form where not all fields need to be filled by the users. How can I build a MySQL query based on which fields the user have filled? My guess is that I can do something like this: if(!empty($f_name)) { some_commands_to_add_$f_name_to_querystring } if(!empty($l_name)) { some_commands_to_add_$f_name_to_querystring } some_commands_to_build_querystring_based_on_if's $result = mysql_query($query) But what commands/functions should I use to build the query? -- anders thoresson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] any change to see php source?
Dear Sirs, I am studying on php. And the book say, when the server see php extension it is running php file and giving results to the visiting browser. But as I see related directories are normal directory, doesn' t like cgi-bin directories. Is there any change to see php file source such as file open function or something else? I am not going to somebody else file. Just I want to be sure how secure the php? Any experience? Best Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling other php scripts from inside a php script.
it isnt that hard to do.. if you can get student and supervisor to successfully log into the web pages (even if you dont have anything to display) then all you really need to do is this: suppose that you had $user for username in the form and $password in the form for password... do this: /*after all of the sql login/query is done and checking user names do this:*/ if($user==student){ include(scriptname.php); }elseif($user==supervisor){ include(scriptname.php); }else{ printan error message here; } /*end*/ dont know if this would help i would need to see your actual login page and the script that drives the login sequence before i could really tell what to do for it..it all depends on how you have it set up..and are you getting usernames from a sql table or is it hard coded into the login script?? let me know and mail me private off list at [EMAIL PROTECTED] if you want help... laters - Original Message - From: Jason Howlett [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 10:45 AM Subject: [PHP] Calling other php scripts from inside a php script. Hi, I am new to PHP and I am writing a script that evaluates input from a form then calls other PHP scripts depending on the input it receives. The login form is very simple and asks the user to enter a username and a password. It is used by two types of users, students and supervisors. In the PHP script I check to see what the value is for the username. If it equals student I need to call a script that displays the information for the correct student. Else a different script is called that allows the supervisor to select a particular student. I am not sure how I can call these scripts to run from inside my current script. I know that PHP includes can be used to display code from another script in the current page but I need to call the scripts to run and the content displayed in a separate new page. Any advice much appreciated! Thank you Jason Howlett _ Stay in touch with MSN Messenger http://messenger.msn.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] any change to see php source?
I am studying on php. And the book say, when the server see php extension it is running php file and giving results to the visiting browser. But as I see related directories are normal directory, doesn' t like cgi-bin directories. Is there any change to see php file source such as file open function or something else? I am not going to somebody else file. Just I want to be sure how secure the php? It's all in CVS, read the source: http://cvs.php.net/ http://www.php.net/anoncvs.php You may also search the source in lxr: http://lxr.php.net/ Also, the following may be helpful to you: http://www.zend.com/phpfunc/ Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using input tags with php
hi.. this is what i want to do but dont realy know how to do it... i want to set up a form that will load values from a table and make them the value of the edit box... then when people press an update button then all of the stuff that changes from the record already in the table gets changed... anybody know how to make it where you can get the values out of a table and make them the default value of a input field...? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need to set default parameter || How to do in PHP?
Hey all. In cold fusion I was able to define a default value with the cfparam name = test default = myValue tag When I passed the variable test via a form or query string, it would over ride the parameter value. How can I do this in PHP? I looked in PHP manual for param, default, etc., but could find no equivalent. Any ideas? --Noah -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Installation Problem
I'm trying to install PHP for my first time on a W2000 Server with IIS 5.0, I followed all instructions twice. I added on App Mappings the extension for PHP, etc. etc but always that I try to reach my PHP file I get only a blank page. FAQs say there's some problem with the Web Server and that I have to check, I did but I can find any wrong, then I'm stuck at the beggining. Anyone can help me? Thanks Fernando Cruz Canada - Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now
Re: [PHP] Need to set default parameter || How to do in PHP?
On Sat, 1 Feb 2003, CF High wrote: Hey all. In cold fusion I was able to define a default value with the cfparam name = test default = myValue tag When I passed the variable test via a form or query string, it would over ride the parameter value. How can I do this in PHP? I looked in PHP manual for param, default, etc., but could find no equivalent. Any ideas? if (!isset($_REQUEST['rvar']) || inappropriate($_REQUEST['rvar'])) { $rvar = 'default'; } else { $rvar = $_REQUEST['rvar']; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need to set default parameter || How to do in PHP?
to set default vale for $id you may use something like : $id = !empty($_GET[id])?$_GET[id]:null; Cf High wrote: Hey all. In cold fusion I was able to define a default value with the cfparam name = test default = myValue tag When I passed the variable test via a form or query string, it would over ride the parameter value. How can I do this in PHP? I looked in PHP manual for param, default, etc., but could find no equivalent. Any ideas? --Noah -- -- --- Peio Popov - [EMAIL PROTECTED] icq# 117130734 http://www.cilaw.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Possible PHP/MySQL Bug?
The following code is supposed to migrate data from an old database to a new one, but produces the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\...\convertdb.php on line 17 The code: ?php /* connect to database */ if(!($srcDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('temp', $srcDB)) { echo 'Unable to connect to source database'; exit; } if(!($desDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('cgu', $desDB)) { echo 'Unable to connect to destination database'; exit; } /* table 'user' */ mysql_query(TRUNCATE TABLE user); $result = mysql_query(SELECT name, username, password, email, aim, phone, FROM_UNIXTIME(active) FROM user LIMIT 10, $srcDB); while(list($name, $username, $password, $email, $aim, $phone, $active) = mysql_fetch_array($result)) { $fname = substr($name, 0, strrpos($name, ' ')); $lname = substr($name, strrpos($name, ' ')); $password = mysql_result(mysql_query(SELECT DECODE(password, '$username') AS pwd FROM user WHERE username = '$username', $srcDB), 0, 'pwd'); $signup = mysql_query(SELECT MIN(date) AS signup FROM entry WHERE seller = '$username' OR buyer = '$username', $srcDB); if(mysql_num_rows($signup) == 0) $signup = $active; else $signup = mysql_result($signup, 0, 'signup'); $sql = INSERT INTO user (fname, lname, username, password, email, aim, phone, signup, lastActivity) VALUES ('$fname', '$lname', '$username', '$password', '$email', '$aim', '$phone', '$signup', '$active'); echo 'pcode'.str_replace(array((', ', ',, ')), array(('b, 'b', /b',, '/b)), $sql).'/code/p'; mysql_query($sql, $desDB); } ? Any idea? Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using input tags with php
In a message dated 2/1/2003 12:52:24 PM Pacific Standard Time, [EMAIL PROTECTED] writes: i want to set up a form that will load values from a table and make them the value of the edit box... then when people press an update button then all of the stuff that changes from the record already in the table gets changed... anybody know how to make it where you can get the values out of a table and make them the default value of a input field...? Basically, get your field values from the database and put them in variables. Then use the variables in your form. For instance, echo input type='text' name='first_name' value='$first_name'; Then, in the script that processes the form, update the database record with the values that were passed from the form. Janet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] any change to see php source?
At 21:36 1-2-2003, you wrote: I am studying on php. And the book say, when the server see php extension it is running php file and giving results to the visiting browser. But as I see related directories are normal directory, doesn' t like cgi-bin directories. Is there any change to see php file source such as file open function or something else? I am not going to somebody else file. Just I want to be sure how secure the php? It's all in CVS, read the source: I think he does not mean the PHP program source, but his scripts' source. Normally people cannot see the script source, as long as you use .php as file extension. In some PHP/server setups people can see the source when they type filename.phps, see the installation instruction file in the php package for details. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need an explanation as to what this line does...
$stuffArray[$i][value] = strtr($stuffArray[$i][value], array_flip(get_html_translation_table(HTML_ENTITIES))); To be bluntly honest, I don't understand hardly any of it, and the PHP Manual isn't helping this time.. maybe I'm weekend-stupid or something.. *sigh* Phil
[PHP] Re: Possible PHP/MySQL Bug?
On Sat, 1 Feb 2003 13:28:00 -0800 [EMAIL PROTECTED] (Tim Lan) wrote: The following code is supposed to migrate data from an old database to a new one, but produces the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\...\convertdb.php on line 17 The code: [...] Any idea? Yeah, read out mysql_error() after sending the query and before doing fetch... to see what mysql thinks is wrong. Regards, -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Possible PHP/MySQL Bug?
and by the way, the query on line 16 (the problematic one) works fine when run directly in MySQL. Tim Tim Lan [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The following code is supposed to migrate data from an old database to a new one, but produces the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\...\convertdb.php on line 17 The code: ?php /* connect to database */ if(!($srcDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('temp', $srcDB)) { echo 'Unable to connect to source database'; exit; } if(!($desDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('cgu', $desDB)) { echo 'Unable to connect to destination database'; exit; } /* table 'user' */ mysql_query(TRUNCATE TABLE user); $result = mysql_query(SELECT name, username, password, email, aim, phone, FROM_UNIXTIME(active) FROM user LIMIT 10, $srcDB); while(list($name, $username, $password, $email, $aim, $phone, $active) = mysql_fetch_array($result)) { $fname = substr($name, 0, strrpos($name, ' ')); $lname = substr($name, strrpos($name, ' ')); $password = mysql_result(mysql_query(SELECT DECODE(password, '$username') AS pwd FROM user WHERE username = '$username', $srcDB), 0, 'pwd'); $signup = mysql_query(SELECT MIN(date) AS signup FROM entry WHERE seller = '$username' OR buyer = '$username', $srcDB); if(mysql_num_rows($signup) == 0) $signup = $active; else $signup = mysql_result($signup, 0, 'signup'); $sql = INSERT INTO user (fname, lname, username, password, email, aim, phone, signup, lastActivity) VALUES ('$fname', '$lname', '$username', '$password', '$email', '$aim', '$phone', '$signup', '$active'); echo 'pcode'.str_replace(array((', ', ',, ')), array(('b, 'b', /b',, '/b)), $sql).'/code/p'; mysql_query($sql, $desDB); } ? Any idea? Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Loading CSV data into MySQL
Sorry for the OT question: I'm loading a .csv file into MySQL, done it a million times but for some reason it is scrambling the row order. All the fields are making it in correctly but the order of the rows seems to end up totally random. I've done this a million times and never saw this.. Any thoughts... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Possible PHP/MySQL Bug?
On Sat, 1 Feb 2003 13:28:00 -0800 [EMAIL PROTECTED] (Tim Lan) wrote: The following code is supposed to migrate data from an old database to a new one, but produces the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\...\convertdb.php on line 17 The code: ?php /* connect to database */ if(!($srcDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('temp', $srcDB)) { echo 'Unable to connect to source database'; exit; } if(!($desDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('cgu', $desDB)) { echo 'Unable to connect to destination database'; exit; } ah yes and another thing. you can't work on two databases with the same connection parameters (host, username,password) to have different connection-ids. PHP only keeps one connection and not two with the same parameters. They are the same connection for php which is expected behaviour there (although I don't like it too). Regards, -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need to set default parameter || How to do in PHP?
Nice Phil. A little more typing than the CF version, but the more I delve into PHP, the more I realize its power and flexibility. Thanks for the speedy reply... --Noah - Original Message - From: Philip Olson [EMAIL PROTECTED] To: CF High [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 1:05 PM Subject: Re: [PHP] Need to set default parameter || How to do in PHP? On Sat, 1 Feb 2003, CF High wrote: Hey all. In cold fusion I was able to define a default value with the cfparam name = test default = myValue tag When I passed the variable test via a form or query string, it would over ride the parameter value. How can I do this in PHP? I looked in PHP manual for param, default, etc., but could find no equivalent. Any ideas? if (!isset($_REQUEST['rvar']) || inappropriate($_REQUEST['rvar'])) { $rvar = 'default'; } else { $rvar = $_REQUEST['rvar']; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Possible PHP/MySQL Bug?
Thomas, I changed it so that the two connections use different username/password combination, and everything went smoothly. Thank you very much for your rapid response. Tim Thomas Seifert [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Sat, 1 Feb 2003 13:28:00 -0800 [EMAIL PROTECTED] (Tim Lan) wrote: The following code is supposed to migrate data from an old database to a new one, but produces the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\...\convertdb.php on line 17 The code: ?php /* connect to database */ if(!($srcDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('temp', $srcDB)) { echo 'Unable to connect to source database'; exit; } if(!($desDB = mysql_pconnect('localhost', 'root')) || !mysql_select_db('cgu', $desDB)) { echo 'Unable to connect to destination database'; exit; } ah yes and another thing. you can't work on two databases with the same connection parameters (host, username,password) to have different connection-ids. PHP only keeps one connection and not two with the same parameters. They are the same connection for php which is expected behaviour there (although I don't like it too). Regards, -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Loading CSV data into MySQL
On 01 Feb 2003 16:47:23 -0500 [EMAIL PROTECTED] (Brian V Bonini) wrote: Sorry for the OT question: I'm loading a .csv file into MySQL, done it a million times but for some reason it is scrambling the row order. All the fields are making it in correctly but the order of the rows seems to end up totally random. I've done this a million times and never saw this.. Any thoughts... where do you take a row-order from? and HOW are you uploading it into mysql? if you don't use a order by-clause in a select you won't have a really ordered result (only by accident). Regards, -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using input tags with php
i tried getting the values into vars using fetch_array/fetch_object and fetch_row and tried to put them in variables but for some odd reason it really doesnt work because when i try to use the vars in the value section instead of printing in the edit box the content of the variable i usually end up with ?, , ?php, or }? instead... any reason this shows up? and when i do: echo input type=text name=$name value='$new_var'; then on the web page i end up with some thing like this instead of the edit box: ;; }? any reason for that? how would i get the content into vars from the table? guess thats the main problem right now - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 4:28 PM Subject: Re: [PHP] using input tags with php In a message dated 2/1/2003 12:52:24 PM Pacific Standard Time, [EMAIL PROTECTED] writes: i want to set up a form that will load values from a table and make them the value of the edit box... then when people press an update button then all of the stuff that changes from the record already in the table gets changed... anybody know how to make it where you can get the values out of a table and make them the default value of a input field...? Basically, get your field values from the database and put them in variables. Then use the variables in your form. For instance, echo input type='text' name='first_name' value='$first_name'; Then, in the script that processes the form, update the database record with the values that were passed from the form. Janet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP.ini help on Linux
I am having trouble doing things with PHP such as use the exec, system, etc. functions. I can't seem to find the correct php.ini to turn safe_mode off. The one file I did find has safe_mode turned off. When I view phpinfo() it shows the global column with safe_mode off, but for the local column, it is on. Is there a local php.ini file for each site? Where would it be? I need to call a script to run in the background and I want to be able to use exec() to call it. Is there an alternative way to do this without bothering with the safe_mode value? i'd prefer to leave safe_mode on; but at the same rate, I am the only one with access to the server as it is my dedicated server. I am not familiar enough with Linux just yet to know how to give permissions to my sites to use things such as cron which I desperately need to figure out. I know how to add a crontab for a user, etc. But when the cron file runs, I just get a permission denied. I have tried it for both root and the site user. The only thing that does work is me getting an email stating permission denied. So I know my crontab file is correct. As far as permissions, I'm in a cloud. I have no idea what to do to make it work and maintain a secure system. Anyone know where some great (free) docs that will show me how to fish around in Linux? I don't need to be hand fed. Just some direction. Thanks! -- Nicole -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need an explanation as to what this line does...
$stuffArray[$i][value] = strtr($stuffArray[$i][value], array_flip(get_html_translation_table(HTML_ENTITIES))); To be bluntly honest, I don't understand hardly any of it, and the PHP Manual isn't helping this time.. maybe I'm weekend-stupid or something.. It converts HTML entities back to their original characters. Where htmlentities() and htmlspecialchars() will take characters like , , and and turn them into lt;, gt;, and amp, the code you have will take those entities and turn them back into , , and . It's all explained on the get_html_translation_table() manual page, if you care to read the manual. http://www.php.net/manual/en/function.get-html-translation-table.php ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Loading CSV data into MySQL
I'm loading a .csv file into MySQL, done it a million times but for some reason it is scrambling the row order. All the fields are making it in correctly but the order of the rows seems to end up totally random. I've done this a million times and never saw this.. So? Why does it matter to you what order the rows are in the database, as long as the right data is there? The order is irrelevant. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using input tags with php
In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time, [EMAIL PROTECTED] writes: i tried getting the values into vars using fetch_array/fetch_object and fetch_row and tried to put them in variables but for some odd reason it really doesnt work because when i try to use the vars in the value section instead of printing in the edit box the content of the variable i usually end up with ?, , ?php, or }? instead... any reason this shows up? and when i do: echo input type=text name=$name value='$new_var'; then on the web page i end up with some thing like this instead of the edit box: ;; }? any reason for that? It sounds like $name and/or $new_var may be empty. Did you echo the variables before using them in your form to check whether the values from the database are actually in the variables? Janet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using input tags with php
if i do this: /*all the mysql login stuff here*/ $query=mysql_query(select * from members); while($new=mysql_fetch_array($query)){ echo $new['company']; /*so on through the field list*/ } on output all i get is the title with a submit button..otherwise blank.. same thing with fetch_object()...and i have 1 row in the members table..im sort of confused now that it doesnt work for a wierd reason any better ideas on how to get the stuff out of the table and into vars? maybe im doing it wrong - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 5:33 PM Subject: Re: [PHP] using input tags with php In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time, [EMAIL PROTECTED] writes: i tried getting the values into vars using fetch_array/fetch_object and fetch_row and tried to put them in variables but for some odd reason it really doesnt work because when i try to use the vars in the value section instead of printing in the edit box the content of the variable i usually end up with ?, , ?php, or }? instead... any reason this shows up? and when i do: echo input type=text name=$name value='$new_var'; then on the web page i end up with some thing like this instead of the edit box: ;; }? any reason for that? It sounds like $name and/or $new_var may be empty. Did you echo the variables before using them in your form to check whether the values from the database are actually in the variables? Janet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redeclare formatdate
Hi, I have this message coming when calling the page main.php Fatal error: Cannot redeclare formatdate() in /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3 the code related to this message is: ? // format MySQL DATETIME value into a more readable string function formatDate($val) { $arr = explode(/, $val); return date(d/m/y, mktime(0,0,0, $arr[1], $arr[2], $arr[0])); } ? I use this code is some other pages and it works well, but here the code is used in page not_main.php whose I included it on main.php using require() function Anyone have a tip for it? Thx Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redeclare formatdate
I have this message coming when calling the page main.php Fatal error: Cannot redeclare formatdate() in /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3 the code related to this message is: ? // format MySQL DATETIME value into a more readable string function formatDate($val) { $arr = explode(/, $val); return date(d/m/y, mktime(0,0,0, $arr[1], $arr[2], $arr[0])); } ? I use this code is some other pages and it works well, but here the code is used in page not_main.php whose I included it on main.php using require() function Your function is being declared twice, which means that this file is probably being included or required twice. Look through your code... ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Loading CSV data into MySQL
On Sat, 2003-02-01 at 16:47, Thomas Seifert wrote: I'm loading a .csv file into MySQL, done it a million times but for some reason it is scrambling the row order. All the fields are making it in correctly but the order of the rows seems to end up totally random. I've done this a million times and never saw this.. Any thoughts... where do you take a row-order from? and HOW are you uploading it into mysql? if you don't use a order by-clause in a select you won't have a really ordered result (only by accident). LOAD DATA INFILE 'file.cvs' INTO TABLE table1 FIELDS TERMINATED BY ';'; the contnts of file .csv look like: 1;2002-02-01;New Dominion Pictures;Prosecutors - The Gosch Murder Case;Beau Parcells;Dave Stevenson (victim's husband), Lead;yes;yes;yes 2;2002-02-01;Coastal;Prospecting;Zoe Whitaker;Corporate Representative;yes;yes; 3;2002-02-01;Metro Video;Right Spirit Campaign (Binge Drinking PSA), - Richmond, VA;Tom Downs;Jim (Sailor)/Principal;yes;yes; 4;2002-02-01;Metro Video;Right Spirit Campaign (Binge Drinking PSA), - Richmond, VA;Amie Hill;Spokesperson;;; 5;2002-02-01;Metro Video;Unit of Action (U.S. Army);Tim Smith;Col. Mike Daniels (Principal);;yes; 6;2002-02-01;Metro Video;Colonial Williamsburg;Molly Larkin;Mother/Wife;;yes; 7;2002-02-01;Commercial;Barton Ford;Dave Hobbs;Car Salesman;yes;yes; 8;2002-02-01;Commercial;Barton Ford;Jackie Jackson;Customer's Wife;;; 9;2002-02-01;Regent Films;First Lunch;Molly Larkin;Principal;yes;yes; 10;2002-02-01;Skillet Productions (televisio;Welcome Home;Molly Larkin;Principal;yes;yes; etc You'd think they would load into the db just like that right? But they do not. They just end up in some random order. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Loading CSV data into MySQL
On Sat, 2003-02-01 at 17:25, John W. Holmes wrote: I'm loading a .csv file into MySQL, done it a million times but for some reason it is scrambling the row order. All the fields are making it in correctly but the order of the rows seems to end up totally random. I've done this a million times and never saw this.. So? Why does it matter to you what order the rows are in the database, as long as the right data is there? The order is irrelevant. Because in this instance I need it to come out in the order it is actually in. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redeclare formatdate
This is a good reason to use include_once and require_once. Jason On Sat, 2003-02-01 at 15:59, John W. Holmes wrote: I have this message coming when calling the page main.php Fatal error: Cannot redeclare formatdate() in /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3 the code related to this message is: ? // format MySQL DATETIME value into a more readable string function formatDate($val) { $arr = explode(/, $val); return date(d/m/y, mktime(0,0,0, $arr[1], $arr[2], $arr[0])); } ? I use this code is some other pages and it works well, but here the code is used in page not_main.php whose I included it on main.php using require() function Your function is being declared twice, which means that this file is probably being included or required twice. Look through your code... ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redeclare formatdate
Thx for the help... Miguel Jason Sheets [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... This is a good reason to use include_once and require_once. Jason On Sat, 2003-02-01 at 15:59, John W. Holmes wrote: I have this message coming when calling the page main.php Fatal error: Cannot redeclare formatdate() in /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3 the code related to this message is: ? // format MySQL DATETIME value into a more readable string function formatDate($val) { $arr = explode(/, $val); return date(d/m/y, mktime(0,0,0, $arr[1], $arr[2], $arr[0])); } ? I use this code is some other pages and it works well, but here the code is used in page not_main.php whose I included it on main.php using require() function Your function is being declared twice, which means that this file is probably being included or required twice. Look through your code... ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- 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: PHP3 Web Architecture Framework
Karthikeyan.Balasubramanian wrote: Hi, I browsed the web for many different web architecture and frameworks. I found many Interesting but all wants latest version of PHP at least PHP 4.0.6. I dont want to upgrade the PHP Version(4.0.5) that i have because many clients are using it and i dont want to mess it up. Its a Pain in PHP that to support any extension we need to recompile with appropriate extensions unlike Java where all you need to do is put the appropriate Jar files in the /Lib directory and it automatically gets SET in the classpath and works great but I do ADORE PHP for its ease and efficiency and ofcourse along with Apache it rocks. So please dont suggest me to upgrade my PHP or something other. Maybe you shouldn't publicly talk about how you and your clients are sticking with php4.0.5. It has known security holes, which is just one of many reasons to upgrade. You *will* spend much more time coding trying to make stuff work in PHP3 and early PHP4 than you will by taking advantage of relatively modern PHP4 versions. Session handling is something which comes to mind, and improved array handling. There will be things you can do in a few lines of code in recent versions of PHP4 that you simply won't be able to do at all, or not without *much* more work than it's worth. PHPGroupware.org *might* work for you. I know that there was a stated goal of their code working on PHP3 and PHP4 installations. I found that somewhat strange, but it was a goal. It may not be anymore. For *new* development, it doesn't make much sense to use the old stuff. If you're running older versions and people have apps that are running fine, that's another story, but even in those cases, the security exploits make it an unwise strategy for the long term. Pear which ofcourse needed recompilation with Pear support I don't think PEAR does require any recompilation. Certainly with most of the PEAR stuff you can just use the source code and it'll work fine. I would be very surprised if there wasn't at least SOME PEAR code which required PHP4.0.6 or higher. You don't need to recompile all of PHP, or at least you don't need to place the entire recompiled version of PHP into Apache again. You can usually compile SO files (shared object files) which you can dl() or put in php.ini. ./configure --with-gd=shared for example, will make a gd.so file suitable for dl() use. So please dont suggest me to upgrade my PHP or something other. Sorry, if you get many responses, at least some will suggest you upgrade. This is like saying you drive a 6 year old car (equivalent in internet time!) and that you *won't* get a newer car (cause your passengers like the seats in the old car) but you want all the benefits of a new engine. The fact that the car has known safety hazards and that a new car is essentially free aren't supposed to factor in to this? True, your passengers may have to adjust to new seats, and they may not like those seats as much as the old ones, but they'll have a safer ride, and you'll have a new, more powerful engine. I just can't think of too many valid reasons to not be running at least PHP4.1.x, if not 4.2. 4.3 has only been out for a few weeks, and I don't expect too many people to be running that yet. Most *interesting* development work in PHP regarding frameworks involves people who are somewhat on the cutting edge, using recent technology. They are most likely not going to bother trying to support PHP4.0.5 and below. Good luck. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Loading CSV data into MySQL
On 01 Feb 2003 18:06:01 -0500 [EMAIL PROTECTED] (Brian V Bonini) wrote: On Sat, 2003-02-01 at 16:47, Thomas Seifert wrote: I'm loading a .csv file into MySQL, done it a million times but for some reason it is scrambling the row order. All the fields are making it in correctly but the order of the rows seems to end up totally random. I've done this a million times and never saw this.. Any thoughts... where do you take a row-order from? and HOW are you uploading it into mysql? if you don't use a order by-clause in a select you won't have a really ordered result (only by accident). LOAD DATA INFILE 'file.cvs' INTO TABLE table1 FIELDS TERMINATED BY ';'; the contnts of file .csv look like: 1;2002-02-01;New Dominion Pictures;Prosecutors - The Gosch Murder Case;Beau Parcells;Dave Stevenson (victim's husband), Lead;yes;yes;yes 2;2002-02-01;Coastal;Prospecting;Zoe Whitaker;Corporate Representative;yes;yes; 3;2002-02-01;Metro Video;Right Spirit Campaign (Binge Drinking PSA), - Richmond, VA;Tom Downs;Jim (Sailor)/Principal;yes;yes; 4;2002-02-01;Metro Video;Right Spirit Campaign (Binge Drinking PSA), - Richmond, VA;Amie Hill;Spokesperson;;; 5;2002-02-01;Metro Video;Unit of Action (U.S. Army);Tim Smith;Col. Mike Daniels (Principal);;yes; 6;2002-02-01;Metro Video;Colonial Williamsburg;Molly Larkin;Mother/Wife;;yes; 7;2002-02-01;Commercial;Barton Ford;Dave Hobbs;Car Salesman;yes;yes; 8;2002-02-01;Commercial;Barton Ford;Jackie Jackson;Customer's Wife;;; 9;2002-02-01;Regent Films;First Lunch;Molly Larkin;Principal;yes;yes; 10;2002-02-01;Skillet Productions (televisio;Welcome Home;Molly Larkin;Principal;yes;yes; etc You'd think they would load into the db just like that right? But they do not. They just end up in some random order. this doesn't have anything to do with php afaik. as I said, try: select * from table1 order by field1 ASC replace the field1 with the field you have the number in (the first field in your csv). -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using input tags with php (IMPORTANT READ)
On Sat, 1 Feb 2003, Sunfire wrote: if i do this: /*all the mysql login stuff here*/ $query=mysql_query(select * from members); while($new=mysql_fetch_array($query)){ echo $new['company']; /*so on through the field list*/ } on output all i get is the title with a submit button.. otherwise blank.. There is a bug in PHP 4.3.0 regarding the use of arrays in strings. The following gave a parse error before PHP 4.3.0: print Do not do this: $arr['key']; Now it gives an E_NOTICE error due to changes to the string scanner. In PHP 4.3.1 it will no longer give a bogus E_NOTICE and instead it will work (no parse error either). Surrounding the array with {braces} in the string works regardless, so: print You can do this: {$arr['key']}; Regarding this question, don't write it like that but instead do the following (no quotes needed): echo $new['company']; For those wondering about this bug, see: http://bugs.php.net/bug.php?id=21820 The string documentation has been updated to demonstrate the array in string phenomena (except the bug hasn't been mentioned as I'm waiting for it to be committed first). http://www.php.net/types.string Sunfire, you aren't seeing this E_NOTICE error because your error level is turned down (by default). Put this on top of your script to see them all: error_reporting(E_ALL); Regards, Philip same thing with fetch_object()...and i have 1 row in the members table..im sort of confused now that it doesnt work for a wierd reason any better ideas on how to get the stuff out of the table and into vars? maybe im doing it wrong - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 5:33 PM Subject: Re: [PHP] using input tags with php In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time, [EMAIL PROTECTED] writes: i tried getting the values into vars using fetch_array/fetch_object and fetch_row and tried to put them in variables but for some odd reason it really doesnt work because when i try to use the vars in the value section instead of printing in the edit box the content of the variable i usually end up with ?, , ?php, or }? instead... any reason this shows up? and when i do: echo input type=text name=$name value='$new_var'; then on the web page i end up with some thing like this instead of the edit box: ;; }? any reason for that? It sounds like $name and/or $new_var may be empty. Did you echo the variables before using them in your form to check whether the values from the database are actually in the variables? Janet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using input tags with php (IMPORTANT READ)
hi.. i took your idea... i put the error reporting code at the top of the script and ran it as the problem was still there to see what would happen.. instead i get 0 messages from the reporting system and all i get is the last 7 chars of the print line and the }? at the end of the script... so for instance if i do: print(input type=\text\ name=\company\ value=$new['company']\n); or any variance of that statement changing around the \ and apostrophes around to try different things all i get is the rest of the script starting from the \n all the way to the rest of the script where it says }? at the end dont know if this is a bug or not but its getting hard to figure out what the problem with my echo or print statements are... here is the whole script: its supposed to get all fields and then display in input text boxes the current values in that certain record i know i missed some stuff in it with the query but at this point was supposed to be a test to see if i could even put it in the box in the first place... but here is the code: html head titleedit member/title /head form action=edit1.php method=post pick some of these:br ?php error_reporting(E_ALL); mysql_connect(192.4.5.6, root, ); mysql_select_db(wata); $result=mysql_query(select * from members where company like 'test'); while($row=mysql_fetch_array($result)){ print(input type=text name=company value=\$row[company\]\n\n); } ? input type=submit value=send /form /html /*end*/ any changes to make it work would be appreciated...tnx - Original Message - From: Philip Olson [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 6:48 PM Subject: Re: [PHP] using input tags with php (IMPORTANT READ) On Sat, 1 Feb 2003, Sunfire wrote: if i do this: /*all the mysql login stuff here*/ $query=mysql_query(select * from members); while($new=mysql_fetch_array($query)){ echo $new['company']; /*so on through the field list*/ } on output all i get is the title with a submit button.. otherwise blank.. There is a bug in PHP 4.3.0 regarding the use of arrays in strings. The following gave a parse error before PHP 4.3.0: print Do not do this: $arr['key']; Now it gives an E_NOTICE error due to changes to the string scanner. In PHP 4.3.1 it will no longer give a bogus E_NOTICE and instead it will work (no parse error either). Surrounding the array with {braces} in the string works regardless, so: print You can do this: {$arr['key']}; Regarding this question, don't write it like that but instead do the following (no quotes needed): echo $new['company']; For those wondering about this bug, see: http://bugs.php.net/bug.php?id=21820 The string documentation has been updated to demonstrate the array in string phenomena (except the bug hasn't been mentioned as I'm waiting for it to be committed first). http://www.php.net/types.string Sunfire, you aren't seeing this E_NOTICE error because your error level is turned down (by default). Put this on top of your script to see them all: error_reporting(E_ALL); Regards, Philip same thing with fetch_object()...and i have 1 row in the members table..im sort of confused now that it doesnt work for a wierd reason any better ideas on how to get the stuff out of the table and into vars? maybe im doing it wrong - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 5:33 PM Subject: Re: [PHP] using input tags with php In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time, [EMAIL PROTECTED] writes: i tried getting the values into vars using fetch_array/fetch_object and fetch_row and tried to put them in variables but for some odd reason it really doesnt work because when i try to use the vars in the value section instead of printing in the edit box the content of the variable i usually end up with ?, , ?php, or }? instead... any reason this shows up? and when i do: echo input type=text name=$name value='$new_var'; then on the web page i end up with some thing like this instead of the edit box: ;; }? any reason for that? It sounds like $name and/or $new_var may be empty. Did you echo the variables before using them in your form to check whether the values from the database are actually in the variables? Janet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- 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,
RE: [PHP] Screen Size detect??
index.htm script language=JavaScript function SubmitForm { document.myform.var.value = javascriptvalue; document.myform.submit(); } /script body onLoad='SubmitForm();' form name='myform' action='index.php' method='post' input type='hidden' name='var' value='' /form /body or something. I don't even know if that code works... I haven't tested it. but that could be the basis for somehting -Original Message- From: Nigel Powell [mailto:[EMAIL PROTECTED]] Sent: Sunday, 2 February 2003 3:25 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Screen Size detect?? On a slight side note to this, how can you pass javascript variables to PHP via POST? Newbie Powell On Saturday, February 1, 2003, at 12:21 PM, [EMAIL PROTECTED] wrote: From: Sean Malloy [EMAIL PROTECTED] Date: Sat Feb 1, 2003 6:48:26 AM Europe/London To: Dade Register [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP] Screen Size detect?? Create index.htm; script language=JavaScript var width = screen.width; var height = screen.height; window.location = 'index.php?width=' + width + 'height=' + height; /script and in index.php $width = $_GET['width']; $height = $_GET['height']; etc etc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Screen Size detect??
you can create a form with hidden fields like this script language=JavaScript document.screendata.height.value=screen.height; document.screendata.width.value=screen.width; screendata.submit(); /script form method=post action=index.php name=screendata input type=hidden name=height input type=hidden name=width /form bye Nigel Powell [EMAIL PROTECTED] escribió en el mensaje [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On a slight side note to this, how can you pass javascript variables to PHP via POST? Newbie Powell On Saturday, February 1, 2003, at 12:21 PM, [EMAIL PROTECTED] wrote: From: Sean Malloy [EMAIL PROTECTED] Date: Sat Feb 1, 2003 6:48:26 AM Europe/London To: Dade Register [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP] Screen Size detect?? Create index.htm; script language=JavaScript var width = screen.width; var height = screen.height; window.location = 'index.php?width=' + width + 'height=' + height; /script and in index.php $width = $_GET['width']; $height = $_GET['height']; etc etc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using input tags with php
On Sat, 1 Feb 2003, Sunfire wrote: hi.. i took your idea... i put the error reporting code at the top of the script and ran it as the problem was still there to see what would happen.. instead i get 0 messages from the reporting system and all i get is the last 7 chars of the print line and the }? at the end of the script... so for instance if i do: print(input type=\text\ name=\company\ value=$new['company']\n); or any variance of that statement changing around the \ and apostrophes around to try different things all i get is the rest of the script starting from the \n all the way to the rest of the script where it says }? at the end dont know if this is a bug or not but its getting hard to figure out what the problem with my echo or print statements are... here is the whole script: its supposed to get all fields and then display in input text boxes the current values in that certain record i know i missed some stuff in it with the query but at this point was supposed to be a test to see if i could even put it in the box in the first place... but here is the code: Please step back, slow down, and write your question in a short concise format. I have no clue what the above means. html head titleedit member/title /head form action=edit1.php method=post pick some of these:br ?php error_reporting(E_ALL); mysql_connect(192.4.5.6, root, ); mysql_select_db(wata); $result=mysql_query(select * from members where company like 'test'); while($row=mysql_fetch_array($result)){ print(input type=text name=company value=\$row[company\]\n\n); // Try this instead, see also: htmlspecialchars()* print input type='text' name='company' value='{$row['company']}'; Regards, Philip * http://www.php.net/manual/en/faq.html.php#faq.html.encoding } ? input type=submit value=send /form /html /*end*/ any changes to make it work would be appreciated...tnx - Original Message - From: Philip Olson [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 6:48 PM Subject: Re: [PHP] using input tags with php (IMPORTANT READ) On Sat, 1 Feb 2003, Sunfire wrote: if i do this: /*all the mysql login stuff here*/ $query=mysql_query(select * from members); while($new=mysql_fetch_array($query)){ echo $new['company']; /*so on through the field list*/ } on output all i get is the title with a submit button.. otherwise blank.. There is a bug in PHP 4.3.0 regarding the use of arrays in strings. The following gave a parse error before PHP 4.3.0: print Do not do this: $arr['key']; Now it gives an E_NOTICE error due to changes to the string scanner. In PHP 4.3.1 it will no longer give a bogus E_NOTICE and instead it will work (no parse error either). Surrounding the array with {braces} in the string works regardless, so: print You can do this: {$arr['key']}; Regarding this question, don't write it like that but instead do the following (no quotes needed): echo $new['company']; For those wondering about this bug, see: http://bugs.php.net/bug.php?id=21820 The string documentation has been updated to demonstrate the array in string phenomena (except the bug hasn't been mentioned as I'm waiting for it to be committed first). http://www.php.net/types.string Sunfire, you aren't seeing this E_NOTICE error because your error level is turned down (by default). Put this on top of your script to see them all: error_reporting(E_ALL); Regards, Philip same thing with fetch_object()...and i have 1 row in the members table..im sort of confused now that it doesnt work for a wierd reason any better ideas on how to get the stuff out of the table and into vars? maybe im doing it wrong - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 5:33 PM Subject: Re: [PHP] using input tags with php In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time, [EMAIL PROTECTED] writes: i tried getting the values into vars using fetch_array/fetch_object and fetch_row and tried to put them in variables but for some odd reason it really doesnt work because when i try to use the vars in the value section instead of printing in the edit box the content of the variable i usually end up with ?, , ?php, or }? instead... any reason this shows up? and when i do: echo input type=text name=$name value='$new_var'; then on the web page i end up with some thing like this instead of the edit box: ;; }? any reason for that? It sounds like $name and/or $new_var may be empty. Did you echo the variables before using them in your form to check whether the values from the database are actually in the
RE: [PHP] Loading CSV data into MySQL
On Sat, 2003-02-01 at 17:25, John W. Holmes wrote: I'm loading a .csv file into MySQL, done it a million times but for some reason it is scrambling the row order. All the fields are making it in correctly but the order of the rows seems to end up totally random. I've done this a million times and never saw this.. So? Why does it matter to you what order the rows are in the database, as long as the right data is there? The order is irrelevant. Because in this instance I need it to come out in the order it is actually in. Then use an ORDER BY in your query. If you're relying on the database to spit out rows in the order they went in, then you're wrong. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] emulate callback error for php3
hi sorry to ask so many questions but i have now realised that php3 doesnt handle the callback error handling so i can return the line and file of the error into a function is there a way to emulate this in php3 ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Variables
Perfect. Thanks. - Original Message - From: Philip Olson [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 2:22 PM Subject: Re: [PHP] Passing Variables On Sat, 1 Feb 2003, Beauford.2002 wrote: Hi, Is there a way to pass a variable to a PHP script without using a form? I want to put several links on my main page that when clicked on goes to a PHP script - depending on what link was selected, will determine what part of the PHP script gets executed. Yes, use GET: a href=foo.php?fruit=appleeat an apple/a See also if() and switch() http://www.php.net/else http://www.php.net/switch http://www.php.net/variables.external print $_GET['fruit']; Regards, Philip -- 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] Base64 Encode
I have a PHP script that works on older versions of PHP but on 4.3, it outputs nothing. Here's my code: ?php echo 'SCRIPT language=JavaScript type=text/javascript'.\n .\n.'if (document.location == top.location)'.\n .' top.location=home.php?goto=' .base64_encode($_SERVER[REQUEST_URI]).';'.\n .'/SCRIPT'; ? The problem is, when it redirects, the URL variable goto is empty. I'm assuming this has something to do with base64_encode. Since this code snipet is on every page of my site, it'd be a hard hassle to change it so is there a setting in PHP I need to tweak or should I set aside a few hours to edit this code? If the latter, what should I change it to? Thanks, Stephen Craton http://www.melchior.us What's the point in appearance if your true love, doesn't care about it? -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using SELECT and MULTIPLE in a form
I am displaying a form using values obtained from a database query. One of the elements contains about 20 different values. I want the use to be able to select multiple values before pressing submit. This seems to work, but when my php script is called, all I see is the last data value assigned to the variable. I could use a pointer. Here is a code snippet: echo TR\n; echo TDTask Description/TD\n; echo TDSELECT NAME='in_task_descr' MULTIPLE SIZE=4\n; for ($j = 0; $j $tskcount; $j++) { echo OPTION VALUE=\$taskdescr[$j]\$taskdescr[$j]/OPTION\n; } echo /SELECT\n; echo /TD\n; echo /TR\n\n; The above code adds a list to the form and the user can highlight more than one entry. How do I access the data after the user presses submit? -- Jim Kaufman mailto:[EMAIL PROTECTED] Linux Evangelistcell: 612-481-9778 public key 0x6D802619 fax: 952-937-9832 http://www.linuxforbusiness.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using SELECT and MULTIPLE in a form
Put empty square brackets (NAME='in_task_descr[]') after the name of your select element. Then all the slections will be in an array called... $_POST['in_task_descr'] or $_GET['in_task_descr'] Depending on your form method. James Kaufman wrote: I am displaying a form using values obtained from a database query. One of the elements contains about 20 different values. I want the use to be able to select multiple values before pressing submit. This seems to work, but when my php script is called, all I see is the last data value assigned to the variable. I could use a pointer. Here is a code snippet: echo TR\n; echo TDTask Description/TD\n; echo TDSELECT NAME='in_task_descr' MULTIPLE SIZE=4\n; for ($j = 0; $j $tskcount; $j++) { echo OPTION VALUE=\$taskdescr[$j]\$taskdescr[$j]/OPTION\n; } echo /SELECT\n; echo /TD\n; echo /TR\n\n; The above code adds a list to the form and the user can highlight more than one entry. How do I access the data after the user presses submit? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Register globals on and off
I've read that an include file in each of your pages with the lines below should do the trick for you with register_globals OFF.. Not sure if this is a valid way to go though... ?php extract($_SERVER); extract($_ENV); extract($_GET); extract($_POST); extract($_REQUEST); ? Regards, Pat Davy Obdam [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello people, On my development machine (win XP/Apache 2.0.44/PHP 4.3.0/MySQL 3.23.55) i have several websites that i made some time ago that require register globals to be On in the php.ini. Ofcourse i know thats not a good idea at all for security, but rewriting all this code is not an option. However in my php.ini i have set register globals to Off because that better. Is it possible to configure my webserver/php so that only those sites that require register globals to be On have that setting, for instance in a .htacces file?? Any help is appreciated:-) Best regards, Davy Obdam mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 4.3 Install on Solaris
Weston Houghton wrote: All, I seem to be getting a silly error on Solaris when trying to do a PHP 4.3 make. I get an error that looks to me like the liner arguments are just too long. to be honest, I'm a bit stupified as to why this is happening or how to fix it. FWIW, I have compiled 4.23 just fine on that box. Thanks, Wes p.s. here's the last bit of the error: /bin/sh libtool --silent --mode=link gcc -export-dynamic -g -O2 -avoid-version -module -L/usr/ucblib -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1 -L/export/home/oracle/OraHome/lib -R /usr/ucblib -R /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1 -R /export/home/oracle/OraHome/lib ext/ctype/ctype.lo ext/ftp/php_ftp.lo ext/ftp/ftp.lo ext/mysql/php_mysql.lo ext/mysql/libmysql/libmysql.lo snip Install GNU sed. The standard Solaris sed can't handle input that long. (I believe it has a character limit of 4096 characters or something to that effect.) GNU's sed doesn't have that limit. Installing the package from www.sunfreeware.com will put GNU sed in /usr/local. Make sure that make can find the GNU sed before it finds Sun's sed by putting /usr/local/bin before /usr/bin in your $PATH. J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 4.3 Install on Solaris
On Friday, January 31, 2003, at 08:13 PM, Weston Houghton wrote: I seem to be getting a silly error on Solaris when trying to do a PHP 4.3 make. I get an error that looks to me like the liner arguments are just too long. to be honest, I'm a bit stupified as to why this is happening or how to fix it. FWIW, I have compiled 4.23 just fine on that box. I built 4.3.0 on Solaris 2.6 and Solaris 8 without trouble. But as another poster suggested, I am using GNU utils (sed, make, etc). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using SELECT and MULTIPLE in a form
Hi, Sunday, February 2, 2003, 1:29:30 PM, you wrote: JK I am displaying a form using values obtained from a database query. JK One of the elements contains about 20 different values. I want the JK use to be able to select multiple values before pressing submit. JK This seems to work, but when my php script is called, all I see is JK the last data value assigned to the variable. I could use a pointer. JK Here is a code snippet: JK echo TR\n; JK echo TDTask Description/TD\n; JK echo TDSELECT NAME='in_task_descr' MULTIPLE SIZE=4\n; JK for ($j = 0; $j $tskcount; $j++) { JK echo OPTION VALUE=\$taskdescr[$j]\$taskdescr[$j]/OPTION\n; JK } JK echo /SELECT\n; JK echo /TD\n; JK echo /TR\n\n; JK The above code adds a list to the form and the user can highlight more than one JK entry. JK How do I access the data after the user presses submit? JK -- JK Jim Kaufman mailto:[EMAIL PROTECTED] JK Linux Evangelistcell: 612-481-9778 JK public key 0x6D802619 fax: 952-937-9832 JK http://www.linuxforbusiness.net This popped up using google http://www.onlinetools.org/tricks/using_multiple_select.php -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Loading CSV data into MySQL
You could create a integer column with an autoincrement flag, then order the rows by this column, that should give you the data in the order it was inserted into the db. Depending on your database there are other ways to do it. Jason On Sat, 2003-02-01 at 18:07, John W. Holmes wrote: On Sat, 2003-02-01 at 17:25, John W. Holmes wrote: I'm loading a .csv file into MySQL, done it a million times but for some reason it is scrambling the row order. All the fields are making it in correctly but the order of the rows seems to end up totally random. I've done this a million times and never saw this.. So? Why does it matter to you what order the rows are in the database, as long as the right data is there? The order is irrelevant. Because in this instance I need it to come out in the order it is actually in. Then use an ORDER BY in your query. If you're relying on the database to spit out rows in the order they went in, then you're wrong. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- 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] Line Number function?
PHP keeps track of what line# is being executed, so that when there's an error (say in pg_exec() ) it reports what line the error occured on. This appears to happen even during runtime (not just during compilation). For example: - ? $dbname=mydb; $dbuser=myuser; $dbpass=mypw; $conn=pg_connect(dbname=$dbname, user=$dbuser, password=$dbpass); $cmd=go and ask the mice; $result=pg_exec($conn, $cmd); ? -- This would result in a pg_exec error ~ line 7. PHP tracks this, even though the error is during runtime, not during the precompile. Is there a function where I can access this information? Something like get_line(); or something? This would be REALLY HANDY for debugging large projects... -Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using input tags with php
ok let me try this question thing again... i am having a problem using input tags by using current values kept in a mysql table. how do you get the values out of the table and into a form so they show as the value= part of the tag? i tried just aabout everything and it doesnt work even htmlspecialchars() doesnt work.. all i get for output on the page is the rest of the script printed on the screen after the value= part of the tag..is there any way to fix it? - Original Message - From: Philip Olson [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 8:01 PM Subject: Re: [PHP] using input tags with php On Sat, 1 Feb 2003, Sunfire wrote: hi.. i took your idea... i put the error reporting code at the top of the script and ran it as the problem was still there to see what would happen.. instead i get 0 messages from the reporting system and all i get is the last 7 chars of the print line and the }? at the end of the script... so for instance if i do: print(input type=\text\ name=\company\ value=$new['company']\n); or any variance of that statement changing around the \ and apostrophes around to try different things all i get is the rest of the script starting from the \n all the way to the rest of the script where it says }? at the end dont know if this is a bug or not but its getting hard to figure out what the problem with my echo or print statements are... here is the whole script: its supposed to get all fields and then display in input text boxes the current values in that certain record i know i missed some stuff in it with the query but at this point was supposed to be a test to see if i could even put it in the box in the first place... but here is the code: Please step back, slow down, and write your question in a short concise format. I have no clue what the above means. html head titleedit member/title /head form action=edit1.php method=post pick some of these:br ?php error_reporting(E_ALL); mysql_connect(192.4.5.6, root, ); mysql_select_db(wata); $result=mysql_query(select * from members where company like 'test'); while($row=mysql_fetch_array($result)){ print(input type=text name=company value=\$row[company\]\n\n); // Try this instead, see also: htmlspecialchars()* print input type='text' name='company' value='{$row['company']}'; Regards, Philip * http://www.php.net/manual/en/faq.html.php#faq.html.encoding } ? input type=submit value=send /form /html /*end*/ any changes to make it work would be appreciated...tnx - Original Message - From: Philip Olson [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 6:48 PM Subject: Re: [PHP] using input tags with php (IMPORTANT READ) On Sat, 1 Feb 2003, Sunfire wrote: if i do this: /*all the mysql login stuff here*/ $query=mysql_query(select * from members); while($new=mysql_fetch_array($query)){ echo $new['company']; /*so on through the field list*/ } on output all i get is the title with a submit button.. otherwise blank.. There is a bug in PHP 4.3.0 regarding the use of arrays in strings. The following gave a parse error before PHP 4.3.0: print Do not do this: $arr['key']; Now it gives an E_NOTICE error due to changes to the string scanner. In PHP 4.3.1 it will no longer give a bogus E_NOTICE and instead it will work (no parse error either). Surrounding the array with {braces} in the string works regardless, so: print You can do this: {$arr['key']}; Regarding this question, don't write it like that but instead do the following (no quotes needed): echo $new['company']; For those wondering about this bug, see: http://bugs.php.net/bug.php?id=21820 The string documentation has been updated to demonstrate the array in string phenomena (except the bug hasn't been mentioned as I'm waiting for it to be committed first). http://www.php.net/types.string Sunfire, you aren't seeing this E_NOTICE error because your error level is turned down (by default). Put this on top of your script to see them all: error_reporting(E_ALL); Regards, Philip same thing with fetch_object()...and i have 1 row in the members table..im sort of confused now that it doesnt work for a wierd reason any better ideas on how to get the stuff out of the table and into vars? maybe im doing it wrong - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 5:33 PM Subject: Re: [PHP] using input tags with php In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time, [EMAIL
RE: [PHP] Line Number function?
I think what you are looking for is: __LINE__ See: http://www.php.net/manual/en/language.constants.predefined.php Cheers, Steven Balthazor -Original Message- From: Benjamin Smith [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 01, 2003 8:59 PM To: [EMAIL PROTECTED] Subject: [PHP] Line Number function? PHP keeps track of what line# is being executed, so that when there's an error (say in pg_exec() ) it reports what line the error occured on. This appears to happen even during runtime (not just during compilation). For example: - ? $dbname=mydb; $dbuser=myuser; $dbpass=mypw; $conn=pg_connect(dbname=$dbname, user=$dbuser, password=$dbpass); $cmd=go and ask the mice; $result=pg_exec($conn, $cmd); ? -- This would result in a pg_exec error ~ line 7. PHP tracks this, even though the error is during runtime, not during the precompile. Is there a function where I can access this information? Something like get_line(); or something? This would be REALLY HANDY for debugging large projects... -Ben -- 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