[PHP] Header redirecting with POST
is it possible to use header() to redirect and have it act as a post I know about this method header("Location: http://www.yahoo.com/?variable=value";); but this is the GET method I don't want to have to know every single (variable|value) combination that will be sent to a page Sadly though, GET has a size limit on the amount of data you can send throught the URL, 2kb. I want to be able to send larger amounts with a header() redirect. Any ideas on how to send the data in a POST with header(); woud be appreciated. Thanks Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Performance
the site that I design for has converted all of the echo""; print() and any other printing function of php into a simple breakout into HTML. ie: We have done loop. We have done performance testing on most everything that can be done out put and include()/require() stuff. If you would like information on the performance results I might be able to round up some of the data. It is faster and cleaner. Jim Lucas www.bend.com - Original Message - From: "René Fournier" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, November 13, 2001 9:05 AM Subject: [PHP] Performance Is it true that mixing HTML and PHP--switching back and forth with tags--slows down performance? (I'm using PHP4.) Is it better to echo output than to drop out of PHP mode? And concerning database connections, my ISP asks that I always close a MySQL connection with a mysql_close()--which I can understand. But I'm curious, if I have to make, say, 10 SELECTs throughout a page (in the header, body, and footer), is it perhaps faster to use the mysql_close() at the very end of the page (in the bottom of the footer.inc)? In other words, is there any disadvantage performance-wise (or stability reason) to open and immediately thereafter close mysql connections? Can anyone recommend an article or two on coding techniques for improving PHP and MySQL performance? I don't wan to spend the rest of my life optimizing my php code, but if I knew a few basic rules about its performance characteristics, I might be able to make better decisions when coding. Thanks. ...Rene --- René Fournier, [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] echo vs. print() performance?
I have a way of performance logging anything with php. Let me know what type of performance data you would like to see and I will do my best to get the data ready rather quickly. I will gather the data that I have collect over the past few months. It is a performance log of every part of php that my site uses. I will try an get that data together by the first of next week. it will show microsecond time lines of include(), requires(), print() echo"", , and other related functions. Lets me know what you would like to see. Jim Lucas - Original Message - From: "Jack Dempsey" <[EMAIL PROTECTED]> To: "Jon Niola" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, December 13, 2001 11:50 PM Subject: Re: [PHP] echo vs. print() performance? > not as a criticism, but this is among the top 10 questions asked ...or used > to be for a while...anyway, there's tons of info on the mailing lists, > marc.theaimsgroup.com > the short answer is that echo is SLIGHTLY faster being a language construct > rather than a function...then again, i believe i remember someone proving the > opposite...in general, you'll never notice a differenece between the two... > > Jon Niola wrote: > > > Someone on this list once mentioned a performance difference between using > > echo and print(). Is there any evidence to back this up? I am really > > curious to see if it would make a difference to use one over the other. > > > > --Jon > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: [PHP-DB] while...if statements???
I would do a mysql_num_row(); on your results to see if it returning anything at all. Jim - Original Message - From: "Jay Fitzgerald" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, December 18, 2001 12:08 PM Subject: [PHP-DB] while...if statements??? > Does anyone know why this isn't working?? What I am trying to do is display > photos from a database based on each month. This part works fine when I set > it to the current month of December (today) as that is when I uploaded the > photos. > > However, when I manually set the date to a month that has no photos in it, > I want it to echo the No Animals string belowThis is only working > half-way...meaning that it will display a blank page with nothing on it > instead of actually echoing the No Animals string > > Can anyone please help?? Is there really a way to have a "while...if" > statement > > > > = > $connection = mysql_connect($hostname, $user, $pass) or die ("Unable to > connect!"); > $query = "SELECT petname, petDesc, petpicture FROM petinfo WHERE petmonth = > 'Apr'"; > $result = mysql_db_query($database, $query, $connection) or die ("Error in > query: $query. " . mysql_error()); > > while (list($pet_name, $pet_Desc, $pet_picture) = mysql_fetch_row($result)) > { > if ($pet_picture == "") > { > echo "No Animals have been posted for $date at this moment. Please check > back soon."; > exit; > } > > else > { > echo " > Pet of the month > > > SRC=\"http://moss.bayou.com:/oppj/admin/animalcontrol/photos/$pet_pictur e\" > HEIGHT=150> > > > $pet_Desc > > > To adopt $pet_name please visit the Ouachita Parish Animal Shelter. > The adoption fee is \$50.00 which includes Spade, Neutering and 7-N-1 > Shot. > > > Sorry, we can not hold $pet_name for you (First come first serve > basis). > "; > } > } > ?> > = > > Thanks, > > > Confus3d > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Error while calling a function
Try putting a closing "?>" php tag just before the final HTML. Jim - Original Message - From: "J.F.Kishor" <[EMAIL PROTECTED]> To: "PHP Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, December 18, 2001 5:26 AM Subject: [PHP] Error while calling a function > hi all, > > I have got a problem, when I execute the following script it gives > a Fatal error, could any one tell me why is it ?, If this is a silly > problem please execuse me but, plz do reply me. > > The script is > - > > > if(!$Phone) > { > ?> > > > Telephone Number : > > > > } > else > { > > function is_allnumbers ($text) > { > if( (gettype($text)) == "integer") > { > print "the value is an integer"; > return true; > } > > $Bad = $this->strip_numbers($text); > > if(empty($Bad)) > { > print "the value is empty"; > return true; > } > return false; > } > > function clear_error () > { > $this->ERROR = "this is an error"; > } > > > function is_phone ($Phone ="") > { > if($this->CLEAR) > { > $this->clear_error(); > } > > if(empty($Phone)) > { > $this->ERROR = "is_phone: No Phone number > submitted"; > return false; > } > > $Num = $Phone; > $Num = $this->strip_space($Num); > $Num = eregi_replace("(\(|\)|\-|\+)","",$Num); > if(!$this->is_allnumbers($Num)) > { > $this->ERROR = "is_phone: bad data in phone > number"; > return false; > } > > if ( (strlen($Num)) < 7) > { > print "the number is less then 7"; > $this->ERROR = "is_phone: number is too short > [$Num][$Phone]"; > return false; > } > > if( (strlen($Num)) > 13) > { > print "the number is > then 13"; > $this->ERROR = "is_phone: number is too long > [$Num][$Phone]"; > return false; > } > > return true; > } > } > $result = is_phone($Phone); > if($result == "true") > { > echo "success"; > } > else > { > echo "failure"; > } > > > > > > The error is > > Fatal error: Call to undefined function: is_phone() in > /home/kuruvi1/kishor/public_html/IMS/ADMIN/test/is_phone.php on line 87 > > > Thanks for your tolerance, > > - JFK > kishor > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] OPEN_BASEDIR from user point of view (instead server admin)
php will return you four $vars to work with. check this out. http://www.php.net/manual/en/features.file-upload.php then work with the tmp file and get done with it what needs to be done before the script closes cause php will delete the file when the script is done. jim - Original Message - From: "M" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 18, 2001 2:45 PM Subject: [PHP] OPEN_BASEDIR from user point of view (instead server admin) > Hello, I posted a question some days ago, but no answers received. I > notice many people discussing OPEN_BASEDIR apache restriction here, but > all discussion are from server admin point of view. > > Let me ask question in another way: > > Is it possible to tell HTTP command the complete path/name > into local server for file being uploaded?. Note upload made by type=file ..> command. > > The reason for this question is posted into my original question (below) > > Thanks > > Miguel > > = previous msg posted at 10/12/01 = > > Now a question about uploading files (.gif .jpg) using method=post> to be stored into Mysql blob fields. > > I hope somebody here having sites on www.blueboxinternet.com hosting > company, because I have big trouble there I can't solve, and support > says I first shoud read faq because they have lot of customers with no > problems. > > I make industrial and commercial catalogs, so my customers should be > able to send (upload) pictures of products and goodies directly from > their HD to site, these pictures stored in Mysql tables and shown when > customer pages are called by someone. > The only way I know to perform this is > > > > Enter filename > > > >if($upload) > { > $fp=Fopen ($myfile,"r"); > >/* here lot of commands to store file into mysql tables */ > ... > } > ?> > > > This script will store picture-file into some tmp directory on bluebox > servers and will return tmp file name into $myfile var when script > called again by 'form action' command. Then I can treat file and store > in DB. > > This script worked fine on bluebox servers until NOVEMBER 1st , > when they made some important changes on their servers. When this change > > happened, my script began to receive this error: > > Warning: open_basedir restriction in effect. File is in wrong directory > in > /home/httpd/vhosts/meucatalogo.com/web_users/gratis/rest_prox.php on > line 25 > > Bluebox support says I am recording my files on tmp directory with owner > > 'someowner' and trying to read file with 'anotherowner' owner. > I argue I have no control about owners and file modes into their servers > > (specially into their tmp directories), and that PHP performs this task > in a transparent way for me. Thats to say, I have no tools to bypass > this problem. > Then they answer I shoud read faq. > > Case some of you have site using this (otherwise excellent web hosting) > company, I would greatly appreciate what solution for upload files thru > HTML forms there exists. > = > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP4 on Windows98 with PWS4
make sure you copy all the correct dll's into the c:\windows\system or system32 directory. the dll's have to be in a location that is included in the window PATH in the autoexec.bat Jim - Original Message - From: "Alex Shi" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 18, 2001 2:51 PM Subject: [PHP] PHP4 on Windows98 with PWS4 > Hello, folks! > > I installed PHP4 on Windows 98 with PWS4. When I try to > run a very simple script, I got a just one line error message > "One of the library files needed to run this application cannot > be found". The script is very simple: "", so > I don't think the error has anything to do with it. Anyone has > idea what's wrong with it? Please help me out if you know > this issue. Thanks in advance! > > Alex Shi > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] JavaScript & php question - mainly JS though so slightly OT but hep needed!!! :o)
actually Martin, that is what Martin was doing. href="javascript:function_name()" calls to a js function. my suggestion would be to write it this way. text that way, if the client clicks the link/button before the page is done downloading the page. it won't stop the page from finishing. if you do it the way you wrote below. the page will stop downloading, including the images that havn't finished. Jim - Original Message - From: "Martin Towell" <[EMAIL PROTECTED]> To: "'Martin Hughes'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, December 18, 2001 3:05 PM Subject: RE: [PHP] JavaScript & php question - mainly JS though so slightly OT but hep needed!!! :o) > if you have lots of links, then doing it this way, IMO, would be > easier/better - so: > > function windowPopup(xx) { window.open("info.php?patch="+xx, "_new", > "windowattribs"); } > > > but if there's only a few links, then placing the window.open code in the > link would be easiest, i think. > > -Original Message- > From: Martin Hughes [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, December 19, 2001 9:54 AM > To: [EMAIL PROTECTED] > Subject: [PHP] JavaScript & php question - mainly JS though so slightly > OT but hep needed!!! :o) > > > How could I write the function windowPopup(XX) where XX is a variable that > can change from link to link, for a popup info window to load a php file > with the variable XX in the url? > > So the link would look like: > Link Text > > and I want that link to open the page info.php?patch=XX in a new popup > window > > Do I do it something like this, or is there a faster/better way?? > > Cheers & Merry X-Mas! > > Martin > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Working with designers...
hope you don't plan to use that example table in netscape 4.x - Original Message - From: "Mark" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, December 18, 2001 4:10 PM Subject: Re: [PHP] Working with designers... On Tue, 18 Dec 2001 16:00:09 -0800, Fred wrote: > >Mark <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >well, you don't have to wade through all that html, just put an >include() in there to a file that has all the php in it. then >dreamweaver should leave it alone. > >Huh? > >Obviously the logic can be included, but the output functions need >to be >burried deep in dreamweaver created nested tables and javascripts. hmm, I'm assuming that javascript is the programmer's responsibility, not the designer's. Maybe the javascript needs to be dynamically generated, probably it doesn't. either way it's in a separate file doesn't get edited in dreamweaver. I understand that the php will probably have to be in a table and the designer's will want to be able to change it's appearance, and that's where css comes in. i.e.: yes, there's some html in the included file, but the designer's don't need to have access to it because they can just change how it looks in the stylesheet. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] JavaScript & php question - mainly JS though so slightly OT but hep needed!!! :o)
the bad thing is, it will still stop the browser from finishing the loading of the page. - Original Message - From: "Mark" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; "Martin Towell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, December 18, 2001 4:16 PM Subject: Re: [PHP] JavaScript & php question - mainly JS though so slightly OT but hep needed!!! :o) On Tue, 18 Dec 2001 15:58:10 -0800, Jim Lucas wrote: >actually Martin, that is what Martin was doing. >href="javascript:function_name()" calls to a js function. > >my suggestion would be to write it this way. > >text better yet: text to keep weird browsers from doing things you don't expect (like jumping to the top) >that way, if the client clicks the link/button before the page is >done >downloading the page. it won't stop the page from finishing. if you >do it >the way you wrote below. the page will stop downloading, including >the >images that havn't finished. > >Jim >- Original Message - >From: "Martin Towell" <[EMAIL PROTECTED]> >To: "'Martin Hughes'" <[EMAIL PROTECTED]>; [EMAIL PROTECTED]> >Sent: Tuesday, December 18, 2001 3:05 PM >Subject: RE: [PHP] JavaScript & php question - mainly JS though so >slightly >OT but hep needed!!! :o) > > >> if you have lots of links, then doing it this way, IMO, would be >> easier/better - so: >> >> function windowPopup(xx) { window.open("info.php?patch="+xx, >>"_new", >> "windowattribs"); } >> >> >> but if there's only a few links, then placing the window.open code >>in the >> link would be easiest, i think. >> >> -Original Message- >> From: Martin Hughes [mailto:[EMAIL PROTECTED]] >> Sent: Wednesday, December 19, 2001 9:54 AM >> To: [EMAIL PROTECTED] >> Subject: [PHP] JavaScript & php question - mainly JS though so >>slightly >> OT but hep needed!!! :o) >> >> >> How could I write the function windowPopup(XX) where XX is a >>variable that >> can change from link to link, for a popup info window to load a >>php file >> with the variable XX in the url? >> >> So the link would look like: >> Link Text >> >> and I want that link to open the page info.php?patch=XX in a new >>popup >> window >> >> Do I do it something like this, or is there a faster/better way?? >> >> Cheers & Merry X-Mas! >> >> Martin >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> To contact the list administrators, e-mail: php-list- >>[EMAIL PROTECTED] >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Working with designers...
well, the class tag in the tr won't work with ns6 , but fortunately for you ( sigh ) ns 6 does include the div tag. - Original Message - From: "Mike Eheler" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 18, 2001 4:28 PM Subject: Re: [PHP] Working with designers... > LOL. > > Use Netscape 4. > > Now there's a condtradiction you don't hear every day. > > Mike > > Jim Lucas wrote: > > > hope you don't plan to use that example table in netscape 4.x > > > > - Original Message - > > From: "Mark" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Tuesday, December 18, 2001 4:10 PM > > Subject: Re: [PHP] Working with designers... > > > > > > On Tue, 18 Dec 2001 16:00:09 -0800, Fred wrote: > > > >>Mark <[EMAIL PROTECTED]> wrote in message > >>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >>well, you don't have to wade through all that html, just put an > >>include() in there to a file that has all the php in it. then > >>dreamweaver should leave it alone. > >> > >>Huh? > >> > >>Obviously the logic can be included, but the output functions need > >>to be > >>burried deep in dreamweaver created nested tables and javascripts. > >> > > > > hmm, > > I'm assuming that javascript is the programmer's responsibility, not > > the designer's. Maybe the javascript needs to be dynamically > > generated, probably it doesn't. either way it's in a separate file > > doesn't get edited in dreamweaver. > > > > I understand that the php will probably have to be in a table and the > > designer's will want to be able to change it's appearance, and that's > > where css comes in. i.e.: > > > > > > > > > > > > > > > > > > > > yes, there's some html in the included file, but the designer's don't > > need to have access to it because they can just change how it looks > > in the stylesheet. > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Access rights for php files on Linux?
your scripts have to have to be readable by your apache user/group if it can't read them then it can't run them. now as for being allowed to only view files of yours, you would want to place the apache user in your group. this will give it access to read your files, but so will others running apache, ie a person writes a php script that is ran by apache and then can read your files because the process is running as the apache user which can see your files. so, to answer your question, no, there isn't a simple way to do this. - Original Message - From: "Daniel Fassnauer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 18, 2001 4:56 PM Subject: [PHP] Access rights for php files on Linux? > Well, I have encounterd a problem which is quite big (for me), so I hope > I find help here. > My setup is a Linux Machine, running Apache with php as a module. > In order for the webserver to parse the file, i have to give read > permission to world. > This is a problem, because about 100 people have shell access and could > then just cat /www/myphpfile.php, and would thus get passwords which i > dont want to share (like mysql password in the phpmyadmin config file) > and general access to my code. Also, the different users on the machine > want to be able to host php files with everyone else being able to read > them. Is there any way i can actually do that? > I must say that i am rather new to all this stuff, so i am really > confused as what to do, and i would appreciate any help.. > Thanks in advance... > > Daniel > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Help on dealing with arrays of HTTP_POST vars
in your SearchOrder() function change the for() to a foreach() Jim - Original Message - From: "Carlos Fernando Scheidecker Antunes" <[EMAIL PROTECTED]> To: "PHP-GENERAL" <[EMAIL PROTECTED]> Sent: Wednesday, December 19, 2001 10:15 AM Subject: [PHP] Help on dealing with arrays of HTTP_POST vars > Hello All, > > I have developed a system to retrieve data from a table. The interface is a > dynamic list of orders created from a query on the database that shows all > the new orders. Next to each is a checkbox. Each checkbox has as its value > the order number and is called PED1, PED2, PED3,PEDn, depending on > how many new orders are available. If the user wants to access these orders > he has to check the orders he wants and click the submit button. Once it is > submited, it searches all the PED# variables on the HTTP_POST_VARS and > builds an array called $Orders. The $Orders array contains order numbers and > is later used to query a different table. > > Ths code works almost great. But there is a problem, if the first checkbox, > say PED1 field is not checked, and some of the other checkboxes are (say > PED2, PED4), the $Orders array ends being empty. So, say that the form has 5 > orders and the user selects orders 2, 4 and 5 and submit it. It does not > work. But if he selects 1,2, 4 and 5 it works. It works only if the first > checkbox is checked too. > > What I wonder is why this code does not work if PED1 checkbox is not > checked. What if the user only wants other stuff but the first order PED1? > > Could you help me on this? > > Here's the code: > > This is a function that searches for variables called PED1, PED2, PED3 that > are checkboxes on a submited form and have the order numbers. When this > checkbox is checked, the ordernumber is saved on an Array $Orders that is > later used to build a SQL statement. > > function SearchOrders() { > global $Orders; > global $HTTP_POST_VARS; > > $index = count($HTTP_POST_VARS); > > for($i=1; $i <= $index; $i++) { > if (isset($HTTP_POST_VARS["PED$i"])) > $Orders[] = $HTTP_POST_VARS["PED$i"]; > } > $index = count($Orders); > return $index; > > } > > This is a function that retrieves the array values that are order numbers > from the array $Orders and assembles a SQL statement $query. > This will later retrieve data from a MySQL table; > > function MontarOrdRel() { > global $Orders; > > $query = "SELECT * FROM tbl_Ord "; > > if (count($Orders) > 0) > $query .= "WHERE "; > > for($index=0; $index < count($Orders); $index++) { > > if ($index < (count($Orders)-1)) { > $query .="(NumPedido = '".$Orders[$index]."') OR "; > } > else { > $query .="(NumPedido = '".$Orders[$index]."') "; > } > } // for loop > $query .= "ORDER BY NumOrd"; > > Then $query is used to query a table. > > Thank you for your help, > > Carlos Fernando Scheidecker Antunes. > > > Linux User #207984 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] sessions var
as long as the domain of the cookie is set to yoursite.com it will be readable from whateveryouwant.yoursite.com but if the domain is set to www.yoursite.com you won't be able to read it from yoursite.com Jim - Original Message - From: "Mehmet Kamil ERISEN" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 19, 2001 2:18 PM Subject: Re: [PHP] sessions var > One problem that I have with sessions it that if your login > page is in www.yoursite.com and the you pop a page > yoursite.com I think the Session is not recognized. > just a hint. > --- William Sanchez Sanchez <[EMAIL PROTECTED]> wrote: > > > > > > I need some help with sessions. I need to pass variables > > to a page that will > > load > > in a new browser window (window.open("",myWindow,"") and > > > target="myWindow">). > > I used session_register and I tried using start_session > > and still no luck. Once I get the session vars > > registered, how do I > > access them from the new window opened... > > > > > > thanks in advantage... > > > > > > > > William. > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > To contact the list administrators, e-mail: > > [EMAIL PROTECTED] > > > > > = > Mehmet Erisen > http://www.erisen.com > > __ > Do You Yahoo!? > Check out Yahoo! Shopping and Yahoo! Auctions for all of > your unique holiday gifts! Buy at http://shopping.yahoo.com > or bid at http://auctions.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Slash problem
it is a thingy called magic quotes. setup in the php.ini file. turn it off and they will go away. or, if you can't add a stripslashes() to every variable that will passed this way. Jim - Original Message - From: "Evansville Scene" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 19, 2001 4:39 PM Subject: [PHP] Slash problem I'm fairly new @ PHP, so forgive me if the answer is trivial ... In many cases, if I take in data from a form and the user uses an apostrophe, the data that is sent to me has a slash in it. For example: Jones\' Auto Repair Is there an easy fix? I'm not sure why this is occurring ... It\'s been quite a pain :) Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP Testing
Well, I have been chaning different settings the past few days and noticed that my messages had not been posted to the board. Finally got it going. But here is my question, now that my email IS working. can you override the engine setting in the virtual host block I am running Apache 1.3.26 & PHP 4.2.2 ie: in the global area of the httpd.conf file I put php_admin_value engine Off and then do the following for my VirtualHost blocks DocumentRoot /some/path/public_html php_admin_value engine On When I do this. PHP doesn't parse the files. It just prints the php code in the sent page. Is this possible, can it be done, and if so, how? Jim - Original Message - From: "Paul Marinas" <[EMAIL PROTECTED]> To: "Jim Lucas" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, January 02, 2003 4:33 PM Subject: Re: [PHP] PHP Testing > :) > > Paul Marinas > Technical Support > RDS Craiova > > > Phone: +402-51-410-194 > Mobile: +407-22-451-439 > Fax:+402-51-416-579 > www.rdsnet.ro > . > > Privileged/Confidential Information may be contained in this message. If you > are not the addressee indicated in this > message (or responsible for delivery of the message to such person), you may > not copy or deliver this message to > anyone. In such a case, you should destroy this message and kindly notify > the sender by reply e-mail. > > On Thu, 2 Jan 2003, Jim Lucas wrote: > > > checking return emails.. > > > > -- > 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] header() problem!!!!
This is not a bug. This is just one of many differances between the big browser war. With Netscape (not sure which versions), the attachment thing I found is required. But with IE it kills the browser. - Original Message - From: "xdrag" <[EMAIL PROTECTED]> To: "PHP Mailing List" <[EMAIL PROTECTED]> Sent: Saturday, September 07, 2002 7:38 PM Subject: [PHP] header() problem > Hi: > is this a bug? > [win98se + apache2.0.40 + PHP4.2.3 + IE6.0] > > download1.php: > ... > header("Cache-Control: no-cache, must-revalidate"); > header("Content-Type:".$mime_type); > header("Content-Disposition: filename=$filename"); > echo $filedata; > ?> > works well > > download2.php: > ... > header("Cache-Control: no-cache, must-revalidate"); > header("Content-Type:".$mime_type); > header("Content-Disposition: attachment; filename=$filename"); > echo $filedata; > ?> > please pay attention to header("Content-Disposition: ...") > if you click this URL, for example "download2.php?id=1", then click the "save" button, > your browser will suffer a fatal error. You can not do anything else now! > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] tag img and php
show the contents of 'try_param.php' please. Jim Lucas - Original Message - From: "Maciej Przybycien" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, May 15, 2002 10:38 AM Subject: [PHP] tag img and php > > Hi, > I included php file as html img: > height="240" > > and Netscape brawser seems not to interpret that. However if I change > try_param.php -> try_param.png then image can be desplayed. > > According to the documentation 'try_param.php' should be interpereted > fine. > What could be the problem? > > Thank you, > Maciek > > > > -- > 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] display errors for developers only?
if you are running apache you could turn that option on inside of a specific ... block. Jim Lucas - Original Message - From: "Jeff Bearer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, May 20, 2002 12:44 PM Subject: [PHP] display errors for developers only? > In the php.ini file I have display_errors = Off, how would I configure > the server, or the application to display the errors for specific hosts, > the developers? > > > -- > Jeff Bearer, RHCE > Webmaster > PittsburghLIVE.com > 2002 EPpy Award, Best Online U.S. Newspaper > > > -- > 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] array empty after use
when you loop through a mysql result set you move the pointer up one place. you need to use the mysql_data_seek($results, 0); to reset the pointer Jim Lucas - Original Message - From: "Web" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> Sent: Tuesday, May 21, 2002 2:47 AM Subject: [PHP] array empty after use > Hi there. > > When an array is 'used' with something like do while I can't re-access it > later in the page. It is as if the array gets used up and doesn't exist. > The array is from a select statement using myself. I have inserted a > duplicate array with a different name to get around this but figure there > must be a simpler way. > > Any ideas please? > > Thanks > Kevin > > > -- > 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] Passing an array on
you can use serialize() and unserialize() and make sure that you urlencode() and urldecode() the serialized string before attaching it to your URL. if you don't, you might find that some chars will not be right on the other end of the line. Jim Lucas - Original Message - From: "John Fishworld" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, May 22, 2002 9:05 AM Subject: [PHP] Passing an array on > Whats the best way to pass on array on in a link ? > > eg > offset is where we are (what page) > but state is an array, with a variable size > > href=joblist.php?offset=$offset&state=$state > > thanks > > > > -- > 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] unable to register session variables
Are you starting the session first? Jim Lucas - Original Message - From: "Pushkar Pradhan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, May 22, 2002 10:19 AM Subject: [PHP] unable to register session variables > I am following example 4 on http://www.php.net/manual/en/ref.session.php > code: > if(!session_is_registered("layer") ) { >session_register("layer"); > } > I tried both "" and ''s. > Doing a phpinfo() on the pg. doesn't show any $HTTP_SESSION_VARS > > I've both track_vars and register_globals enabled in my php.ini > Any idea what's wrong? Thanks, > > -Pushkar S. Pradhan > > > -- > 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] unable to register session variables
not that I am aware of. Jim Lucas - Original Message - From: "Pushkar Pradhan" <[EMAIL PROTECTED]> To: "Jim lucas" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, May 22, 2002 10:43 AM Subject: Re: [PHP] unable to register session variables > Aren't there two method to register variables: > 1. session_start() as you suggested with track_vars enabled > 2. !session_is_registered() with register_globals enabled > > I tried session_start also but didn't work, phpinfo() doesn't show any > $HTTP_SESSION_VARS > > Are you starting the session first? > > > > > session_start(); > > session_register('variable'); > > ?> > > > > Jim Lucas > > - Original Message - > > From: "Pushkar Pradhan" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, May 22, 2002 10:19 AM > > Subject: [PHP] unable to register session variables > > > > > > > I am following example 4 on http://www.php.net/manual/en/ref.session.php > > > code: > > > if(!session_is_registered("layer") ) { > > >session_register("layer"); > > > } > > > I tried both "" and ''s. > > > Doing a phpinfo() on the pg. doesn't show any $HTTP_SESSION_VARS > > > > > > I've both track_vars and register_globals enabled in my php.ini > > > Any idea what's wrong? Thanks, > > > > > > -Pushkar S. Pradhan > > > > > > > > > -- > > > 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 > > > > -Pushkar S. Pradhan > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] diplaying the path
depending on what version of php you are running, you can use $GLOBALS['HTTP_REFERER'] or on newer versions you can use $_SERVER['HTTP_REFERER'] Jim Lucas - Original Message - From: "Kris Vose" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, May 31, 2002 9:19 AM Subject: [PHP] diplaying the path > Is there a variable/function in php that will display the url location of the hyper-link that brought them to the current page. Thanks in advance. > > Kris Vose > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Run php function with user click
use flash to open a tunnel to the server and run a script, therefor it never has to leave the current page. ::) Jim Lucas - Original Message - From: "Michael Sweeney" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "Dave Shacket" <[EMAIL PROTECTED]> Sent: Friday, May 31, 2002 10:36 AM Subject: Re: [PHP] Run php function with user click > On Friday 31 May 2002 05:44, you wrote: > > I know how to have my php code run a function within itself. But is there a > > way that upon an event (clicking a button, etc.), you could run a php > > function without having to go to a new page? > > No. PHP is a server side application. The only way to run a function or php > program is to send a request to the server. When you do that the server sends > back a response and your broswer refreshes the page. > > ..michael.. > > -- > 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] diplaying the path
the bad thing about the BTW seciton is, is that it is not true inside of a function, that is the reason I refered to it as $GLOBALS['HTTP_REFERER'] Jim lucas - Original Message - From: "Philip Olson" <[EMAIL PROTECTED]> To: "Jim lucas" <[EMAIL PROTECTED]> Cc: "Kris Vose" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, May 31, 2002 11:03 AM Subject: Re: [PHP] diplaying the path > actually: > > If the php directive register_globals is on, then > $HTTP_REFERER will exist. Otherwise it will not. > (or course that assumes a value exists at all). > > Regardless of the register_globals setting, you > can do: > > // Works since PHP 3 (forever)* > print $HTTP_SERVER_VARS['HTTP_REFERER']; > > // Works since PHP 4.1.0 > print $_SERVER['HTTP_REFERER']; > > Btw, $GLOBALS['HTTP_REFERER'] === $HTTP_REFERER. > And lastly, since PHP 4.2.0 the register_globals > directive defaults to off, which is what Jim was > indirectly referring to. See also extract(). > > Regards, > Philip Olson > > * For versions older then 4.0.3 see also the > track_vars directive, it should be on. > > > On Fri, 31 May 2002, Jim lucas wrote: > > > depending on what version of php you are running, you can use > > $GLOBALS['HTTP_REFERER'] or on newer versions you can use > > $_SERVER['HTTP_REFERER'] > > > > Jim Lucas > > - Original Message - > > From: "Kris Vose" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Friday, May 31, 2002 9:19 AM > > Subject: [PHP] diplaying the path > > > > > > > Is there a variable/function in php that will display the url location of > > the hyper-link that brought them to the current page. Thanks in advance. > > > > > > Kris Vose > > > > > > > > > -- > > 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] Run php function with user click
but that would take you off the current page wouldn't it? or would you return false? Jim Lucas - Original Message - From: "Leotta, Natalie (NCI/IMS)" <[EMAIL PROTECTED]> To: "'Jim lucas'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Cc: "Dave Shacket" <[EMAIL PROTECTED]> Sent: Friday, May 31, 2002 1:25 PM Subject: RE: [PHP] Run php function with user click > JavaScript could do a similar thing with onClick. > > -Natalie > > -Original Message- > From: Jim lucas [mailto:[EMAIL PROTECTED]] > Sent: Friday, May 31, 2002 4:21 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Cc: Dave Shacket > Subject: Re: [PHP] Run php function with user click > > > use flash to open a tunnel to the server and run a script, therefor it > never has to leave the current page. ::) > > Jim Lucas > - Original Message - > From: "Michael Sweeney" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: "Dave Shacket" <[EMAIL PROTECTED]> > Sent: Friday, May 31, 2002 10:36 AM > Subject: Re: [PHP] Run php function with user click > > > > On Friday 31 May 2002 05:44, you wrote: > > > I know how to have my php code run a function within itself. But is > there a > > > way that upon an event (clicking a button, etc.), you could run a > > > php function without having to go to a new page? > > > > No. PHP is a server side application. The only way to run a function > > or > php > > program is to send a request to the server. When you do that the > > server > sends > > back a response and your broswer refreshes the page. > > > > ..michael.. > > > > -- > > 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] Running a script to check something before submitting a form. Can this be done?
you will have to do this with javascript on the client side with an onClick() call in the submit button. but the bad thing is, you wont be able to check this with the mysql db, unless you load the entire field set into the current page. my suggestion would be to send the form to one single page no-matter what. do the validating and then if the email address isn't there, redirect with the php header() function to the custom page that you are talking about. Jim lucas - Original Message - From: "Don" <[EMAIL PROTECTED]> To: "php list" <[EMAIL PROTECTED]> Sent: Friday, May 31, 2002 1:46 PM Subject: [PHP] Running a script to check something before submitting a form. Can this be done? Hi, I think I need to use PHP here which is why I'm posting to this ng. I have a form that upon the user pressing submit, calls a PHP form handler. What I'd like to do is upon the user pressing submit, I need to validate an email field within a MySQL database and only if it does NOT exist, call the form handler. If it exists, I'll juets return a custom page and NOT call the form handler. I'm wondering if I need some JavaScript here? If PHP is not involved, I apologize for the post. Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echoing two varibles(newbie)
string concat something like this require(contant.$variable."string"); Jim Lucas - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 03, 2002 1:26 AM Subject: [PHP] echoing two varibles(newbie) How can I echo(or include) two variables? ie include $DOCUMENT_ROOT then $row['location'] Thanks in Advance JJ Harrison [EMAIL PROTECTED] www.tececo.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] A small question - Mysql_insert_id
and you want people to actually ready your books after talking to customers like that. I should burn your book. I thought you were a helping person. If someone has a question and it is obvious that they have no clue about what they are talking about. shouldn't you walk them through it instead of shitting on them and telling them to f*** off? Just an observation.... Jim Lucas - Original Message - From: "Julie Meloni" <[EMAIL PROTECTED]> To: "r" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, June 01, 2002 8:06 AM Subject: Re[2]: [PHP] A small question - Mysql_insert_id > r> Actually the ID field is not null,primary and auto_increment. > > Well, it has to be of a TYPE as well... > > r> Thanks for the URL but in my message I did quote the line from that same url > r> (http://www.php.net/manual/en/function.mysql-insert-id.php) > > r> I just need to get the ID of the just inserted record. > > I'm just going to assume you're f*cking with all of us and leave it at > that. > > > - Julie > > --> Julie Meloni > --> [EMAIL PROTECTED] > --> www.thickbook.com > > Find "Sams Teach Yourself MySQL in 24 Hours" at > http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20 > > > -- > 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] Secure File Upload
ok, here are a few questions for you to clarify things. A) Do you want to place a limit on the size of a single file being uploaded? B) Do you want to place a restriction that says after n'th number of files that have been uploaded equal 'X' ammount of space on the server disable file uploads? (this is what it sounds like you are asking, to me anyways) Answer these two questions and it will help me alot Jim Lucas - Original Message - From: "Christoph Starkmann" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, June 04, 2002 8:34 AM Subject: [PHP] Secure File Upload > Hi There! > > When uploading a file with PHP, AFAIK I can only control what will be stored > on the server. So if someone sends me 100 MB, these will be deleted > immediately. But, unfortunately, the traffic is produced nevertheless. Is > there any way to check the file size before uploading the file or any other > way to keep the traffic under a certain limit? Last think I would like to > have is a script that disables all uploads after a certain traffic has been > produced, I would like to be able to really PREVENT uploads, let's say > bigger than 10 MB?! > > Cheers, > > Kiko > > -- > It's not a bug, it's a feature. > christoph starkmann > mailto:[EMAIL PROTECTED] > http://www.gruppe-69.com/ > ICQ: 100601600 > -- > > -- > 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] Regular Expressions Help
not sure why you have such a complex reg there, but will this work for you. preg_replace("/(http:\/\/)?([^\/ ]*)(.*);/", "http://\\2\\3";, $str); \\1 = http:// ; if there \\2 = domain \\3 = request_uri Jim Lucas - Original Message - From: "J. Younker" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 05, 2002 8:22 AM Subject: [PHP] Regular Expressions Help > Hi, > I'm trying to use eregi_replace to check a user-submitted URL, but I > keep getting the following error message: > Warning: Invalid range end in /var/www/html/_db_db/db_input.php > This what I'm using: > $pattern = "(http://)?([^[:space:]]+)([[:alnum:]\.-_?/&=])"; > $replace = "http://\\2\\3";; > $URL = eregi_replace($pattern, $replace, $URL); > I've stared at this expression for too long and can't figure out what's > wrong. > Thanks, > J. Younker > > -- > 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] what is the format of the filemtime string
the date() function takes two arguments. $date_time_format = "m-d-Y"; echo date($date_time_format, $unix_time_string); Jim Lucas - Original Message - From: "_michael" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 05, 2002 11:15 AM Subject: RE: [PHP] what is the format of the filemtime string > tight i have tried what you said: > > $last_mod = filemtime($file); > $tdate = date($last_mod); > > but now the output is in this format - c707-b076 > > sorry to be ask again but can you give me more of a clue as you've probably > guessed - i'm a novice > > thanks > > > -- > 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] mail() problem
you might want to test with a hotmail account as the return email address and find out if they are bouncing your email. I had this problem once, and in the return email it told me that I had miss formed headers. I got an error 550 from the mail server. you might try setting in the headers of you mail that you are sending, a) the content type, b) bit number 8bit, 7 bit, etc... that solved the problem for me. Jim Lucas - Original Message - From: "César L. Aracena" <[EMAIL PROTECTED]> To: "PHP General List" <[EMAIL PROTECTED]> Sent: Wednesday, June 05, 2002 9:29 AM Subject: [PHP] mail() problem Hi all, I have this strange problem where I can send e-mails from a PHP script to a common e-mail address such as Hotmail's, but I can't send to my ISP-given e-mail address (@infovia.com.ar). Does anyone happen to know why is it that makes it different??? Thanks, Cesar Aracena [EMAIL PROTECTED] Neuquen, Argentina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() problem
you miss understood what I was saying. I said to have your hotmail account setup as the return email address and then send mail to you ISP. if the mail bounces it will be returned to your hotmail account instead of your ISP. if you do receive the mail returned to your hotmail account. it should give you some insight on what is going on with the error messages included in the return mail. Jim Lucas - Original Message - From: "César L. Aracena" <[EMAIL PROTECTED]> To: "PHP General List" <[EMAIL PROTECTED]> Sent: Wednesday, June 05, 2002 8:42 PM Subject: RE: [PHP] mail() problem Ok. I've done everything that all of you told me to do, but still can't get to send e-mails to my ISP's mail address. I did all of the following: a) Append a Reply-To: [EMAIL PROTECTED] (Actually, it's [EMAIL PROTECTED] ) b) Send the e-mail to my Hotmail account, but everything seems fine. The address shown at the From: line is even the one I used in the Script. c) Because I have placed the Script into a server and not a local machine, asked the sysadmin to check the php.ini file and so but nothing. This step is crucial for my scripting and because all of my clients live here, most of them use the same ISP and have to get their e-mails. Actually, I didn't know how to change the content-type for my e-mail in order to do some testing. Can anyone help me with this? Might be my last chance... Thanks in advance, <mailto:[EMAIL PROTECTED]> César Aracena IS / MCSE+I Neuquén, NQN (0299) 156-356688 (0299) 446-6621 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex
$file = preg_replace('/^([a-z0-9\-\_]*).([a-z]{3,4})$/i', $new_file . ".$2", $_FILES['upload']['name']); Maybe this? Jim Lucas - Original Message - From: "Gerard Samuel" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> Sent: Tuesday, June 11, 2002 3:11 PM Subject: [PHP] regex > Im expecting a string like foo.png. > Im trying to replace 'foo' with another value that I have. > Im trying this -> > $file = preg_replace('/([a-z][0-9]-_*)(.[a-z]{3,4})/i', $new_file . > "$2", $_FILES['upload']['name']); > > The second regex group works ok, its the first one I cannot figure out. > It is supposed to contain alpha numeric characters and '_' and '-'. > Thanks for any input. > > -- > Gerard Samuel > http://www.trini0.org:81/ > http://dev.trini0.org:81/ > > > > -- > 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] include_once("blah"); vs $blah="blah"; include($blah);
is your isp using a unix machine or windows machine? if they are using a unix box then your backslash needs to be a forward slash "/", and if they are using a windows machine, your backslash needs to be escaped. --> "\\" other wise you are escaping the "b" in blah... Jim Lucas - Original Message - From: "Martin Towell" <[EMAIL PROTECTED]> To: "'Henry'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, June 11, 2002 4:31 PM Subject: RE: [PHP] include_once("blah"); vs $blah="blah"; include($blah); > if that's a direct copy of what you've got, then the parse error's probably > to do with the "var" and not the "include_once" > > "var" is used only in classes... > > -Original Message- > From: Henry [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 11, 2002 11:11 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] include_once("blah"); vs $blah="blah"; > include($blah); > > > I did as you suggest with an interesting result: > > include_once "blah.php"; > > worked > > var $blah="blah.php"; > include_once $blah; > > gave the following error: > > Parse error: parse error in on line > > > Where the is the file that was doing the include! > > > > Previously include_once($blah) just messed up the scoping and global vars! > > Henry > > "Jonathan Rosenberg" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Out of curiosity, try > > > > > global $root; > > $blah="include\blah.php"; > > include_once $blah; > > ?> > > > > & see if it behaves differently (i.e., no parens around the > > include file name). > > > > > -Original Message- > > > From: Henry [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, June 11, 2002 8:15 AM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] include_once("blah"); vs $blah="blah"; > > > include($blah); > > > > > > > > > My web hosting company is running php 4.0.4pl1 > > > > > > Why should it be that these are different > > > > > > > > > > > global $root; > > > include_once("include\blah.php"); > > > > > > ?> > > > > > > and > > > > > > > > > > > global $root; > > > $blah="include\blah.php"; > > > include_once($blah); > > > > > > ?> > > > > > > When I say different I mean; > > > > > > 1) global variable are not avaiable in the second version > > > 2) functions defined in the included file are not > > > accessable in the > > > including file. > > > 3) in both examples the file is included, its just the > > > scope that seem shot > > > > > > Any answers? > > > > > > Henry > > > > > > > > > > > > > > > -- > > > 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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] get pwd on windows
what does $GLOBALS['DOCUMENT_ROOT'] return? Jim Lucas - Original Message - From: "Lazor, Ed" <[EMAIL PROTECTED]> To: "'Shane Wright'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, June 11, 2002 4:35 PM Subject: RE: [PHP] get pwd on windows > Will getcwd() work for you? > > Also, try phpinfo() to find out which variables are set. > > -Original Message- > From: Shane Wright [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 11, 2002 10:45 AM > To: [EMAIL PROTECTED] > Subject: [PHP] get pwd on windows > > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi > > Ok, I need to write this little script to run on a Windows box (don't > ask...), > but I'm getting completely shafted by the inconsistent use of long > filenames. > > I need to get the current directory, but it must have long filenames and not > > be chopped to xxx~1 or anything. $SCRIPT_FILENAME is not set, there is no > pwd utility, nothing is set in the environment and realpath('./') returns > cropped firectory names. > > Is there a way to do this or am I condemned to bang my head against a wall > and > swear some more? > > Cheers > > - -- > Shane > http://www.shanewright.co.uk/ > Public key: http://www.shanewright.co.uk/files/public_key.asc > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.0.7 (GNU/Linux) > > iD8DBQE9Bjcw5DXg6dCMBrQRAjjbAJ4iz2jRJ5rMzkV7Md5GHpTd3YcX1wCfZb6B > 44Qwj0u6jdfNpGtf+LTEX+w= > =HgUp > -END PGP SIGNATURE- > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > This message is intended for the sole use of the individual and entity to > whom it is addressed, and may contain information that is privileged, > confidential and exempt from disclosure under applicable law. If you are > not the intended addressee, nor authorized to receive for the intended > addressee, you are hereby notified that you may not use, copy, disclose or > distribute to anyone the message or any information contained in the > message. If you have received this message in error, please immediately > advise the sender by reply email and delete the message. Thank you very > much. > > -- > 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] php & JavaScript
nope, theres nothing in apache that needs to be setup for js to be used. does your js file have any php in it? when you say that you couldn't get it to work, do you mean that the include doesn't work or that the js doesn't work on the page that you are including it to? Jim Lucas - Original Message - From: "Luis Miguel N. Tavora" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, June 24, 2002 4:28 AM Subject: [PHP] php & JavaScript > Hi there. > > I've tried to include a simple javascript in a .php file, > but couldn't get it to work. > > Actually not even the php code worked at all... > > Is there any specific configuration flag that needs to be > set up in the Apache server so that the javascripts work > correctly? > > Thanks in advance > > Luis > > PS- Btw, I use an Apache server on a RH72 machine > > > > -- >Luis Miguel N. Távora >[EMAIL PROTECTED] > > Message sent via Sylpheed > sylpheed-claws.sourceforge.net > -- > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] rounding a number
seems to work fine for me. what are your results when you do this? mine are 0.4 and this is what is should be. if it were .349 it would round down. isn't this how it should work? What were your results? Jim Lucas - Original Message - From: "George Whiffen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, June 24, 2002 2:36 AM Subject: Re: [PHP] rounding a number > Jason Wong wrote: > > > On Monday 24 June 2002 11:34, Phil Schwarzmann wrote: > > > I want to round a number to the nearest decimal place... > > > > > > if the number is 4.623, I want it to display 4.6 > > > if the number is 2.36, I want it to display 2.7 > > > > You don't really mean 2.36 --> 2.7 ?? > > > > > Is there a function that does this? round(), ceil(), floor() don't do > > > this and I've checked through all the math functions in my handy-dandy > > > "PHP Functions" reference book. > > > > round() seems to work. What's the problem you're having? > > > > It's worth noting that round doesn't always work e.g. > > try round(0.35,1) > > > > > > > -- > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > Open Source Software Systems Integrators > > * Web Design & Hosting * Internet & Intranet Applications Development * > > > > /* > > That's no moon... > > -- Obi-wan Kenobi > > */ > > > -- > 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] php & JavaScript
check out the reply he sent to my last message. it had the code as an attachment. Jim Lucas - Original Message - From: "David Freeman" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, June 24, 2002 2:25 PM Subject: RE: [PHP] php & JavaScript > > I've tried to include a simple javascript in a .php file, > > but couldn't get it to work. > > > > Actually not even the php code worked at all... > > > > Is there any specific configuration flag that needs to be > > set up in the Apache server so that the javascripts work > > correctly? > > Not particularly, but if you could show some sample code of what you're > doing... > > FWIW, I include javascript stuff in my php all the time. > > CYA, Dave > > > > > -- > 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] viewing php predefined fucntions
here is a quicky that I wrote up to do just that Jim Lucas - Original Message - From: "Anil Garg" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, July 01, 2002 10:52 AM Subject: [PHP] viewing php predefined fucntions > Hi, > at this link: > http://www.php.net/manual/en/funcref.php > i can see the categories of the available functions, But > How can i see all the fucnctions in php together (in one screen)? > Is there a way to do that. > Thank You > anil > > > -- > 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] Passing variables
Because the session is not being started on the second page. to be able to get the contents of a variable that is in a session environment, you must first initiate sessions with the call session_start(); even if that is all you do before referancing the varialble. so, add session_start(); just after entering the second script and is should work. if it doesn't, if you have php 4.1.0 or newer use $_SESSION['course'] if older version you are working with, use $HTTP_SESSION_VARS['course'] . Hope this helps. Jim Lucas - Original Message - From: "Anthony Rodriguez" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, July 08, 2002 5:40 AM Subject: [PHP] Passing variables > Dear Justin, > > After reading Kevin Yank's "Managing Users ..." at www.sitepoint.com, I > tried the following 2 scripts. Unfortunately, the variable $course is NOT > being passed to the 2nd script. Thus, per the script, the Home page is > displayed. Why? > > --- 1st script --- > > // file: "root/reg_users_2.php", updated: 07/08/02 > set_time_limit(300); > session_start(); > session_register("course"); > $course="stats_101"; > header ("location:estadisticas/contents.php"); > flush(); > exit; > ?> > > --- 2nd script --- > > // file: "root/estadisticas/contents.php", updated: 07/06/02 > set_time_limit(300); > if ($course!="stats_101") > { > header("location:../index.htm"); // Home page > flush(); > exit; > } > else > { > echo " > > > --- HTML code here --- > > > > "; > }; > flush(); > exit; > ?> > > Thanks! > > Tony > > > > -- > 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] Session problems with popup window
pass the user id to the page as a url variable. maybe set a unique cookie name for that value that won't get destroyed when the person logs out. Jim Lucas - Original Message - From: "Michael Champagne" <[EMAIL PROTECTED]> To: "PHP General Mailing List" <[EMAIL PROTECTED]> Sent: Monday, July 08, 2002 8:18 AM Subject: [PHP] Session problems with popup window > I can't seem to find an elegant solution to this and was hoping you guys could > offer some insight. > > We are using sessions on our webpage and one of the links on our main page, > launches a separate popup window which has some PHP on it and contains some > java applets which launch our web-based trading application. The thing is > that part of this page requires that we have the user ID for a database lookup > which is part of the user's session data. Basically, it lets the user refresh > a directory to see if a file is there and available for download. If the user > logs out in the main window, we lose this session data and the user ID and the > page chokes because it cannot find the user directory because we've lost the > user ID. > > Does anyone have any ideas how we can get around this? Thanks in advance for > any replies -- this mailing list has been a huge help for us. > > -- > Michael Champagne, Software Engineer > Capital Institutional Services, Inc. > wk: [EMAIL PROTECTED] > hm: [EMAIL PROTECTED] > > > > ** > This communication is for informational purposes only. It is not > intended as an offer or solicitation for the purchase or sale of > any financial instrument or as an official confirmation of any > transaction, unless specifically agreed otherwise. All market > prices, data and other information are not warranted as to > completeness or accuracy and are subject to change without > notice. Any comments or statements made herein do not > necessarily reflect the views or opinions of Capital Institutional > Services, Inc. Capital Institutional Services, Inc. accepts no > liability for any errors or omissions arising as a result of > transmission. Use of this communication by other than intended > recipients is prohibited. > ** > > -- > 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] isset
what is it you are testing for? a page that has been submitted. do you mean from an html form or some other method? Jim Lucas - Original Message - From: "Preston Wade" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 09, 2002 3:20 PM Subject: [PHP] isset > Hello All, > > I am trying to use the isset function to test if the page has been > submitted, but it seems as though it is not working. I am wondering is > there a configuration option that is messing with the functionality of > isset. > > Any help would be appreciated. > > Thanks, > Preston Wade > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] array-problems
Try this: <<< BEGIN:PHP-CODE >>> $result = mysql_query ("SELECT DISTINCT date FROM linktracker WHERE name LIKE '$PHP_AUTH_USER' GROUP BY date ORDER BY date"); if (mysql_num_rows($result)) { for($i=0;$i array($i => $row["date"]), "end" => array($i => $row["date"]) ); } } else { print ("Sorry, no record were found."); } function drawSelect($which) { global $date; foreach($date[$which] AS $date_begin) { ?> Begindate Enddate <<< END:PHP-CODE >>> btw - you need to watch your closing '>' you are missing a few. Plus to get distince to work right you need to use the "GROUP BY" clause. Jim - Original Message - From: "Bart Verbeek" <[EMAIL PROTECTED]> To: "Php-General-list" <[EMAIL PROTECTED]>; "PHP-DB mailinglist" <[EMAIL PROTECTED]> Sent: Wednesday, October 24, 2001 12:23 PM Subject: [PHP-DB] array-problems > Hello, > Can anyone help me with this script I'm using? > > I've saved dates in a database and want to make two select-lists of these > dates in a html-form. > I want to select each unique date one time (no doubles). > List 1 is used to set the begin-date of the query for the report, List 2 > will > set the end-date and must be reversed. > When the form is processed the data selected between the begin-date and the > end-date has to be show. > > I can't seem to get my code to work: the select-lists stay empty after > processing the code below. > > Can anyone help? Tips... > > regards, > > Bart > > > <<< BEGIN:PHP-CODE >>> > $i=0; > $result = mysql_query ("SELECT DISTINCT date FROM linktracker WHERE name > LIKE '$PHP_AUTH_USER' ORDER BY date"); > if ($row = mysql_fetch_array($result)) { > do { > $date = array( > "begin" => array($i => $row["date"]), > "end" => array($i => $row["date"]) > ); > $i++; > } while ($row = mysql_fetch_array($result)); > } else {print ("Sorry, no record were found."); > } //end else $result > > print("BegindateEnddate\n". > " name=\"date_select\">". > " value=\"date_select\">". > ""); > > while (list($key, $date_begin) = each($date[begin])) { > echo "" . $date_begin . > "\n"; > } > > print(""); > > rsort($date[end]); > > while (list($key, $date_end) = each($date[end])) { > echo "" . $date_end . > "\n"; > } > > print("\n". > "". > ""); > > mysql_free_result ($result); > mysql_close(); > <<< END:PHP-CODE >>> > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Trying to subtract...no luck. (Long Code)
one problem on the second script you are trying to use variables that are in an array. if this is where you are talking about you need to specify the array[key] > while ($myrow=DB_fetch_array($result)){ > > > $difference = ($budget - $actual); $difference = ($myrow[budget] - $myrow[actual]); > > > printf("%s%s%s%s%s%s To: " "Php-General@Lists. Php. Net"" <[EMAIL PROTECTED]> Sent: Wednesday, October 24, 2001 1:18 PM Subject: [PHP] Trying to subtract...no luck. (Long Code) > Hi. I'm trying to figure out how to subtract 1 variable from another, but > I'm not having any luck. > > It works on this page: > > > > $db_name = "comanche"; > $table_name = "ProjectTasks"; > > $connection = @mysql_connect("$db","$user","$pass") or die("Couldn't > Connect."); > $db = @mysql_select_db($db_name, $connection) or die("Couldn't select > database."); > > $sql ="SELECT budget,actual FROM $table_name"; > > $result = @mysql_query($sql, $connection) or die("Couldn't execute query."); > > while ($row = mysql_fetch_array($result)) { > $budget=$row['budget']; > $actual=$row['actual']; > $difference = ($budget - $actual); > > > echo "$budget - $actual = $difference"; > > } > > > $num = @mysql_num_rows($result); > > ?> > > > But not on this page: > > ---BEGIN LONG PHP STUFF -- > > > > $title = "Tasks Maintenance"; > include("../inc/hdr.php"); > include("header.inc"); > include("DateFunctions.inc"); > > > if (!isset($ProjectID)){ > > echo "This page must be called from the projects list page with the > tasks link. Alternatively, you can enter the link as > Tasks.php?ProjectID=ProjectID numberProject List"; > exit; > } > > if ($submit) { > > //initialise no input errors assumed initially before we test > $InputError = 0; > > /* actions to take once the user has clicked the submit button > ie the page has called itself with some user input */ > > //first off validate inputs sensible > > if (strlen($TaskName) > 50 OR strlen($TaskName)==0) { > $InputError = 1; > echo "The task name must be entered and be fifty characters or > less long"; > } elseif (!is_date($EarliestStart)) { > $InputError = 1; > echo "The date the task was initiated must be specified in the > format dd/mm/"; > } elseif (!is_numeric($ExpectedDuration) || $ExpectedDuration<0){ > $InputError = 1; > echo "The expected duration of the task must be specified as a > number - greater or equal to 0"; } > > > if ($InputError !=1){ > > $SQL_EarliestStart = FormatDateForSQL($EarliestStart); > > if (isset($SelectedTask)) { > > > > $sql = "UPDATE ProjectTasks SET TaskName='$TaskName', > TaskDescription='$TaskDescription', EarliestStart='$SQL_EarliestStart', > TaskChampion='$TaskChampion', ExpectedDuration=$ExpectedDuration, > Status='$Status', budget='$budget', actual='$actual' WHERE TaskID = > $TaskID"; > > $result = DB_query($sql,$db); > if (DB_error_no($db) !=0) { > echo "The task could not be updated because - " . > DB_error_msg($db) . " The SQL statement used for the update was:$sql"; > } else { > echo "task updated"; > unset($SelectedTask); > unset($TaskName); > unset($TaskDescription); > unset($TaskChampion); > unset($EarliestStart); > unset($ExpectedDuration); > unset($Status); > unset($budget); > unset($actual); > } > > } else { //not a new task > > > > $sql = "INSERT INTO ProjectTasks (ProjectID, TaskName, > TaskDescription, EarliestStart, TaskChampion, ExpectedDuration, Status, > budget, actual) VALUES ($ProjectID, '$TaskName', '$TaskDescription', > '$SQL_EarliestStart', '$TaskChampion', $ExpectedDuration, '$Status', > '$budget', '$actual')"; > > $result = DB_query($sql,$db); > if (DB_error_no($db) !=0) { > echo "The task could not be added because - " . > DB_error_msg($db) . " the SQL used to insert the new task was:" . $sql; > } else { > echo "Task inserted"; > unset($TaskName); > unset($TaskDescription); > unset($TaskChampion); > unset($EarliestStart); > unset($ExpectedDuration); > unset($Status); > unset($budget); > unset($actual); > } > } > } else { > echo "Validation failed, no updates or deletes took place."; > } > > } elseif ($delete) { > //the link to delete a selected record was clicked instead of the submit > button > > $sql="DELETE FROM ProjectTasks WHERE TaskID=$TaskID"; > $result = DB_query($sql,$db); > > $sql="DELETE FROM TaskDependancies WHERE TaskID=$TaskID"; > $result = DB_query($sql,$db); > > $sql="DEL
Re: [PHP] Making a string from an Array
try this out $words = explode(" ", $keywordText); $compare = array('on', 'the', 'in', 'at', 'is', 'it'); foreach ($words AS $value) { if (in_array($value, $compare)) { $ignored[] = $value; } else { $included[] = $value; } } Jim Lucas - Original Message - From: "Sam" <[EMAIL PROTECTED]> To: "'php'" <[EMAIL PROTECTED]> Sent: Thursday, October 25, 2001 8:17 AM Subject: [PHP] Making a string from an Array > Hi all, > this may be an easy question, but I'm stuck... > > how can this, > > $words = explode(" ", $keywordText); > > for ( $i = 0; $i < count( $words ); $i++ ) > { > if ($words[$i]=="on" OR $words[$i]=="the" OR $words[$i]=="in" > OR$words[$i]=="at" OR $words[$i]=="is" OR $words[$i]=="it") > { > $ignored[] = $words[$i]; > } > else > { > $included[] = $words[$i]; > } > } > > How can I make $included and $ignored a string instead of an array. > > Thanks > Sam Rose > > p.s. Also I'm only on the digest, so if you could reply directly to me as > well, that would be a bonus. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] while() looping over query results twice?
I notice that you are concatinating then each time. try setting them to ="" before using them $companyID_string = ""; $companyName_string = ""; then: while() { $companyID_string .= "," . $query_data[0]; $companyName_string .= "," . $query_data[1]; } Jim ps. try using the mysql_fetch_array() and calling to the vars as $query_data[] instead. - Original Message - From: "Kurt Lieber" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 25, 2001 12:51 PM Subject: [PHP] while() looping over query results twice? > I'm executing a query that returns some a UID and a company name. I'm using > the following code to loop over that query result set: > > $result = mysql_query($myQuery) //$myQuery gets defined earlier > $resultCount = mysql_num_rows($result); > $companyID = array(); > while($query_data = mysql_fetch_row($result)) { > $companyID[$query_data[0]] = $query_data[1]; > $companyID_string .= "," . $query_data[0]; > $companyName_string .= "," . $query_data[1]; > } > > I've used $resultCount to verify the query is returning 4 rows. However, the > while loop above is looping over the results twice -- $companyID_string and > $companyName_string each have 8 values. Looking at the values shows that > it's the 4 rows duplicated. > > What the heck am I doing wrong? > > --kurt > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] while() looping over query results twice?
what I guessed was that you were using the variables somewhere else in the script above this code. then you were adding on to them again. without resetting them to blank. Are you using these vars somewhere else (above this) in your code? jim - Original Message - From: "Kurt Lieber" <[EMAIL PROTECTED]> To: "Jim Lucas" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, October 25, 2001 1:17 PM Subject: Re: [PHP] while() looping over query results twice? > OK, so I defined the variables before using them and that solved the problem. > (Thanks!) > > I'm still curious as to why not defining them ahead of time would cause the > data within each string to get duplicated. In other words, if the query > results are "a,b,c,d", then by not defining the variable ahead of time > produces "a,b,c,d,a,b,c,d" which is weird. > > At this point, my problem is solved, so this is more of an academic question > than anything. > > Thanks for the help. > > --kurt > > On Thursday 25 October 2001 13:03, Jim Lucas wrote: > > I notice that you are concatinating then each time. try setting them to > > ="" before using them > > > > $companyID_string = ""; > > $companyName_string = ""; > > then: > > while() > > { > > $companyID_string .= "," . $query_data[0]; > > $companyName_string .= "," . $query_data[1]; > > } > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Setting A MySQL Column to NO DUPLICATES
are you trying to have one column not be a dup or a combination of columns? jim - Original Message - From: "Jeff Gannaway" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 25, 2001 2:31 PM Subject: [PHP] Setting A MySQL Column to NO DUPLICATES > Does anyone know how to set a column in a MySQL table to disallow any > duplicate entries. > > I've already got a PRIMARY KEY defined for this table. I tried setting the > other field to a MUL KEY, hoping that it would not permit duplicates, but > it does. > > I've searched the MySQL docs without success. I wish their site was a good > as PHP.net. > > Later, > Jeff Ganaway > ___ > > Save 15% on 2002 Calendars and Holiday Cards! > > http://www.AvantGifts.com > Discount Code: hopper22ct > Offer Good Through October 31, 2001 > ___ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] account for missing/optional arguments in functions?
function foo($arg1, $arg2="") // or you can replace the "" with array() { blah } Jim - Original Message - From: "Kurt Lieber" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 25, 2001 3:57 PM Subject: [PHP] account for missing/optional arguments in functions? > Is it possible to account/trap missing arguments in functions? > > For instance, say I have a function foo: > > function foo($arg1,$arg2) { blah } > > If someone calls that function as: > > foo($arg1); > > Can I somehow code around the fact that $arg2 is missing? I've tried: > > function foo($arg1,$arg2) { > if (!isset($arg2) { $arg2=0 } > } > > But that doesn't work. However, that's the sort of functionality I'm looking > for -- is there a way to do it? > > Thanks. > > --kurt > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Q:Syntax for a space? ...like \n is for new line???
the bad thing about using the "#&160", mac user won't be able to view this. mac uses a different ASCII set 160 isn't a space :) Jim - Original Message - From: "Steve Werby" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, October 25, 2001 4:06 PM Subject: Re: [PHP] Q:Syntax for a space? ...like \n is for new line??? > "Marcus James Christian" <[EMAIL PROTECTED]> wrote: > > How do you call for a space in an email put out by mail(); ? Similar > > to the way we call \n newlines with backslash n?? > > Within an email create a space by typing " " or ' '. If you want 10 spaces > do str_repeat( ' ', 10 ). If you wanted to create a space within HTML I'd > suggest using " " (some people prefer " "), but if you do that > within the body of a text email it should display the actual characters, not > the text, so that won't get you the desired behavior. > > HTH, > > -- > Steve Werby > President, Befriend Internet Services LLC > http://www.befriend.com/ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: is there a commandline php.exe interpreter?
try this ", $output); echo $output; ?> make sure you put the correct paths to the .exe and file otherwise it will think that it is realtive to where you are in the file system. Jim - Original Message - From: "John A. Grant" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 25, 2001 6:07 AM Subject: [PHP] Re: is there a commandline php.exe interpreter? > "John A. Grant" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I've installed ActivePerl, which gives me a way to run .pl files, > > i.e. : > > c:\> perl someprogram.pl > > > > Does the Win32 php installation give me a command-line > > interpreter like that? > [...] > No replies. I guess not, just server-based... :( > > -- > John A. Grant * I speak only for myself * (remove 'z' to reply) > Radiation Geophysics, Geological Survey of Canada, Ottawa > If you followup, please do NOT e-mail me a copy: I will read it here > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] checkboxes
function jsFunc() { // then check the status of the checkbox if (checked) { run this } else { run this } } onClick="jsFunc()" Jim Lucas - Original Message - From: "Johnson, Kirk" <[EMAIL PROTECTED]> To: "PHP General (E-mail)" <[EMAIL PROTECTED]> Sent: Friday, October 26, 2001 2:06 PM Subject: RE: [PHP] checkboxes > onClick > > Kirk > > > -Original Message- > > From: Boaz Yahav [mailto:[EMAIL PROTECTED]] > > Sent: Friday, October 26, 2001 3:03 PM > > To: PHP General (E-mail) > > Subject: [PHP] checkboxes > > > > > > does anyone know the HTML event that knows when a checkbox has been > > checked and unchecked? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] how to recognize local or server execution?
use $GLOBALS[SERVER_ADDR] it will return the IP address of the server. then use that in an if..then..else Jim - Original Message - From: "John A. Grant" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, October 26, 2001 2:18 PM Subject: [PHP] how to recognize local or server execution? > I have an xxx.php page that runs on my Unix server. I also > run php.exe on my NT box to generate the corresponding > xxx.html file like this: > c:\> php -q xxx.php > xxx.html > > The xxx.php file contains stuff like this: > print "hello\n"; > > That means stdout from the server and the xxx.html file > both contain \n. I would like the xxx.html file to contain > \r\n so it can be viewed/edited with notepad. Yes, > notepad and \r\n both suck, but that's another story... > > So I guess I would like my code to look like this: > if(running php.exe on my NT box){ > $delimiter="\r\n"; > }else{ > $delimiter="\n"; > } > > and then my code looks like: > print "hello$delimiter"; > > How can I do this? > > -- > John A. Grant * I speak only for myself * (remove 'z' to reply) > Radiation Geophysics, Geological Survey of Canada, Ottawa > If you followup, please do NOT e-mail me a copy: I will read it here > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] session_star() problem
this means that on line 8 of the product_list.php file, you are sending something to the browser with print() echo or ?>something To: <[EMAIL PROTECTED]> Sent: Friday, October 26, 2001 3:07 PM Subject: [PHP] session_star() problem > Ok I am starting on small web site and using PHP 4 on Apache with FreeBSD > 4.4 as the OS. I need to use sessions to pass some info around between > pages but when I use session_start() I get the error msg below. > > Warning: Cannot send session cookie - headers already sent by (output > started at /usr/home/gate/public_html/product_list.php:8) in > /usr/home/gate/public_html/product_list.php on line 9 > > Warning: Cannot send session cache limiter - headers already sent (output > started at /usr/home/gate/public_html/product_list.php:8) in > /usr/home/gate/public_html/product_list.php on line 9 > > I get this msg if it is the only thing in the php script as well as if it is > in an actually script that I am using. Maybe I don't php set up right or > something else.Could some one please put me in the right direction. > > Greg > > please reply to my email as well as the newsgroup > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] show png in the browser
what type of browser are you using to view this image? jim - Original Message - From: "Luz Lopez" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 31, 2001 1:56 AM Subject: Re: [PHP] show png in the browser > Hi David, of course, I send of header: header("Content-type: image/png"); > But the send me to save the file > > Thanks, > > Regards, > > > > >From: David Robley <[EMAIL PROTECTED]> > >Reply-To: [EMAIL PROTECTED] > >To: "Luz Lopez" <[EMAIL PROTECTED]>, [EMAIL PROTECTED] > >Subject: Re: [PHP] show png in the browser > >Date: Wed, 31 Oct 2001 11:28:02 +1030 > > > >On Wed, 31 Oct 2001 11:08, Luz Lopez wrote: > > > Hi All > > > > > > I configured the php with thelibrary GD, zlib, jpeg and libpng, I hae a > > > program that generate a image, I can to save this png image but in my > > > borwser I can't to see this image, the browser send me to save to my > > > hard disk this image. > > > > > > I need to show this image in the browser, How can I do it? > > > > > > Thanks in Advanced, > > > > > > Regards, > > > >You may need to send a header including the correct mime type. > > > >-- > >David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc > >CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA > > > >Help endangered species - adopt a KGB operative. > > > _ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php & mysql prob...
mysql_error() and mysql_errno() return the value. $error = mysql_error($dblink); $errno = mysql_errno($dblink); or echo mysql_error($dblink); echo mysql_errno($dblink); jim - Original Message - From: "sc" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, October 30, 2001 6:01 PM Subject: Re: [PHP] php & mysql prob... > ok i thought it would be working, but on testing it more it still isn't > going for me i took off the ' ' from the table name and its still coming > up with an error on line 17 with the same error message... the mysql_error() > isn't echoing anything that has gone wrong.. (did before).. > > Any ideas? > > thx. > > -sc > "Jason Brooke" <[EMAIL PROTECTED]> wrote in message > 043f01c161a9$bf8d99a0$0100a8c0@co3040297a">news:043f01c161a9$bf8d99a0$0100a8c0@co3040297a... > > Or the single quotes around the table name in the sql string > > > > > > > Your query is probably broken - do some error checking after your > > > database call with mysql_error() and see what the problem is. > > > > > > Guess; the table name. > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php & mysql prob...
are you pass the two functions you return link from mysql_connect() or mysql_pconnect() ?? jim - Original Message - From: "sc" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, October 30, 2001 6:15 PM Subject: Re: [PHP] php & mysql prob... > mysql_error returns nothing, mysql_errno returns 0 > "Jim Lucas" <[EMAIL PROTECTED]> wrote in message > 03ad01c161b0$026caee0$[EMAIL PROTECTED]">news:03ad01c161b0$026caee0$[EMAIL PROTECTED]... > > mysql_error() and mysql_errno() return the value. > > > > $error = mysql_error($dblink); > > $errno = mysql_errno($dblink); > > or > > echo mysql_error($dblink); > > echo mysql_errno($dblink); > > > > jim > > - Original Message - > > From: "sc" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, October 30, 2001 6:01 PM > > Subject: Re: [PHP] php & mysql prob... > > > > > > > ok i thought it would be working, but on testing it more it still isn't > > > going for me i took off the ' ' from the table name and its still > > coming > > > up with an error on line 17 with the same error message... the > > mysql_error() > > > isn't echoing anything that has gone wrong.. (did before).. > > > > > > Any ideas? > > > > > > thx. > > > > > > -sc > > > "Jason Brooke" <[EMAIL PROTECTED]> wrote in message > > > 043f01c161a9$bf8d99a0$0100a8c0@co3040297a">news:043f01c161a9$bf8d99a0$0100a8c0@co3040297a... > > > > Or the single quotes around the table name in the sql string > > > > > > > > > > > > > Your query is probably broken - do some error checking after your > > > > > database call with mysql_error() and see what the problem is. > > > > > > > > > > Guess; the table name. > > > > > > > > > > > > > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: Re[2]: [PHP] split array in 2 halfs
take a look at the manual http://www.php.net/manual/en/function.array-slice.php it will show you the right way to do it jim - Original Message - From: "Daniel Harik" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 31, 2001 11:25 PM Subject: Re[2]: [PHP] split array in 2 halfs > Want to split it in half > > 1 Big array: > > 1 > 2 > 3 > 4 > 5 > 6 > > Want to make > > > 1 Small array: > > 1 > 2 > 3 > > 2 Small array: > 4 > 5 > 6 > > Thank You > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] submitting form to a page with frames
try using the $GLOBALS[variable_name] array. Jim - Original Message - From: "Matt Fair" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, November 01, 2001 3:08 PM Subject: [PHP] submitting form to a page with frames > I have 2 pages page1.php and page2.php. I want to submit the form and > its values to page2.php. page2.php has frames: > > > > > How can I get the variables that were submitted from page1.php into the > menuFrame? When I do this it doesn't get any php variables, but if I > take it out of the frame it works fine. > Thanks in advance, > Matt > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Where is my php.ini?
most of my installs, Redhat linux 7.0 and 7.1, have placed the php.ini file in the /etc/php.ini location. what version of linux are you using? Jim - Original Message - From: "Gaylen Fraley" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, November 01, 2001 3:16 PM Subject: [PHP] Where is my php.ini? > Ok. I've installed php on linux and all is well! Been running for weeks > now. Problem is, I never had to set up my php.ini . Got curious and am > wondering where it is. Locate php.ini yields one in the pear/tests > directory, but that's not it. Suggestions? > > -- > Gaylen > [EMAIL PROTECTED] > Home http://www.gaylenandmargie.com > PHP KISGB v2.21 Guestbook http://64.133.20.82/phpwebsite > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Array HELP PLEASE
read this page a little closer! http://www.php.net/manual/en/function.mysql-fetch-array.php the mysql_fetch_array(); does not pull all the results in one big array. it IS only a single row of data. try this out, it should do what you are looking to do. $results = mysql_query("SELECT * FROM models WHERE lang='$lang' AND key1='data' AND key2='$series'",$db); while ($models = mysql_fetch_array($results)) { echo $models .""; } Jim - Original Message - From: "René Fournier" <[EMAIL PROTECTED]> To: "Php-General" <[EMAIL PROTECTED]> Sent: Thursday, November 08, 2001 2:25 PM Subject: [PHP] Array HELP PLEASE > (Before you write RTFM, please know that I have checked www.php.net, > zend.com, phpbuilder.com, et all, and--in the eternal words of Bono--I still > haven't found what I'm looking.) > > The situation: I extract an array from a MySQL table. Code: > > $models = mysql_fetch_array(mysql_query("SELECT * FROM models WHERE > lang='$lang' AND key1='data' AND key2='$series'",$db)); > > Based on the above criteria, there should be two rows in $modelsrow, with > each row containing about twenty elements. (A two-dimensional array, > right?) All I want to do is display the contents of $models. With the > following... > > for ($i = 1; $i <= 20; $i++) { > echo $models[$i].""; > } > > ...I get just one row. How can I also display the other row? I've tried > variations of $models[1][2], but I just can't get right syntax. (Help is > much appreciated. Thanks.) > > If you know of a good tutorial on multidimension arrays + mySQL, that would > be nice too. > > ...Rene > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Including declare statements that contain variables
Here are a few pointers to make it run just a little faster also. don't extract the entire $GLOBALS array. just use the $var that you need. function GetData($Query) { return(mysql_query($Query, $GLOBALS[db_conn])); } another thing would be to build a wrapper function for mysql_query() and have it display your error code/problems. why are you using a define to set an SQL query string? Jim - Original Message - From: "Fred" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 14, 2001 9:45 AM Subject: [PHP] Including declare statements that contain variables > I would like to offer my recent experience in the hope that it will help > others avoid the wasted effort and frustration I managed to burden myself > with yesterday. I will start by stating that the conclusions I have drawn > may seem obvious at first blush, however in a troubleshooting environment it > is sometimes difficult to see the forest for the trees. This is > particularly true when several principles of PHP syntax are working in > concert to produce a problem. > > My problems started when I found myself in the rare position of needing to > write a function that accessed global variables rather than passed values or > references. This need arose because I was writing a data access abstraction > function and would have no way of knowing in advance what variables would > need to be accessed or in what order. The total number of possible > variables was large when compared with the total number of lines of code in > the function. If I had chosen to write the function to accept an > associative array that could be extracted within the function to produce the > needed variables the total number of lines of code needed outside of the > function to produce the array would have been greater than the total number > of lines of code within the function. > > Because the purpose of choosing to use a function rather than writing the > code several times was to reduce the number of lines of code and provide > clarity to the script I decided that passing an array to the function was > not an option. > > I decided to simply write the function so that it had access to all > variables in the GLOBALS array to overcome this problem. The function was > as follows: > > // Function to send query and retrieve result pointer > function GetData($Query) > { > extract ($GLOBALS); > $Result = mysql_query($Query, $db_conn) >or die (mysql_error()); > Return $Result; > } > > The function accepts an SQL statement as an argument and returns a pointer > to a result set. The SQL statement that is passed to the function is one of > many defined constants, many of which contain variables. For example: > > define ("ClassesByTeacher","SELECT Classes.SectionNo, Period, CourseNo, > Title, Teacher FROM Classes, Attendance WHERE Classes.SectionNo = > Attendance.SectionNo AND Teacher LIKE \"$Teach\" AND Attendance.Date = > \"$SQLDate\" GROUP BY Classes.SectionNo"); > > This particular statement needs to have access to the $Teach and $SQLDate > variables. When these variables were passed as GET values in the URL the > function worked as expected. However, if I assigned the variables within > the code of the script outside the function I invariably received empty > result sets. I spent quite a bit of time under the impression that the > global variables where not being accessed by the function unless they where > GET variables. This did not turn out to be the case. Upon adding debug > code to the script I was able to determine that the function was correctly > accessing the global variables, but the mysql_query function was not. As it > turned out, and this is the part that may seem obvious, the problem resulted > from the fact that the define statement was evaluating the variables to "" > before they were actually set in code. > > The result was an SQL statemente like this: > > SELECT Classes.SectionNo, Period, CourseNo, Title, Teacher FROM Classes, > Attendance WHERE Classes.SectionNo = Attendance.SectionNo AND Teacher LIKE > "" AND Attendance.Date = "" GROUP BY Classes.SectionNo > > which explains the empty data sets and lack of an error message. > > The define statements are in a seperate file that is included into the > script. It is my general practice to include all files that contain > functions as the beginning of a script and this is what I had done here. As > soon as the file containing the defines was included the variables were > evaluated to empty strings within the defined constant before the variables > were set to usable values within the code. Moving the include statement > below the variable assignments in the script provided the solution. > > The lesson I learned is this: > > When including files that contain declare statements which in turn contain > variables, always include the file after the variables have actually been > set to their desired values. > > Fred > > > > > -- > PHP General Mailing List (http:
Re: [PHP] very weird PHP behaviour...
try this: function Upload($source_file,$source_filename,$dest_dir,$allowed_types=array(), $upload_errmsg="") { if( count($allowed_types) ) { if(!in_array(ArquivoExt($source_filename),$allowed_types)) { ?>O arquivo não está entre os tipos autorizados To: <[EMAIL PROTECTED]> Sent: Wednesday, November 14, 2001 8:34 AM Subject: [PHP] very weird PHP behaviour... I don't know what it is... but PHP is acting very weird today... or I am becoming crazy... can anyone tell me which one? I have this function: function Upload($source_file,$source_filename,$dest_dir,$allowed_types=array()) { global $upload_errmsg; if( count($allowed_types) ) { $file_ext=ArquivoExt($source_filename); $ext_found=in_array($file_ext,$allowed_types); //die("source=$source_filename"); //var_dump($ext_found); //die; if( !$ext_found ) { $upload_errmsg="O arquivo \"$source_filename\" não está entre os tipos autorizados"; //die("errmsg=$upload_errmsg"); return false; } } ... some more code here .. return true; } the first crazy behaviour is... I use a test file called something.jpg, ArquivoExt() returns me the extension of a given filename, in this case "jpg". $allowed_types contains "gif","jpg" and "png" so that in_array() should return true... and it does... but get this... if I uncomment that var_dump() guess what it outputs? bool(true) bool(false) very weird... how can one var_dump() call gives me two outputs? This double output doesn't occur if I uncomment the "die" after the var_dump(). It only outputs bool(true) in that case. Now for the second weird behaviour... since no matter what, $ext_found will always be false (due to the previous weirdness) it will always enter the IF... but the weird thing is when the caller of Upload() prints $upload_errmsg it only outputs: O arquivo "" não está entre os tipos autorizados where is the filename? I've checked it tons of times... If I uncomment the second die, right after the $upload_errmsg assignment, it outputs ok, with the filename. Now, can someone explain me this VERY WEIRD behaviour?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP Address Variable
check this out http://www.php.net/manual/en/function.gethostbyaddr.php jim - Original Message - From: "Ben Clumeck" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 14, 2001 2:48 PM Subject: [PHP] IP Address Variable > I currently log ip address that reach my site. However, I want to be able > to log both the ip address and remote name. Can anyone help? > > Thanks, > > Ben > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] What version did $PHP_SELF still work?
try using $GLOBALS[PHP_SELF] no matter where you are at (ie out of a function, in a function, in an array(), etc... ), you will get the correct value Jim - Original Message - From: "John Steele" <[EMAIL PROTECTED]> To: "PHP General List" <[EMAIL PROTECTED]> Sent: Thursday, November 15, 2001 4:57 AM Subject: [PHP] What version did $PHP_SELF still work? > Hello, > > I'm trying this again with a different header. After installing PHP4.0.6 $PHP_SELF is set (empty), and this is breaking many scripts of mine (and others). I can't seem to find any mention of this in the commented manual, or anywhere else for that matter. > > I can try and install an earlier version, but I'm not sure which one (I'd like to use DBG though). I'd hate to have to go back to 4.0.2! > > Any advice welcome! > John > -- > /* SteeleSoft Consulting John Steele - Systems Analyst/Programmer > * We also walk dogs... Dynamic Web Design PHP/MySQL/Linux/Hosting > * www.steelesoftconsulting.com [EMAIL PROTECTED] > */ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] eregi_replace probs
eregi_replace isn't your problem this funciton "RETURNS" the new string. > function scan_string(&$str) { > $forbid = array ("coke", "tylenol", "ford"); > $swap = array ("pepsi", "advil", "chevrolet"); > for ($i = 0; $i < count ($forbid); $i++) { > $NEW_STRING = eregi_replace($forbid[$i],$swap[$i],$str); > } > return($NEW_STRING); > } Jim - Original Message - From: "phantom" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, November 16, 2001 2:16 PM Subject: [PHP] eregi_replace probs > function scan_string(&$str) { > $forbid = array ("coke", "tylenol", "ford"); > $swap = array ("pepsi", "advil", "chevrolet"); > for ($i = 0; $i < count ($forbid); $i++) { > eregi_replace($forbid[$i],$swap[$i],$str); > } > } > > I run this script, and I know the array's load up and the for...do loop > runs ok. As does the passing variable ($str). > > I enter a test script such as "I like coke." and my returned value > remains "I like coke." > > It appears the eregi_replace is the problem. > > Any idea why? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] eregi_replace probs
sorry didn't notice the & in the args you'll want this instead. > function scan_string(&$str) { > $forbid = array ("coke", "tylenol", "ford"); > $swap = array ("pepsi", "advil", "chevrolet"); > for ($i = 0; $i < count ($forbid); $i++) { > $str = eregi_replace($forbid[$i],$swap[$i],$str); > } > } Jim - Original Message - From: "phantom" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, November 16, 2001 2:16 PM Subject: [PHP] eregi_replace probs > function scan_string(&$str) { > $forbid = array ("coke", "tylenol", "ford"); > $swap = array ("pepsi", "advil", "chevrolet"); > for ($i = 0; $i < count ($forbid); $i++) { > eregi_replace($forbid[$i],$swap[$i],$str); > } > } > > I run this script, and I know the array's load up and the for...do loop > runs ok. As does the passing variable ($str). > > I enter a test script such as "I like coke." and my returned value > remains "I like coke." > > It appears the eregi_replace is the problem. > > Any idea why? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Auto Thumbnail?
well, if you are on a *nix based system, you could use ImageMagic. and have it generate the thumbnails for you. as for a script, well, you would have to write that. Jim - Original Message - From: "cosmin laslau" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, November 16, 2001 3:16 PM Subject: [PHP] Auto Thumbnail? > I've got a website which will alllow users to upload photos (jpegs) and, > once approved, they'll be up for display. To do that, I need an > auto-thumbnail script, preferrably for on-the-fly thumb generation. > > Any ideas? Also, what kind of libraries would I need. > > Thanks. The site is http://www.flat-6.net/f6 > > _ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] textarea, carriage returns and formatting
not sure what you're getting at. when you pull the text back out of the DB, it should be formatted the same as when it was put in the DB. the \n's should still be intack are you processing the text before it gets entered into the DB? You should be able to do this: Jim - Original Message - From: "Chris Aitken" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 20, 2001 3:34 PM Subject: [PHP] textarea, carriage returns and formatting > Hi, > > Something ive been trying to find out but cant seem to get the wording > right to find the answers in the archives. > > What I have is a mysql database, and in that DB I have a field which is > just a 'text' field. What I want to be able to do is write whatever text > is typed from the webforms textarea into the 'text' field, formatting in > tact. For example if this was typed into a textarea > > -- > This is some text ive typed > I have some single and double > > carriage returns in there, and I > want it to keep the formatting > -- > > When I pull it back out of the DB, I want to be able to display it back in > a textarea with the carriage returns in place exactly as it was typed in. > > Can anyone point me in the right direction. Is there a php function which > can convert/reconvert on the display from/insert to the database, or am I > missing something totally with this. > > > Thanks > > > > Chris > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Setting title via included file
try it the other way around. capture the output of the included file before you send/display the title Jim - Original Message - From: "Chris Lott" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 20, 2001 3:44 PM Subject: [PHP] Setting title via included file > I have a page that includes a file in the middle, but I wish to set the > title of the page based on a variable set in the included file-- is this > possible? > > PHP processes the page sequentially, so if I have $foo = Title in the > included file, it is too late to use it for the title of the main document. > > I thought output buffering might be the key, but it doesn't seem to work. > Should it? > > Basically, I was doing this for the output buffering: > > *** > function fixtitle($buffer) { > return (str_replace("XXX", $pagetitle, $buffer)); > } > > ob_start("fixtitle"); > > ?> > > XXX > > ... > > > > ... > > > > ob_end_flush(); > > ?> > > > c > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP_REFERER
at our site, we built the error trapping that you are wanting to build. here is a snippet of what we used. "PSID: (". PSID .")\n". "Page: ($GLOBALS[REQUEST_URI])\n". "As refered from: ($GLOBALS[HTTP_REFERER])\n". "Browser Platform: ($GLOBALS[HTTP_USER_AGENT])\n". "User IP: '". gethostbyaddr($GLOBALS[REMOTE_ADDR]) ."' ($GLOBALS[REMOTE_ADDR])\n". hope this helps Jim - Original Message - From: "Jordan Elver" <[EMAIL PROTECTED]> To: "PHP General Mailing List" <[EMAIL PROTECTED]> Sent: Friday, November 23, 2001 2:55 AM Subject: [PHP] HTTP_REFERER > Hi, > I'm writing a 404 handler and in order to report the item that was requested > I was trying to get the value of HTTP_REFERER. But, it does seem to get set. > Does anyone know how to find thi value? Is there a reason why it would not > get set? > > TIA, > > Jord > -- > Jordan Elver > Web Developer > http://www.theinternetone.co.uk > Carpe Aptenodytes! (Seize the Penguins!) > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php->html
checkout the output control function at php.net http://www.php.net/manual/en/ref.outcontrol.php they allow you to capture the test that would have normally been sent to the browser. take the value of the variable and write it to a file.. :) Jim Lucas - Original Message - From: "Christoph Starkmann" <[EMAIL PROTECTED]> To: "php forum" <[EMAIL PROTECTED]> Sent: Friday, November 23, 2001 6:02 AM Subject: [PHP] php->html > Hi there! > > I had to create a large number of HTML-files with large parts > within that are identical (the navigation). > To avoid redundant writing during the creation of the files, > I used PHP-Includes to include this navigation from one file. > > Now I have to get static HTML-pages from these php-enriched files. > > I am thinking about using regexp to filter the php-tags and include > the corresponding HTML-Sniplets. > > Or I guess I could open a connection to the server and read these > files as if I was a client (browser) and stzore the resulting HTML-pages. > > Any idea what would be easier (I got very few time...) > > Any hints? > > Cheers, > > Kiko > > - > It's not a bug, it's a feature. > christoph starkmann > mailto:[EMAIL PROTECTED] > http://www.fh-augsburg.de/~kiko > ICQ: 100601600 > - > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] zip.exe files
check out the www.php.net and look into the using the header function to force the down load instead of trying to executing the file. www.php.net/header Jim - Original Message - From: "AAustin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, November 29, 2001 4:26 PM Subject: [PHP] zip.exe files > Hi > > > On the corp website we are wanting to make the zip files that clients > download zip.exe self extract files. Our html click > here links no longer work. > > Now we get server error messages rather than the dialog box when the link is > clicked. I think the file is trying to decompress when clicked to download. > Is there a common procedure to get around this? > > Thanks in advance > > Andrew > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Modifying arrays in place that are stdClass arrays
Lists wrote: Hello, I have not had a lot of opportunity to deal with stdClass objects in php. This should be a simple one. I have been plagued with failure for far too many hours, so I bring it to the more experienced. I have $result = imap_fetch_overview(...) which returns a large stdClass object, depending on the imap mail that I am reading. I do no think anyone need know anything about IMAP functions to help me on this one. Here is the result of the $result as a print_r() http://pastebin.com/f4aee86ef As you can see, there is one outer object, inside that are two iner "parts" objects, the second "part" object has sub parts. My goal is to inject into the front of those, a new set of values. foreach ($structure->parts as $key => $val) { // Inject this to the replace the stdClass parts array $part_array[] = array('partnumber' => ($key + 1), 'part_object' => $val); } So far, that works to add in two new items to the beginning of the outer two objects. I get something like this [0] => Array ( [partnumber] => 1 [part_object] => stdClass Object . [1] => Array ( [partnumber] => 2 [part_object] => stdClass Object . Now on item [1] in the above, there is a sub [part], containing 7 [parts] objects. I want to make the same in place modifications to those, adding in an item of [partnumber] and the key number I am at. * I am going to do more to those added in values, but this distills it down to my core issue. In short, those parts need numbers, which are then fed to another IMAP function to read out those specific parts of an email. These objects can contain anywhere from 0 to a large number of sub parts, depending on the complexity of the email, if it has attachments, and if those attachments are also emails. I have been playing around with this inside the main loop, but it puts the partnumber in a place that is not correct. // There are sub parts if (count($val->parts) > 0) { foreach ($val->parts as $key2 => $val2) { //$part_array[1] = array('partnumber' => ($key2 + 1), 'part_object' => $val2); } } Thanks for any guidance. Ok, since you didn't show us your complete/intact code, I will try and mash things together... parts as $key => $val) { // Inject this to the replace the stdClass parts array $part_array[$key] = array('partnumber' => ($key + 1), 'part_object' => $val); // There are sub parts if ( count($val->parts) > 0 ) { foreach ($val->parts as $key2 => $val2) { $part_array[$key]['parts'][$key2] = array('partnumber' => ($key2 + 1), 'part_object' => $val2); } } } print_r($part_array); the above should result in something like the following [0] => Array ( [partnumber] => 1 [part_object] => stdClass Object [parts] => Array ( [0] => Array ( [partnumber] => ### [part_object] => /object.../ ) ... ) . [1] => Array ( [partnumber] => 2 [part_object] => stdClass Object . But anyways, my example output might be off a little, but I should be close. give it a try... Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] difficult select problem
PJ wrote: I've searched the web, the tutorials, etc. with no luck and have asked on MySql list with no luck and have even posted here with no replies. So, let's try again: I am trying to limit the search for books to only those that start with "A" (does not have to be case sensitive); but within that selection there may be a second author whose name may start with any letter of the alphabet. So, the real problem is to find if there is a second author in the selection of books and to display that name. My query shows all the books that begin with A: $SQL = "SELECT b.*, c.publisher, a.first_name, a.last_name FROM book AS b LEFT JOIN book_publisher as bp ON b.id = bp.bookID LEFT JOIN publishers AS c ON bp.publishers_id = c.id LEFT JOIN book_author AS ba ON b.id = ba.bookID LEFT JOIN author AS a ON ba.authID = a.id WHERE LEFT(last_name, 1 ) = '$Auth' "; Within the results there are some books that have 2 authors and now I have to find if there is a second author in the results and then be able to echo the second author. So far, I have not been able to figure out how to go about that. Do I need to do another query to find the second author or can it somehow be incorporated into the original query? Or can it be done with a UNION ? Please help. ... and we begin ... $SQL = "SELECT b.*, c.id AS publisher_id, c.publisher, a.id AS author_id, a.first_name, a.last_name FROM book AS b INNER JOIN book_publisher as bp ON b.id = bp.bookID INNER JOIN publishers AS c ON bp.publishers_id = c.id INNER JOIN book_author AS ba ON b.id = ba.bookID INNER JOIN author AS a ON ba.authID = a.id WHERE b.id IN ( SELECT b.id FROMbook AS b INNER JOIN book_author AS ba ON b.id = ba.bookID INNER JOIN author AS a ON ba.authID = a.id WHERE a.last_name LIKE '{$Auth}%' )"; Ok, with those changes made, you will now see that your result set is going to have duplicate entries for each book. Well, almost duplicate... Basically what you need to realize is that you are talking about row counts compounding upon themselves... I will try and explain... if you had ten books with a total of 16 unique authors and 8 unique publishers, you would end up with a result set (without any WHERE clause) that was 10 x 16 x 8 = 1280 rows. now, say that you put a limit of "authors last name must start with and 'A'" on the select (like you have) say that three of the authors match that and of those three, they had 4 books that they have written and those 4 books were published by 2 unique publishers. You would end up with 3 x 4 x 2 = 24 rows in result set. I would consider handling all the above as I have stated, but you will need to add some sorting of the data in PHP to make sense of it all. something like the following should do. (completely untested!!!) typed right in the client here... $book_information = array(); if ( ( $results = mysql_query($SQL, $db) ) !== false ) { while ( $row = mysql_fetch_assoc($results) ) { $book_information[$row['id']]['title'] = $row['title']; # NOTICE: this row is here so you can replace it with other information from the book table $book_information[$row['id']]['...'] = $row['...']; $book_information[$row['id']]['authors'][$row['author_id']] = array('first_name' => $row['first_name'], 'last_name' => $row['last_name']); $book_information[$row['id']]['publishers'][$row['publisher_id']] = $row['publisher']; } } Do a print_r($book_information) and you should get an understanding of what is happening. Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] difficult select problem
PJ wrote: Hi Jim, Sorry I could not gat back to you on your suggestion. I've been under the weather for a couple of days but am almost over it. Your suggestion does not work... yet. I'll insert comments & questions below... Jim Lucas wrote: PJ wrote: I've searched the web, the tutorials, etc. with no luck and have asked on MySql list with no luck and have even posted here with no replies. So, let's try again: I am trying to limit the search for books to only those that start with "A" (does not have to be case sensitive); but within that selection there may be a second author whose name may start with any letter of the alphabet. So, the real problem is to find if there is a second author in the selection of books and to display that name. My query shows all the books that begin with A: $SQL = "SELECT b.*, c.publisher, a.first_name, a.last_name FROM book AS b LEFT JOIN book_publisher as bp ON b.id = bp.bookID LEFT JOIN publishers AS c ON bp.publishers_id = c.id LEFT JOIN book_author AS ba ON b.id = ba.bookID LEFT JOIN author AS a ON ba.authID = a.id WHERE LEFT(last_name, 1 ) = '$Auth' "; Within the results there are some books that have 2 authors and now I have to find if there is a second author in the results and then be able to echo the second author. So far, I have not been able to figure out how to go about that. Do I need to do another query to find the second author or can it somehow be incorporated into the original query? Or can it be done with a UNION ? Please help. ... and we begin ... $SQL = "SELECT b.*, c.id AS publisher_id, c.publisher, a.id AS author_id, a.first_name, a.last_name FROM book AS b INNER JOIN book_publisher as bp ON b.id = bp.bookID INNER JOIN publishers AS c ON bp.publishers_id = c.id INNER JOIN book_author AS ba ON b.id = ba.bookID INNER JOIN author AS a ON ba.authID = a.id WHERE b.id IN ( SELECT b.id FROMbook AS b INNER JOIN book_author AS ba ON b.id = ba.bookID INNER JOIN author AS a ON ba.authID = a.id WHERE a.last_name LIKE '{$Auth}%' )"; A written, the code does not produce a result. Questions: 1. why c.id AS publisher_id and a.id AS author_id? I do not see a reference to these in the code 2. why "a.last_name LIKE '{$Auth}%'? What does that change from LEFT(last_name, 1) = '$Auth'? the LEFT clause will give me all authors whose names begin with A; I don't care what the rest of the string may be - the authors' last names always starts with a capital letter. 3. What were you expecting to get as a result from the code? It looks to me like the results will only give all authors whose names begin with A. And that I am already getting with the code as I have written. Sorry for my ignorance, but that is why I am asking for help. 4. So far, no one has used the book_author.ordinal to select the author ; perhaps I have not been clear on that as that is what I use to determine if there are more than 1 author. Ordinal 1 is for all authors who are unique for a book; ordinal 2 is for authors who are the second author for a book. Thanks for explaining the ordinal significance. Does it really make a difference if the ordinal is 1 or 2? Does 1 indicate the primary author and the 2 indicate supporting authors??? If a book has three authors and all three had an ordinal of 2, would it make any difference then if one was 1 and the remaining two were marked 2? If it makes no difference, the the column is pointless. If it does make a difference (identifying one as 1 and the remaining as 2), then keep it and we will deal with that later. But, all this can be done without that column. Read my other email that I about to send, responding to a different part of this thread. Now, if my code is not too messy or cumbersome (I refer to your e-mail of March 15) then what I really need is a way to save the book.id from my query to a $tring and then use that to select the book in another query that will give me the second author. I am wondering how that is done; I have already used this in retrieving arrays but the id is changed in a simple $bk_id = $result - damn, I forget where I found that in the manuals. I used it in another situation like this: $catvar = array_values($category[$categoryID]); $cat = $catvar[1]; $catvar was ids like 9, 6, 17, etc. and assigning it to $cat ranged them as 1, 2, 3, 4, etc. (which is what I want to avoid) Then I should be able to do a "SELECT CONCAT_WS(" ", first_name, last_name) as Author2 FROM author a, book b, book_author ba WHERE $bk_id = ba.bookID && ba.authID = a.id" or "SELECT CONCAT(first_name, " ", last_name, book_author.ordinal) as Author2 FROM author a, book b, book_author ba WHERE $bk_id = ba.
Re: [PHP] difficult select problem
gives me these results: *array* 6 => *array* 'id' => string '6' /(length=1)/ 'title' => string 'Nubia.' /(length=6)/ 'sub_title' => string 'Corridor to Africa' /(length=18)/ 'descr' => string '' /(length=0)/ 'comment' => string '' /(length=0)/ 'bk_cover' => string '' /(length=0)/ 'copyright' => string '1977' /(length=4)/ 'ISBN' => string '0691093709' /(length=10)/ 'language' => string 'en' /(length=2)/ 'sellers' => string '' /(length=0)/ 'publisher' => string 'Princeton University Press' /(length=26)/ 'first_name' => string 'William Yewdale' /(length=15)/ 'last_name' => string 'Adams' /(length=5)/ This is the first of 17 books and it would be sufficient if I were not so damned demanding. I know that there are several books in the list that have 2 authors. At least 1 whose last name begins with A is an ordinal=2 (which is not important when it comes to displaying) and there are a couple where there are 2nd authors whose names begin with other letters of the alphabet. It is these that I am targeting. My question is: How do I filter my query to weed out these renegades? Can it be done using a concat as Author1 and another concat as Author2 (in place of the first_name and last_name joins ? Or do I do another query just for the outlaws? -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: unknown number of inputs
Shawn McKenzie wrote: PJ wrote: I have a script with $_POST and to load data with text input. Situation: enter name of author(s) for book. I have the script set up to enter first_name, last_name for Author1 and the same for Author 2. Check if entry 1 exists then proceed accordingly Check if entry 2 exists then proceed accordingly. Now, If I have three or more authors to enter, is there a way to add a radio button to add more rows for input or to skip further inputs, if I have to enter the inputs for each additional author? I'm looking for a simple way to do this. Could or should Ajax be involved in this somehow? Ajax would be a good way to go if it could be an undetermined number of authors. But if you have a limit (like 3 or 4 or 5) then just include the text fields for that number. For Ajax you might have a button or link that says "add more authors" and when clicked the javascript adds an additional input to the form. This isn't a job for AJAX, it is a job for JavaScript. REF: AJAX - http://en.wikipedia.org/wiki/Ajax_(programming) Dynamic Form Generation - http://www.faqts.com/knowledge_base/view.phtml/aid/1785/fid/129 I did a quick Google and came up with the two above examples. Others might have better suggestions. But I just wanted to point out the difference. AJAX, IMO, is bases on JavaScript talking to a server with the intent to send/receive data. DHTML/JavaScript/etc... are was to do what you are asking without ever needing to talk with the server. So it doesn't involve anything that AJAX was designed to solve. I simply wanted to point out the different uses. Hope I didn't step on anybodies toes. -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Escape Data In/Out of db [solved]
tedd wrote: At 5:03 PM +0200 4/9/09, Jan G.B. wrote: You might want to use htmlspecialchars($str, ENT_QUOTES) OUT from db to html and mysql_real_escape_string(stripslashes($_POST['yourself'])); The above tells me that you probably need to look at your magic quotes setting. Typically, you will want to disable magic quotes in your php.ini file / VirtualHost Block / or somewhere else. This setting tells PHP to automagically escape your GET/POST data when PHP receives it from the web server (Apache/IIS/etc...). I recommend turning it off, but making darn sure you sanitize all input to script from and outside source. IN to db from html Thanks, that worked. Cheers, tedd -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] extract varying data from array with different formatting
PJ wrote: foreach does a nice job if you want the results identical each time. What can you use to change the formatting of the results dependent on the number of results. Here's an example: foreach ( $authors[$bookID] AS $authorID => $authorData ) { # Display the echo "{$authorData['first_name']} {$authorData['last_name']}\n"; } will echo - Joe Boe John Blue Andy Candy etc depending on how many rows we have. What I want is: Joe Boe, John Blue, Andy Candy & Hans Stick ( separated by commas, except for the last one which is separated with & . I thought of passing a variable to the foreach and then using if elseif... but that can't work because the variable is reset to 0 after each pass. Can't get switch to do it (maybe I don't understand it right. Help ? your answer lies with not replacing foreach to make your life/output better. But with how the data is prepared and handed off to the foreach statement. I am guessing that what you want would be something like this. Since this looks like a snippet of code I sent you the other day, I will snag it "complete" from the other thread. $authorData ) { # Add all the authors to that new array $aList[] = "{$authorData['last_name']}, {$authorData['first_name']}"; } # Sanitize the output $aList = array_map('htmlspecialchars', $aList); # Get a count of how many authors their is. $tAuthors = count($aList); # If more then one, do... if ( $tAuthors > 1 ) { # Take the last one off, so we can handle it differently $last_author = array_pop($aList); echo join(', ', $aList), ' & ', $last_author; # If only one, then do... } elseif ( $tAuthors == 1 ) { echo join('', $aList); } echo ''; } else { echo 'No authors found'; } ... ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] extract varying data from array with different formatting
PJ wrote: Jim Lucas wrote: PJ wrote: foreach does a nice job if you want the results identical each time. What can you use to change the formatting of the results dependent on the number of results. Here's an example: foreach ( $authors[$bookID] AS $authorID => $authorData ) { # Display the echo "{$authorData['first_name']} {$authorData['last_name']}\n"; } will echo - Joe Boe John Blue Andy Candy etc depending on how many rows we have. What I want is: Joe Boe, John Blue, Andy Candy & Hans Stick ( separated by commas, except for the last one which is separated with & . I thought of passing a variable to the foreach and then using if elseif... but that can't work because the variable is reset to 0 after each pass. Can't get switch to do it (maybe I don't understand it right. Help ? your answer lies with not replacing foreach to make your life/output better. But with how the data is prepared and handed off to the foreach statement. I am guessing that what you want would be something like this. Since this looks like a snippet of code I sent you the other day, I will snag it "complete" from the other thread. $authorData ) { # Add all the authors to that new array $aList[] = "{$authorData['last_name']}, {$authorData['first_name']}"; } # Sanitize the output $aList = array_map('htmlspecialchars', $aList); # Get a count of how many authors their is. $tAuthors = count($aList); # If more then one, do... if ( $tAuthors > 1 ) { # Take the last one off, so we can handle it differently $last_author = array_pop($aList); echo join(', ', $aList), ' & ', $last_author; # If only one, then do... } elseif ( $tAuthors == 1 ) { echo join('', $aList); } echo ''; } else { echo 'No authors found'; } ... ?> Hi Jim, Please excuse my writing to you directly. If you don't think it's proper, just let me know & I'll swing off. No problem with hitting me directly, but your findings could be of use to others since it is cleaner way of solving your problem. So, on the list we go So, while I have your attention and if you have a moment, I found this interesting possibility: someone threw "implode()" at me and I looked it up in the php manual and hey, found and interesting little function: function ImplodeProper($arr, $lastConnector = ' & ') { if( !is_array($arr) or count($arr) == 0) return ''; $last = array_pop($arr); if(count($arr)) return implode(', ',$arr).", $lastConnector $last"; else return $last; } Since my limited understanding of php impedes me to implement it experimentally in my application, I was curious if, indeed, it could be another option. It does look to me like it could work, but it would require a slightly different implementation of the query, probably somehow using something like a CONCAT(first_name, " ", last_name). Am I learning something here or is this the wrong tree to bark up? This would be a very nice way to clean up the code Although you could do something with CONCAT(), I would suggest leaving the code as is. Data is all that you want to get from MYSQL, not format. Basically, take the above function and place it in a lib you include for everything. Then replace the if/then/else statement that I built for you with a call to said function. $authorData ) { # Add all the authors to that new array $aList[] = "{$authorData['last_name']}, {$authorData['first_name']}"; } # Sanitize the output $aList = array_map('htmlspecialchars', $aList); echo implodeProper($aList), ''; } else { echo 'No authors found'; } ... ?> That would do the trick. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multi-dimensional arrays
Andres Gonzalez wrote: Hi, I am learning PHP and have a simple question. I have a input string in this form: xxx xx x xx xxx xx x x xxx xx xx . . . xx xxx xx xx xx each line has 6 words of various lengths, all separated by white space. the input string can have any number of lines I want to put this into a multi-dimensional array, each line an array that is an element of an outer array. I have tried various ways to do this--I have used explode() and array_filter() and can get a single line parsed and into an array but I am having problems getting a well formed 2 dim array. What is the easiest way to do this? With all of the PHP array functions, there should be an very straight forward way to do this. Any help would be appreciated. -Andres I am no guru of regex or preg_* functions. But here is what I came up with. The above outputs the following: xxx xx x xx xxx xx x x xxx xx xx xx xxx xx xx xx Array ( [0] => Array ( [0] => xxx xx x xx xxx [1] => xxx [2] => [3] => xx [4] => x [5] => xx [6] => xxx ) [1] => Array ( [0] => xx x x xxx xx xx [1] => xx [2] => x [3] => x [4] => xxx [5] => xx [6] => xx ) [2] => Array ( [0] => xx xxx xx xx xx [1] => xx [2] => xxx [3] => xx [4] => [5] => xx [6] => xx ) ) Hope this is what you are looking for. Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pup
ramesh.marimu...@wipro.com wrote: Hi, I'm new to php. Say I have a check box which is checked already. Now I need to uncheck it and when I press the submit button, I should get the unchecked value. Can anyone help me on this. One.php if($qry[0]!=$login_type) { echo "".$slot_value.""; } else { echo " ".$slot_value.""; } One.php calls Two.php Two.php $enable_slot= $_POST['enable']; $uncheck_slot= $_POST['uncheck']; if ($enable_slot){ echo "$enable_slot"; foreach($enable_slot as &$a) { echo "".$a." --unreserve"; } } I get only the results only if checked. I think I'm doing a mistake in the code in red font. regards, -rummy When you uncheck a checkbox in an HTML form, it will not be submitted. http://www.w3.org/TR/html401/interact/forms.html#checkbox The part on the above page talking about "only "on" checkbox controls can become successful." is the key here. The successful part links here: http://www.w3.org/TR/html401/interact/forms.html#successful-controls This explains that the definition of a successful checkbox submission is one that is "on". To have a checkbox in the "on" state means that it has to be checked. So, any checkbox that is /not/ checked is considered "off" or "undefined" will not be submitted because it is not valid. Or something like that... :) Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pup
ramesh.marimu...@wipro.com wrote: Thanks Jim. Is there a way to get the value of that unchecked box? -rummy -Original Message- From: Jim Lucas [mailto:li...@cmsws.com] Sent: Friday, April 17, 2009 10:35 AM To: Ramesh Marimuthu (WT01 - Telecom Equipment) Cc: geek...@gmail.com; php-general@lists.php.net Subject: Re: [PHP] pup ramesh.marimu...@wipro.com wrote: Hi, I'm new to php. Say I have a check box which is checked already. Now I need to uncheck it and when I press the submit button, I should get the unchecked value. Can anyone help me on this. One.php if($qry[0]!=$login_type) { echo "style=background-color:#CC66CC>value=a".$count." checked DISABLED />".$slot_value.""; } else { echo "style=background-color:#00>value='--user ".$slot_value." --ne ".$nen." --timespec ".$slt."' checked ".$slot_value.""; } One.php calls Two.php Two.php $enable_slot= $_POST['enable']; $uncheck_slot= $_POST['uncheck']; if ($enable_slot){ echo "$enable_slot"; foreach($enable_slot as &$a) { echo "".$a." --unreserve"; } } I get only the results only if checked. I think I'm doing a mistake in the code in red font. regards, -rummy When you uncheck a checkbox in an HTML form, it will not be submitted. http://www.w3.org/TR/html401/interact/forms.html#checkbox The part on the above page talking about "only "on" checkbox controls can become successful." is the key here. The successful part links here: http://www.w3.org/TR/html401/interact/forms.html#successful-controls This explains that the definition of a successful checkbox submission is one that is "on". To have a checkbox in the "on" state means that it has to be checked. So, any checkbox that is /not/ checked is considered "off" or "undefined" will not be submitted because it is not valid. Or something like that... :) Jim Lucas Please do not print this email unless it is absolutely necessary. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com Maybe create a hidden input tag right next to it that references some default value. Why are you wanting to get a value if it is not checked? If this is what you are looking for are you sure that a checkbox is the right form input type to be using? Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pup
ramesh.marimu...@wipro.com wrote: I'm developing a slot reservation page. It shows checked boxes for the currently logged user. If he likes to unreserve it, he should uncheck it. For other users it is disabled. Also a currently logged user can book another slot. Also when I use hidden types, only if all the checked boxes are unchecked, I could get the hidden values. -rummy You could use an array system in your checkbox form section.? Basically, take your check boxes. I am assuming that you have a defined list of what is expected? Correct? Have your elements setup like such: Room #1 Room #2 Room #3 Room #4 Room #5 Then on your processing page, you know that you have 5 rooms, 1 - 5. With this information you can check to make sure that something exists Something like that should do the trick. Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DATE / strtotime
Ron Piggott wrote: Where $date_reference is 2009-04-18 the following code gives me a day of 1969-12-30. How do I get it to be 2009-04-17? $previous_date = strtotime("-1 days", $date_reference); $previous_date = date('Y-m-d', $previous_date); echo $previous_date; outputs 1969-12-30 Ron You need to read the strtotime page in the manual. http://php.net/strtotime It says that the second argument of the strtotime function is suppose to be a unix time stamp. Is the value that you gave us for $date_reference a unix time stamp? No Your code should be like this. // This converts 2009-04-19 00:00:00 into 1240099200 $date_reference_unix = strtotime($date_reference); $previous_date = strtotime("-1 days", $date_reference_unix); $previous_date = date('Y-m-d', $previous_date); echo $previous_date; outputs 1969-12-30 -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pup
Ashley Sheridan wrote: On Fri, 2009-04-17 at 12:54 -0400, Bob McConnell wrote: From: tedd At 10:43 PM -0700 4/16/09, Jim Lucas wrote: Have your elements setup like such: Room #1 Room #2 Room #3 Room #4 Room #5 Then on your processing page, you know that you have 5 rooms, 1 - 5. With this information you can check to make sure that something exists Jim et al: Try this: Room #1 Room #2 Room #3 Room #4 Room #5 if (isset($_POST['reserve']) ) { foreach ($_POST['reserve'] as $key => $a) { echo("$key $a "); } } Here's the demo: http://www.webbytedd.com//post-array1/index.php Don't forget the on the end of those input lines. I've seen too many pages already where I had to fix that problem. Bob McConnell It shouldn't really be Room #1 but something like this: Room #1 Well, to quote the W3C Recommendation... http://www.w3.org/TR/html401/interact/forms.html#h-17.9.1 First Name Last Name The label tag should reference the input via the for attribute. Identifying the input tag by id attribute value. And using the for attribute of the label tag in conjunction with the id attribute of the input tag, you can separate the label and form element entirely, which is sueful if you still use tables to line up your forms! Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to enable ttf support in php 5.2.9
PJ wrote: Is there a module to be activated or what has to be installed to have ttf support in php? My port on FreeBSD does not have an option for ttf support under make config . I'm trying to learn & understand the following: In file1 : In file2 (button.php)- originally php3 : The above should be: if ( empty($_GET['s']) ) { $s = 11; } else { $s = (int)$_GET['s']; } $size = imagettfbbox($s,0,"times.ttf",$text); and this should be $text = ''; if ( !empty($_GET['text']) ) $text = your_custom_input_cleaner_function($_GET['text']); $size = imagettfbbox($s,0,"times.ttf",$text); $dx = abs($size[2]-$size[0]); $dy = abs($size[5]-$size[3]); $xpad=9; $ypad=9; $im = imagecreate($dx+$xpad,$dy+$ypad); $blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255,255,255); ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black); ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white); ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black, "times.ttf", $text); ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white, "times.ttf", $text); ImageGif($im); ImageDestroy($im); ?> ONLY the above & nothing else. So far, all I get is a small blue square. Replacing the $text with the text just gives a rectangle a bit wider. gd is installed but ttf is not, so I figure that is the culprit. But how is the text supposed to be assigned to $text from file1? TIA -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] elseif statements
Well, since nobody seems to want to answer your question, I will... :) It has to do with you using an assignment '=' instead of a comparison '==' operator in your condition. Follow along with my inline notes below. Gary wrote: I am trying to get this to work, however it only reads the second if statement. I get no error messages, but as I change counties, the % stays the same. Can someone enlighten me, or should I be looking at switch statements? Thanks for your help. Gary /*$correct_assess=($sale_value)*($ratio); this is now the assessment should be */ $chester_correct_assess=($sale_value)*($chester_ratio); $montco_correct_assess=($sale_value)*($montco_ratio); $delco_correct_assess=($sale_value)*($delco_ratio); $chester_assess_difference=($assess_value)-($chester_correct_assess); $montco_assess_difference=($assess_value)-($montco_correct_assess); $delco_assess_difference=($assess_value)-($delco_correct_assess); /* $assess_difference=($assess_value)-($sale_value * $ratio); $percent_difference=($assess_difference)/($assess_value);*/ $chester_percent_difference=($chester_assess_difference)/($assess_value); $delco_percent_difference=($delco_assess_difference)/($assess_value); $montco_percent_difference=($montco_assess_difference)/($assess_value); $chester_percent_savings=($chester_percent_difference)*100; $delco_percent_savings=($delco_percent_difference)*100; $montco_percent_savings=($montco_percent_difference)*100; if(($_COOKIE['county_cookie'] ='Chester') && ($chester_assess_difference >=5)) The previous line should be, notice the missing == comparison ??? if(($_COOKIE['county_cookie'] == 'Chester') && ($chester_assess_difference >= 5)) { echo 'Yes, Your property appears to qualify!'; echo "You 1 believe your home would today sell for $".number_format($sale_value)." "; echo "Your current tax assessment is $".number_format($assess_value).""; echo "You live in $county "; echo "Your potential savings could be " .number_format($chester_percent_savings,0)."%"; echo "According to preliminary calculations based on the information you have entered, you may enjoy a savings of ".number_format($chester_percent_savings,0)."% off a combined total of county, school and township real estate taxes. Actual dollar amount savings will differ depending on the township that the property is located. Please contact my office for a more precise estimate of savings."; } elseif(($_COOKIE['county_cookie']='Delaware') && ($delco_assess_difference >=3)) { Same thing here echo 'Yes, Your property appears to qualify!'; echo "You 2 believe your home would today sell for $".number_format($sale_value)." "; echo "Your current tax assessment is $".number_format($assess_value).""; echo "You live in $county "; echo "Your potential savings could be " .number_format($delco_percent_savings,0)."%"; echo "According to preliminary calculations based on the information you have entered, you may enjoy a savings of ".number_format($delco_percent_savings,0)."% off a combined total of county, school and township real estate taxes. Actual dollar amount savings will differ depending on the township that the property is located. Please contact my office for a more precise estimate of savings."; } elseif(($_COOKIE['county_cookie']='Montgomery') && ($montco_assess_difference >=5)) Same thing here { echo 'Yes, Your property appears to qualify!'; echo "You 3 believe your home would today sell for $".number_format($sale_value)." "; echo "Your current tax assessment is $".number_format($assess_value).""; echo "You live in $county "; echo "Your potential savings could be " .number_format($montco_percent_savings,0)."%"; echo "According to preliminary calculations based on the information you have entered, you may enjoy a savings of ".number_format($montco_percent_savings,0)."% off a combined total of county, school and township real estate taxes. Actual dollar amount savings will differ depending on the township that the property is located. Please contact my office for a more precise estimate of savings."; } else if(($chester_assess_difference <=5) && ($chester_assess_difference>=1000)) { echo 'While it appears you may enjoy some savings, the dollar amount may not reach the threshold required for action. If property values in your area continue to decline, you may wish to revisit this issue again next year.'; } else if(($delco_assess_difference <=3) && ($delco_assess_difference>=1000)) { echo 'While it appears you may enjoy some savings, the dollar amount may not reach the threshold required for action. If property values in your area continue to decline, you may wish to revisit this issue again next year.'; } else if(($montco_assess_difference <=5) && ($montco_assess_difference>=1000)) { echo 'While it appears you may enjoy some savings, the dollar amount may not reach the threshold required for action. If property values in y
Re: [PHP] CSS & tables
Robert Cummings wrote: CSS3 will make our lives easier once it's fully supported by all major browser vendors... Rob, sorry to have to point this out to you, but all major browser vendors don't even support CSS1 or CSS2 completely/correctly yet. Plus, parts of what they do have implemented of CSS1 and CSS2 act differently between the different browsers that it is a PITA to work with them. SARCASM: They will be on to CSS5 or CSS6 before they get most of CSS3 features implemented. I guess I'm saying, don't hold your breath... Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] -less layouts; Ideas welcome
Since this has been a topic of dicussion, I figured I would add my thoughts. I have been toying with the idea of doing a -less layouts involving tabular data, calendars, etc... Recent threads have finally made me do it. Let me know what you think. http://www.cmsws.com/examples/templates/div_tables.php http://www.cmsws.com/examples/templates/div_tables.phps (source for above) http://www.cmsws.com/examples/templates/div_cal.php When you turn off the styles, the calendar becomes pretty rough on the eyes, but still "accessible". Same thing with the tabular data structure. But, not knowing how the various types of accessibility applications work, I am guessing that the layout to an application trying to read it should work fairly well. Let me know if I am way off the mark with my thoughts. If you want to respond off list, that if fine by me. TIA -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] -less layouts; Ideas welcome
Jim Lucas wrote: Since this has been a topic of dicussion, I figured I would add my thoughts. I have been toying with the idea of doing a -less layouts involving tabular data, calendars, etc... Recent threads have finally made me do it. Let me know what you think. http://www.cmsws.com/examples/templates/div_tables.php http://www.cmsws.com/examples/templates/div_tables.phps (source for above) http://www.cmsws.com/examples/templates/div_cal.php When you turn off the styles, the calendar becomes pretty rough on the eyes, but still "accessible". Same thing with the tabular data structure. But, not knowing how the various types of accessibility applications work, I am guessing that the layout to an application trying to read it should work fairly well. Let me know if I am way off the mark with my thoughts. If you want to respond off list, that if fine by me. TIA I forgot to mention that I have checked this in the following browsers all on Windows XP SP3 IE6 Mozilla Firefox 2.0.0.20 Mozilla Firefox 3.0.10 Safari 4 Public Beta Opera 9.64 the layout looked exactly the same between all the various browsers. If you have a different browser then mentioned above and you have a different layout let me know. If you could get me a screen shot, that would be great. Thank again. -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse ini file problem
Thodoris wrote: I am trying to parse an ini conf file using parse_ini_file but fails without returning something. I found this which is probably the reason: http://bugs.php.net/bug.php?id=44544 (the $ in the values) The problem is that this file has more than 7500 lines so it's kind of difficult to use quotes in all fields and there are several other reasons that I want to avoid quoting the values. In addition to that PHP 5.3 (which fixes this) is not stable yet and thus I can't install it in a production machine. So does anybody know any workarounds?? well, looks that the 3rd argument has always been a part of parse_ini_string() So, you could do this... $ini_data = parse_ini_string(file_get_contents($filename), FALSE, INI_SCANNER_RAW); I think this will work for you. Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] -less layouts; Ideas welcome
Jim Lucas wrote: Since this has been a topic of dicussion, I figured I would add my thoughts. I have been toying with the idea of doing a -less layouts involving tabular data, calendars, etc... Recent threads have finally made me do it. Let me know what you think. http://www.cmsws.com/examples/templates/div_tables.php http://www.cmsws.com/examples/templates/div_tables.phps (source for above) http://www.cmsws.com/examples/templates/div_cal.php When you turn off the styles, the calendar becomes pretty rough on the eyes, but still "accessible". Same thing with the tabular data structure. But, not knowing how the various types of accessibility applications work, I am guessing that the layout to an application trying to read it should work fairly well. Let me know if I am way off the mark with my thoughts. If you want to respond off list, that if fine by me. TIA Sorry all, been a way from the list for a few weeks. Here is another try at it. Ok, revision #2 http://www.cmsws.com/examples/templates/div_cal_normal.php http://www.cmsws.com/examples/templates/div_cal_daily.php http://www.cmsws.com/examples/templates/div_cal_fancy.php Truly their isn't much fancy about that last one. Just a name... Anyways, you will see that the code is exactly the same between pages, but the layout is radically different because of the style in play... I think this would be more useful then the others. With the first rendition, you had to break things on weeks/rows with the tables. I think this method is much simpler. Input welcome. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = "SELECT id FROM publishers WHERE publisher = 'whoever'"; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo "hello"; works. This works in the test page: $aid = array(); $ord = array(); $sql = "SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC"; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo ""; var_dump($ord); echo $aid[0], " - "; echo $ord[0]; This does not: $fi="joe"; $la="joe"; $sql = "SELECT id FROM author WHERE first_name = '$fi' && last_name = '$la'"; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) > 0) { $a_id=$row['id']; } echo $a_id, ""; The test page prints out echo "some text"; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) & IE 8. What is not fine? I was preaching this to you months ago. You should have error reporting turned on in a development area. by that I mean php should be set to display_errors = on and error_reporting = E_ALL Give this a try in a development area and "you will see the errors of your ways..." -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
Stuart wrote: 2009/7/4 PJ : Stuart wrote: 2009/7/4 PJ : Ashley Sheridan wrote: On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: Jim Lucas wrote: PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = "SELECT id FROM publishers WHERE publisher = 'whoever'"; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo "hello"; works. This works in the test page: $aid = array(); $ord = array(); $sql = "SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC"; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo ""; var_dump($ord); echo $aid[0], " - "; echo $ord[0]; This does not: $fi="joe"; $la="joe"; $sql = "SELECT id FROM author WHERE first_name = '$fi' && last_name = '$la'"; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) > 0) { $a_id=$row['id']; } echo $a_id, ""; The test page prints out echo "some text"; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) & IE 8. What is not fine? I was preaching this to you months ago. You should have error reporting turned on in a development area. by that I mean php should be set to display_errors = on and error_reporting = E_ALL Give this a try in a development area and "you will see the errors of your ways..." The error reporting is always on as you suggested and I use it all the time. But error reporting cannot report a non-existing error - a human stupid error that I finally caught - msql instead of mysql... oh. well... :-( -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php Actually, if you had error reporting on, it should have at least picked that up as a function that was not defined. You do mention you get a lot of white pages instead of errors, which suggests that either you do not have errors turned on, or you are turning them on from within PHP, What do you mean "from within PHP" ? Isn't this enough in the script? error_reporting(E_ALL); ini_set('display_errors', 1); As Ash points out that will not display errors in the code syntax since they prevent any of your script from being executed. You're better off setting these values in php.ini. -Stuart But not on a productions server, right? (Since this should have been corrected before "going live") Indeed. If you're using the same server for both then use ini_set to turn display_errors off on the production site. -Stuart Or, if it is running apache, you can set these values from within the httpd.conf file for your respective ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Alphabetical pagination
Andrew Ballard wrote: On Tue, Jul 14, 2009 at 3:38 PM, Miller, Terion wrote: I am trying to make a page that displays a-z like a b c d e etc as links then when you click open one it reloads itself and shows only the query results that go with that letter...i'm not getting itI get a page that says ARRAY over and over... What I have so far: Why are you setting the value of $name to an array? If you try to echo $name after this statement (as you are below), PHP will echo the word "Array". //$name = array('name'); echo " $name\n"; } } $alphabet = range('A', 'Z'); foreach ($alphabet as $letter) { echo '' . $letter . ''; } ?> If the list of restaurants is very long, I wouldn't store it in a session variable. It is the same for every person who visits your site, so there is little use storing separate redundant copies in session scope where it will needlessly fill up disk space and/or memory. As far as the query is concerned, you could do this: I would also consider whether you really need the keyword DISTINCT in the query. In a properly normalized table, name should probably already be distinct (and constrained by a UNIQUE index on that column). Andrew Also, since this is MySQL, you need to make sure you make it non case-sensitive by using ILIKE instead of LIKE in that SELECT statement. $sql = "SELECT DISTINCT name FROM restaurants WHERE name iLIKE '$index_letter%' GROUP BY name DESC"; -- Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php