Find The Closest Number In A Given Fixed Set Of Numbers
I have a number and need to find the closest number in a given fixed set of numbers. The fixed set of numbers are 1 (increasing by 6.5%) -> Infinity. (1.000,1.065,1.134,etc.)
View Complete Forum Thread with Replies
Related Forum Messages:
Find Closest Images Through Timestamp
I am trying to create a image browser in such a way that when the user selects lets say 9:00 am. I show pictures in the folder for the camera at that time. But if there are no images in folder saved from the camera at 9:00 am. I show images in the folder for the closest time i.e 5 images for before 9:00 am anytime and 5 images after that. I have got it working for saved images in the folder for time (given). But now need to know how can i show 5 images before and after if no images at 9:00 am. I can only use hour (no minute or second can be used).
View Replies !
Zipcode And Find A Gamestop Store Closest To Your Zip
On some sites like gamestop.com they allow you to give your zipcode and find a gamestop store closest to your zip. Circuitcity.com contains the ideal functionality im looking for in a system like this does anyone know how to do this or can provide a link to a how to type of thing so i can make one of my own.
View Replies !
How To Pick The Closest Number
I've been wondering about this for a few days. I have an array containing 4 numbers: $listofnumbers = array(0,15,30,45); Then there's a variable that could contain any number between 0 and 59. $actualtime = date('i'); Using the above I want to find out which of the numbers in the array is numerically closest to the value of $actualtime. So if $actualtime = 34 then I want to return the number 30 if $actualtime = 11 then I want to return the number 15 etc. I'm sure there's a simple solution but can't figure it out.
View Replies !
Delete Fixed Number Of Records
i have a table with one field. this field saves times as records. i want to there are 40 recoreds always. in other mean when inserts 41'st record then 1'st record be delete how to delete fixed number of records at a time of first of my records asc (like select). in other mean i want to like: delete from table order by time asc limit 0,1
View Replies !
Find The Ratio Of Two Numbers
I am trying to make a function that would find the ratio of two number and return them in the format X.YY (because I would later need to format them in a table and align them). I tried this PHP Code: function divide ($numerator, $denominator) {   if ($numerator == 0 || $denominator==0 )     return (round(0,4)*100);   else     return (round(($numerator/$denominator),4)*100); }
View Replies !
Find The Mode In List Of Numbers
I'm doing some matching of user profiles and have gotten this far. First select the associations related to the user's account. Second select all the other user id's who also have those associations in common. Third create a list (array) of user id's of all users who have matching criteria. Now I want to select from that list the user id's that appear most often (meaning that they have the most associations in common with the user) Mathematically this would be the MODE of the set of numbers. I have searched the manual and cannot find a MODE function. Code:
View Replies !
Numbers To A Phone Number
I have a field that stores phone numbers as flat digits (1555555555) is 1(555)555.5555 and I was wondering if there is a way to turn digits to a phone nubmer based on country? anyone heard of anything like that
View Replies !
Find The Max Number
In the array I have some values.... The max($arr) returns the string the maximum number.... But my problem is max value what I am getting is 999 instead of 1000 How to convert the string values to integer
View Replies !
Find The Next Number
I have a folder in which im storing files like: 1.jpg 2.jpg 3.jpg 4.jpg 5.jpg and i want to find what the next one is. So say the last file in that folder is 9.png, i want the script to return 10.png. The thing is, its not in the same folder as the script running, so I don't think glob would work, but even if i used glob("[1-9]+.jpg") how would i sort them and find the next one.
View Replies !
Finding Number In A String Of Numbers
I have a string of numbers separated by comma ',', eg $str = "1, 3, 56, 8, 9, "; (there's a comma at the end, because it was easier for me to do so) I need to compare a number ($id) if it's in the string. At first I thought, that strpos() will do the trick, but then it struck me, that 6 will be found (because of 56, ).
View Replies !
Find Number Of ID's
Doing a var_dump($_GET) I get this: Code: array(9) { [["C"]=> array(1) { [0]=> string(24) "22234,174886,18657,18678" } ["FB"]=> array(1) { [0]=> string(11) "7500,181888" } ["SB"]=> array(1) { [0]=> string(0) "" } ["TB"]=> array(1) { [0]=> string(0) "" } ["SS"]=> array(1) { [0]=> string(0) "" } ["OF"]=> array(1) { [0]=> string(0) "" } ["DH"]=> array(1) { [0]=> string(0) "" } ["SP"]=> array(1) { [0]=> string(0) "" } ["RP"]=> array(1) { [0]=> string(0) "" } } I need to find the total count of numbers within the array. For example...in this one there are 6 ID's (22234,174886,18657,18678,7500,181888).
View Replies !
Find The Number Of Days
I have a datetime field in a mysql database and i want to output how many days, hours and minutes are left between the current date and the future date. So far i just convert the datettime to a timestamp like so: $start = strtotime($began); Where $began is the current time, basically i just need to know how to convert a timestamp to days, hours ect If i was to minus the current timestamp from the future timestamp.
View Replies !
Find Biggest Number
I think I sort of know whats causing this problem, but i don't know a way around it, heres my code: $threadSql = mysql_query("SELECT * FROM `thread` WHERE `boardid` = '$id'"); while ($thread = mysql_fetch_array($threadSql, MYSQL_ASSOC)) { $newestpost = $thread["newestpost"]; $blank .= $newestpost.", "; } $blankc = substr($blank, 0, -2); $top = max($blankc); echo('<p>'.$top.'');
View Replies !
Generating Random Number Without The Generated Numbers Already ??
i make a function that return random numbers but it will not generate another random number if he already pass the value for example it return 2, so after i call the function random again it will not return another 2 i want another numbers to be returned instead ? function random($max){ srand ((double) microtime( )*1000000); $random_number = rand(0,$max); return $random_number;}
View Replies !
Preserve White Space For Numbers Less Then A Specified Number
I have a page that connects to my database and I have prices that are displayed in the page from it using number_format. I want to be able to add a whitespace between my dollar sign and the actually number for any number that falls below $ 10,000. So I tried this: // Check To See If Price Is Below $ 10,000 if ($price < 10000) { $filler=" "; } PS: My "$price" field has not been set to number_format; I used a different variable to do that; like this: $var1=number_format($price); I put the above code below mysql_query, saved it, and tested it, but instead of only placing a whitespace between dollar signs and prices that were less then $ 10,000; it adds a white space to all prices. I put the code below in mysql_fetch_array. echo "$ $filler$var1"; So what should I do to correct this?
View Replies !
Find Highest Number In Field
I need to look up 30 entries from a given number in a mysql query, the catch is, if it hits 1 I need it to jump to the highest number in the database, or if it hits the highest number then it goes to 1... I'm using a while loop to display the information... any ideas? btw, I'm making a quiz, and pulling questions out of a database by an id that auto increments...
View Replies !
Query To Find The Largest Number
I've got a table (MySQL) with a field called: 'java_num'. It's a varchar(4). It's going to have a number in that field anywhere from 001 to 999. How can I make a query in PHP that searches through that field and finds the largest number?
View Replies !
Find The Number Of Entries In The Table
Given a range of dates, say 2006-01-01 to 2006-12-31, I need to find the number of entries in the table for each day and the number of entries for each month (doesn't have to be one query). A final result would look something like: Code:
View Replies !
Find Number Of Check Boxes
I have very standard PHP - MySQL application that reads in some data from a table and for each row, puts a check box at the start of the row. Now the check boxes are variable in number, depending only on the number of current records in the database table. My question is: how do I count the number of check boxes rendered at any one time. I tried having a global variable and incrementing it each time a row is rendered on screen, but it does not work.
View Replies !
How Can I Find The Number Of Channels In An Image ?
I would like to know how many channels an image has. The image may be a BMP, JPEG, PNG, or any number of other formats (but these are the most common). The image might also have an ALPHA channel. The image might be compressed (like in PNG - you can decide how compressed you want the image to be). At first I used the "getimagesize" function to retreive the number of channels, but I realised : 1. It some times returns 0. 2. In images with an ALPHA channel - it doesn't count that channel.
View Replies !
Find A Class By Entering Either An Id Number, Or Instructor
I know a (tiny) bit of php, and no mySQL, but I need to accomplish a good sized task: I've recently been put in charge of a folk school's website, and I need to have a database with all the class descriptions, who they're taught by, and ID number. Then, the users would have to be able to find a class by entering either an id number, or instructor, or just browse through all the available classes. Sorry I can't be more specific.
View Replies !
How I Could Compare Two Dates To Find The Number Of Days That Seperate Them.
I was wondering how I could compare two dates to find the number of days that seperate them. For instance, after a user signs up to my website, they would see a specific message for only a week. Obviously this is easy if they signed up on the 14th and today is the 16th, but what about if they signed up on the 29th, then I need to figure out for the next month.
View Replies !
Mysql Closest Value
I have two tables, one is a survey of sites (not websites) with longitude and latitude cordinates [Survey Table]. The other is a database I retrieved from NGA; GNS with place names, longitudes and latitudes [Locations Table]. I'm trying to get the suburb name from the locations table by joining the cordinates, yet I have know idea where to begin on this. Because it's a join I don't think I can retrieve the closest suburb to the longitude and latitude with a simple order statement.
View Replies !
Get Next Entry With Closest Date...
I'm trying to run a query to return a result from the database that is enter with the next calendar date. So, I have two entries in the database, entry 1 has a match_date of May 6 (20060506) and entry 2 has a match_date of May 13 (20060513). So right now, entry 1 should be displayed until May 7, then May 13 should be displayed. Code:
View Replies !
Zipcode Range From Closest To Furthest
I am learning PHP and am trying to get Zipcode Locator working. I am using the script by Micah Carrick. I could get it working with the zipcodes printed within a certain range. But am unable to provide the functionality for range from closest to furthest.
View Replies !
Mcrypt Fixed...
i downloaded the php_mcrypt.dll from the windows binary 4.3.2 release and copied it into the php/extensions directory (after stopping apache of course) and then the correct version of libmcrypt.dll into the winows/system32 directory.
View Replies !
[fixed] Setcookie Isn't Working
I have a login script that checks whether the information put into the form is correct, and if so it tells them, and sets a cookie, for further use. I get no errors, but when I try and echo $username (the cookie name) I get $username, and not the actual value.
View Replies !
Fixed Font Size
I making a web site where people can change the font size with a form on a seperate page. I store the value in session-variables and read them every time a page is loaded. I wonder if it is possible to prevent people changing the fontsize with Mozilla or IE menu's? Can anyone tell me more about this?
View Replies !
Fixed Size Image
I would like to change the image size to a fixed size (150 x 150), I've tried many ways but I end up with an error, this is due to my lack of coding knowledge. <?PHP $sql = "SELECT * FROM `seedling` ORDER BY `id` DESC LIMIT 25"; $results = mysql_query($sql); print "<table>"; $column = 1; while(($row = mysql_fetch_assoc($results)) !== false) { if ($column==1) { print "<tr>"; } print "<td>"; print "<img src="http://www.mysite.org/myfolder/"; echo $row['Bloom_Name']; print ".jpg">"; print "</td>"; if ($column==5) { print "</tr>"; $column=0; } $column++; } print "</table>"; ?>
View Replies !
Unpack() Fixed Length File
I'm trying to unpack() a fixed length file. Below is some of the code I'm using. I know that the file is opening, because I can display it using fread(). But when I use the code below I do not get any thing to display. PHP Code:
View Replies !
Add A Fixed Image (Captcha Kind)
I need to add a simple image with something like "2+2=" in order to humans filling my form type in a text field "4". I don't want a captcha but I need something similar easy to add to my form. My php form page has something like this: ....
View Replies !
My Fixed-width Text File
1. the text file should be uploaded by the user (is there any codes you can provide) 2. i have a text files that is not comma-delimited, only fixed width. though basically i just need 2 - 3 fields to be imported to the database. (the reason why i need this because of the nature of legacy database we're using. Code:
View Replies !
Reading A Fixed Format File
I have been searching for days trying to find an example of a php script that can read a fixed format file and store the values in variables. I want to display a html table with teh values, but I want to format the columns nicely thus I need to store the values in variables. Would anybody have a simple example of a php script that can read a fixed format file? I have provided an example of the file definition below. Just a couple more question: I need to skip the first record as that is the header, is it possible to skip the first line? The file name changes, todays file name is: f080105.dat, it uses the date, but the date of when the file is available might not be todays date as per the example, of f080105.dat. Code:
View Replies !
Passing Requests Through My ISP To My Local Fixed IP
I have a demo application that runs on my local fixed IP, say http://x.x.x.x/cgi-bin/myapp.exe/search?item=1&cost=2 I'm new to PHP, is it possible to prevent people seeing my x.x.x.x ip address by putting a PHP file on my external ISP site and passing the request from there to my local server here? I've had a look at redirect in Apache and PHP but they still show the x.x.x.x in the browser.
View Replies !
FIXED: PEAR::prepare Problem With Transactions
I spent all this afternoon to solve this problem, so I thought to write two lines to describe this strange behaviour..... - I'm using PHP with PEAR:DB package. - I set autocommit to false - I prepare a statement - I execute it - THE PAGE NEVER COMPLETES SOLUTION: - Use the 'query' method intead of the 'prepare' method. Pass the 'query' method the prepared arguments. $res =& $DB->query('INSERT INTO person (id,username)VALUES (?, ?)', array(1, 'Dario'));
View Replies !
|