[PHP] Sorting an array.
Hello, Here's what i'm working with. I'm figuring the distance between to points based on latitude and longitude. while ($row = mysql_fetch_array($result)) { //calculate distance between the two cities. $Lat2 = $row[Latitude]; $Lon2 = $row[Longitude]; $x = 69.1 * ($Lat2 - $Lat1); $y = 53 * ($Lon2 - $Lon1); $Distance = sqrt($x * $x + $y * $y); $Distance = ceil($Distance); if ($Distance 100){ echo $row[CompanyName].br; echo $row[Address].br; echo $row[City].br; echo $row[State].br; echo $row[ZipCode].br; echo $row[PhoneNumber].br; echo $row[FaxNumber].br; echo Approximant Distance = $Distance Milesbrbr; } } Here is where my question comes to play. How do I sort the $Distance so that 4 Miles will come up first 10 second 30 third ext.. I have tried useing sort() function but it doesn't work quite the way I want it to. Thanks for your help --Mike __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date function
Hello, I'm pulling a date out of MySQL as 2001-10-18. How do I make it print October 18 in php? Thanks much --Mike __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.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] Storing Java Script Varable into php variable
Hello, I look through the php-general list database but could not find the answer. My question is I have some java script I want to store the java script variable into a php variable so I can submit it into a database. Here is the Java sript code. -- function show(){ if (!document.all!document.layers) return document.t.t1.value=screen.width document.t.t2.value=screen.height document.t.t3.value=screen.colorDepth document.t.t4.value=screen.pixelDepth } show() -- Now What I want to do is take whats stored in document.t.t1.value=screen.width and put it into $screen Like ? $screen = document.t.t1.value=screen.width; How do I do this? Thank you for your help. --Mike __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.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] Submiting Data with an '
Hello everyone, I'm having a problem of submiting an ' into a mysql database. When I have a ' it doesn't update or submit the data. but if I use \' it works fine. Does anyone know of a way around this. Thanks --Mike __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.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] PHP using Forms
Hello, I have a form field TEXTAREA name=Home ROWS=10 COLS=40? echo $Home ?/TEXTAREA with this data in it: My Home 11 North 5th St St. Paul MN Phone: (555) 555- Fax: (555) 555- E-Mail: [EMAIL PROTECTED] When submited it goes into a mysql database. The problem i'm running into is that the output looks like this after the call from the mysql database to html: My Home 11 North 5th St St. Paul MN Phone: (555) 555- Fax: (555) 555- E-Mail: [EMAIL PROTECTED] How do I get it to print out with line breaks like how I have typed it into the form? Thank you --Mike __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices 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]
RE: [PHP] PHP using Forms
Thank you all!! :-) --- Altunergil, Oktay [EMAIL PROTECTED] wrote: The below does the newline and takes care of html tags which might otherwise get parsed by the web browser. # This function is to fix the characters. It replaces all htmlentities with their amp kind representation # and converts newlines to html breaks (BR) function fix($string) { return(nl2br(htmlentities($string))); } -Original Message- From: Jon Haworth [mailto:[EMAIL PROTECTED]] Sent: Friday, May 04, 2001 10:16 AM To: 'Mike Mike'; [EMAIL PROTECTED] Subject: RE: [PHP] PHP using Forms Try this: $Home = nl2br($Home); // nl2br converts newlines to brs See http://www.php.net/nl2br for more info. (Incidentally, I answered exactly the same question yesterday, in exactly the same way. *Please* check the list archives/last few days postings/manual before posting this sort of thing :-) HTH Jon -Original Message- From: Mike Mike [mailto:[EMAIL PROTECTED]] Sent: 04 May 2001 15:12 To: [EMAIL PROTECTED] Subject: [PHP] PHP using Forms Hello, I have a form field TEXTAREA name=Home ROWS=10 COLS=40? echo $Home ?/TEXTAREA with this data in it: My Home 11 North 5th St St. Paul MN Phone: (555) 555- Fax: (555) 555- E-Mail: [EMAIL PROTECTED] When submited it goes into a mysql database. The problem i'm running into is that the output looks like this after the call from the mysql database to html: My Home 11 North 5th St St. Paul MN Phone: (555) 555- Fax: (555) 555- E-Mail: [EMAIL PROTECTED] How do I get it to print out with line breaks like how I have typed it into the form? Thank you --Mike __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices 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] ** 'The information included in this Email is of a confidential nature and is intended only for the addressee. If you are not the intended addressee, any disclosure, copying or distribution by you is prohibited and may be unlawful. Disclosure to any party other than the addressee, whether inadvertent or otherwise is not intended to waive privilege or confidentiality' ** -- 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] __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices 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] subtracting Dates
Hello, I am trying to make a hit counter graph that will have 7 days to it. Monday thru Friday. I'm having problems getting the last 7 days. For instance today is 05-01-2001 I would like to determan the previous 7 days from that date. In VB Date - 7 = 04-24-2001 I would like this to work for any date using php. Here is what I have so far... $t = (date (m-d-Y)); echo $t; // output 05-01-2001 echo br; $r = $t - 7; echo $r; //output -2 but now $r returns -2 How do I get $r to yesterdays date in this format. 04-30-2001 Thank you --Mike __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices 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] Spacing between $row[City],$row[State]
Hello, Is there a way to get spacing between $row["City"],$row["State"] in the html output? I've tried echo "$row["City"], nbsp; $row["State"]"; and a bunch of other things and get Parse error: parse error, expecting `STRING' or `NUM_STRING' or `'$'' . The way I want the output is as follows: Duluth MN but I get DuluthMN Thank you --Mike __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/?.refer=text -- 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] sorting a csv text file in PHP
Hi list, I have a csv text file that looks like this: Mike,1,Monday 12th of February 2001 02:14:09 PM Bob,3,Monday 12th of February 2001 02:14:17 PM Marry,2,Monday 12th of February 2001 02:16:38 PM I'm trying to get it to sort by the 2nd value (number descending and to show only the top two highest scores: Like this.. Bob,3,Monday 12th of February 2001 02:14:17 PM Marry,2,Monday 12th of February 2001 02:16:38 PM This is what I have for code now: // show high scores $lines = file("quiz.txt"); sort($lines); for ($ i=0; $i count ($lines); $i++){ $thisline = explode(",", $lines[$i]); echo "br"; for($j=0; $j count($thisline);$j++) { echo "$thisline[$j]" ; } Is this possible to do? I'm running linux with php3 Thank you --Mike __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.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] To much PHP (Newbie)
Is there a such thing as to much code in an include file that will break it. Assuming that you have, say 20 people hitting that one page simultaniously. Will it just slow things or will it actually break (As in show code to the viewer)? Thanks --Mike __ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices. 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]