Creating A List Of Numbers (143-160, 172-181 Etc)
I have a list of ID's that I would like to compile a easy to read list of ID's. Instead of listing out the numbers like
143,144,145,146,147,148,.....
I would like a easy to read list of the ID's grouped together like below. Does anyone have any suggestions?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Creating Page Numbers
This is what i'm essentially trying to do. I'm reading a load of rows from a DB (lets say 97). I want to show 10 rows in 1 page. so that would be 10 pages with 9 having 10 entries and 1 with 7 pages. I start off with reading all the entries at once. so i get 97 rows and store it in $result. The first problem i have is how to get the number of pages. 97/10 returns 9.7 - is there any way i can get 9? I've found that the only way to do this in PHP is with $pages = (( $numberOfEntries - ($numberOfEntries % $numEntryPerPage)) / $numEntryPerPage); Secondly, how would i go about making the links to the page number on top? like say 1,2,..9,10 and Third, how would i read those from the $result? Like when i click on 2 how would i go about reading rows 11 to 20?
Save List Of Numbers
i have numbers saved as $data[$i]; if $data[0]=1 $data[1]=2 $data[2]=3 $data[3]=4 then, I want to save as $k = 1,2,3,4
Php Syntax In Building A List Of Numbers
i'm trying to build output that will get used to build a file, containing groups of numbers seperated by commas, with each group seperated by a space. Confused ? It should look like this. 0,30 9,12,17 1,2,3,4,5 * * that's right, it's going to be a cron file eventually. it's going pretty well except for.... this is the segment that will build one clump of numbers - the 'hours' group of the line in the file. this code is the submitted to by a form containing a number of fields called 'cbHour[]' PHP Code:
Create A No-scroll List With Page Numbers ?
I have a site that lets users select a list of music based on genre etc. so each list could be made up of different tracks every time (www.makin-trax.co.uk), especially as I'm adding new tracks each month. I'd really like a way to stop all lists from scrolling, if they are longer than the visible page. I know everyone has a different amount of viewable space on their monitors, so I need a way of restricting the list to a max of about 15 tracks per page, and a way for the user to select which page from that list they'd like to view (eg prev next first last particular page number etc.) This is a fairly new music site, so at the moment the only list that goes past the bottom of the page is the dance genre but, as I mentioned earlier, I'm adding new tracks so all genres will become too long for a single page at some point.
Creating List Box Using Fields On My Db
Is there a way to add to this by using infomation on my table. Basically my table will have price and type and i want to add those 2 in the list so that it will look like this: £12,000 - Steel £12,500 - Wood And because its a list box the user can then click which ever one and then i can submit it using a form ? ( i can do the form bit) but i cannot do the bit where by it creates the list in the box.. this is the html of the box so far: Code:
Creating A Live/logged On List
Is it possible to determine the currently logged on users? I have a login section of my site that is controlled by sessions and would like to display a list of the currently logged on users. I did think of creating a 'live' table storing userids and adding/deleting when they login/logout. Logging in is ok, but how do you maintain the list if they just close down without letting me call the relevant unregister session functions?
Creating A Linked List Of Wmvs
I have a place to ftp wmv's I need some sort of script that will basically just list the filenames of the content of the folder, and the ability to make them links as so you click and the wmplayer opens the files. i'm going for simplicity here, i tried using ftp via a weblink, only problem there is to get permissions to where they need to be you'd have to chmod all day. back n forth. i've seen these before, I'm trying to avoid turning it into an automated system via forms and sql.
Creating A Product List Page!!!!
I was able to retrieve information from the database but I get an error message that says "Notice: Undefined variable: SubCatID " and I can`t get my list to display right. I wanted my SmallIMG to be on the right and my and my ProductName to appear right beside it along with the UnitPrice. Kinda like straight across because I want it to be a link to the individual product page. If I can get help on this part, I can get started on my shopping cart. Code:
Creating Simple Unordered List Menu From XML?
Does anyone have any examples or links to examples of generating a simple unordered list menu with multiple levels from an XML file? We are redesigning the navigation on our website and I was hoping to make this as flexible as possible.
Removing Numbers From A Set Of Numbers
Say theres a limit of number choices from 1 to 10. (not including 0) Now these numbers are buyable so say some one buys number 7. With a query or what ever is needed i need to find a way for the screen to then display: 1 2 3 4 5 6 8 9 10. As you notice 7 is not missing.. but it could be any number and more than one number that has already been taken... How can this be done in PHP and MYSQL or will it require some other script?
List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that: - reads in all the files in a particular directory - displays the file names in a html list and makes a link of them: <ul> <li><a href="filelocation1">filename 1</li> <li><a href="filelocation2">filename 1</li> <li><a href="filelocation3">filename 1</li> </ul> etc.? So basically it creates a list of links with the contents in that directory, so you can download them from there.
Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not. What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings. SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = Ƈ') ORDER BY msgno DESC LIMIT 100 What I'm getting, though is a list that looks like this: mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary. If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1. mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 2214 msgno: 0412141622 msglist: 1 mbxno: 2189 msgno: 0412141408 msglist: 1 mbxno: 0000 msgno: 0412141213 msglist: 1 mbxno: 0003 msgno: 0412141213 msglist: 1 mbxno: 2265 msgno: 0412132029 msglist: 1 mbxno: 0000 msgno: 0412131950 msglist: 1 How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?
Mailing List Manager, Send To List
I'm looking for a mailing list script (php) that has a function to let users to reach out to all recipient on the list by simple send the email to a specific maillist- address. Mailman has this functionn but as a just got a webserver account I can't use mailman nor install it.
SQL And Numbers
In my database I have a field with numbers, when I arrange them DESC, it says 5819 is greater than 500355. Why is this? My numbers show in this order: 903669 5819 500355 319 -50002 I tried clearing them and re-entering the numbers but no luck.
Php Numbers
the maximum number of $stat['cash'] i can hold in my database is 2147483647. how can i increase that?
Format Numbers With PHP
Hi!! I want to display a number with a monetary number. Ex. US$12,345.87 is there a function a something way to do this? Yes , I know that I can do but if it ready why invent the wheel again!!!
Random Numbers In Php
I am trying to develop a banner ad rotator on my site. I DO NOT need to know the precise number of ads served per banner. Therefore, I do not want phpAds as it would be overkill and slow down my site. I have 3 banner spaces per page. Currently, I have 4 different sponsors. I just wanted to run a random number mechanism so that every tme the page is requested, 3 out of the available 4 banners are chosen automatically. So my current doe (pusedo) is something like this: seed... rand... if($x=1){ banner1 banner2 banner3 } if($x=2){ banner2 banner3 banner4 } if($x=3){ banner3 banner4 banner1 } if($x=4){ banner4 banner1 banner2 } Is this the best way? I do not see his method as being very scalable as it requires me to manually input the possible combinations. I only need a simple solution that is scalable to many sponsors but since I do NOT need to know exact impression levels (all sponsors divide up the impressions equally), I do not want to use MYSQL to "kill a fly with hammer."
Sorting Numbers
I'm trying to sorting a file in a directory. It works well but it sorts me the number in this way: 1 10 11 2 20 21 .... is there a way to sort in this way? 1 2 3 ... 10 11 12 this is my code: <?php if ($handle = opendir('/home/davide/')) { $files = array(); while (false !== ($file = readdir($handle))) { if (($file != "." && $file != "..") AND (eregi($select,$file))) $files[] = $file; } closedir($handle); sort($files); foreach($files as $file) { $ext = substr(strrchr($file, "."), 1); if ($ext == 'txt') { $idx = str_replace('.txt', '', $file); echo "$idx"; } } } } ?>
Formating Numbers?
I'm wanting to format numbers with ',' e.g. 100 => 100 1000 => 1,000 10000 => 10,000 and so on...
Search On Numbers
When do a mysql search such as LIKE '%a' How do i search on the numbers [0-9] I have tried LIKE [0-9] but this doesnt work.
Numbers And Decimals
I'm trying to get this 124110 to look like this 124.11 . Here is the code I'm using to get my numbers PHP Code:
Ordering Numbers.
Say I'm selecting a few numbers from a database... Example: 12, 80, 100. // MYSQL SELECT number FROM db.numbers ORDER BY number ASC; Results: 100, 12, 80. How can I get these numbers to display in the proper numerical order: 12, 80, 100?
Converting Numbers
I am using the base_convert() function to convert numbers between binary, hexadecimal, decimal, etc... It works great, but I have problems converting numbers with .'s Like this number: 15.20 decimal will be 1111 as binary... is there any way to include the rest of the number in the convertion?
Random Numbers In Php
I found this code on this forum and it works but i don't know what the lines in bold mean. $data = "AbcDE123GHIJK4LMN567QRSTU89VWXYZ"; $data .= "aBCdefghijklmn123opq45rs67tuv89wxyz"; $data .= "0FGH45OP89"; $Random .= substr($data, (rand()%(strlen($data))), 1);
Formatting Numbers?
How can I get from "5.99" to just "5"? I tried researching the manual, but they are full of rounding numbers and decimal points.
Rounding Numbers
I am having trouble getting a script to display 2 decimal places when two numbers are added or multiplied. I need the script to display 15.70 + 5 as 20.70 not 20.7 and 7.5 * 1.25 to display 9.4 not 9.375
Random Numbers
I want four random numbers being created but all the numbers have to be different. For example: no 1,2,2,4 or 4,3,1,1, etc... For example a right result would be 3,4,1,2. So no double numbers. PHP Code:
Random Numbers.
I'm trying to create a script that will create four random numbers, discard the lowest number and add the remaining numbers. Could someone offer suggestions? Here's what I've got so far: PHP Code:
Getting Round Numbers
$new_width=$_POST['new_width']; $existing_width=$_POST['existing_width']; $existing_height=$_POST['existing_height']; $new_height = ($new_width/$existing_width) * $existing_height; The above returns too many digits I need to round it to the closest inferior number if not equal to .5 or to the superior number if above .5 I do not think that the round function can be used or I do not find the correct way to use it.
Numbers In Forms, 0.5 Vs .5
I am (have) wrote an intranet industrial app that requires the user to enter a number which is compared to a high and low limit. If the low or high limits have a 0 in front of the decmial the entered value must also. The actual comparison is done in javascript as pasted below. If a return true is given then the data is written to the database. ex low limit 0.5 high limit 0.6 entered value .55 is returned as OUT OF TOLERANCE CONDITION whereas entered value of 0.55 is returned as GOOD! For the time being I have consoled my users to be sure to enter a leading 0 when dealing with decimals. How do I correct this, such that .5 and 0.5 are considered valid entries? if ((document.testform.actual_value.value < document.testform.upper_limit.value) && (document.testform.actual_value.value > document.testform.lower_limit.value)) { alert("Data Good Writing the Data to the Database") document.testform.pass_fail.value="P" return true } else { input_box=confirm("Click OK to record a NC or Cancel to Re-enter"); if (input_box==true) { // Output when OK is clicked alert ("You clicked NC, TAG the item as REJECT (RED)"); return true } else { // Output when Cancel is clicked alert ("You clicked cancel"); return false } }
Missing Numbers
I am trying to work out if there are missing numbers in a range stored in a database table. The first problem is the number range is prefixed with UR (eg UR12345), what I need to try and work out it are there any numbers in the range missing, the range...
Adding Numbers In Php
Sander Peters wrote:[color=blue] > Is there somehow a workaround to let PHP print 4 decimals?[/color] http://www.php.net/download-docs.php
Random Numbers
Does anyone know how to make $rand(0,3) very common, $rand(4,6) rare, and $rand(7,9) extremely rare and link it to echo one number? eg: blah 3-3 blah would be very common or 2-2 or 2-1 etc. Also, if it helps, the 0-3 has a 75% "success rate", 4-6 has 40, and 7-9 has 10.
Php Switch - Between 2 Numbers?
I've got a variable called $score and this number can be anywhere between -20 and 20. And i'm trying to use a switch statement instead of a bit if statement, i need to do something like 'between -20 and -15 echo 'this' ' but i think i'm doing it wrong, how do you do 'between' values in a switch statement?
Increment Numbers
i use a java scrip to expand content from a rss feed. It doesn't work because when all feed are showing, all javascrit have the same ID and each ID shoud be unique, can i create with php or javascritp a new ID for each java script created in this php loop with my result? Like increment by one for each result? I can add php into result because it's not inside javascript. like: maintab1 maintab2 maintab3 But each element are not in the same php bloc code.
Getting Numbers From A String
I have a string that I need to get the numbers out of. The string has both text, and numbers. I want to get rid of the letters, and only keep the numbers. Is this possible??
PHP Numbers To Months?
I'm creating a calendar type thing. The variable $month will be a value ranging from 1-12. I need somehow to translate 1, the first month, in january - 2 into february - 3 into march etc. It auto increases so i cant just change the value to jan, feb. $month has to server two purposes and i dont know how to get it to turn "1" into "january".
Multiplying Numbers
so lets say i have $a (a number) and $b(another number) to add them i do this: $c = ($a+$b) then echo $c but what do i do when it comes to multiplying those two variables?
Only Allow Numbers In Form
Are there any functions that can be used to delete all other characters than number in a form or a variable?
Numbers Replace
What function can I use to replace numbers.. For example if I wanted to have php mailer email the credit card number say 111111111111 to the admin but I want to replace most of the numbers like this **********1111 for example.. What function would I use?
Eregi Numbers
I want to check that the variable 'show' is a number no larger than 50, I decided to use the eregi function: if(eregi('^[0-50]$', $show)) { } the function ignores the 0 of 50 and checks that the variable 'show' is no larger than 5 instead, how do I fix this?
Validating Phone Numbers
Hi there, what would you guys suggest be the best way to validate two phone numvers that are required. First being a normal phone number with state calling code, required in the following format (xx)xxxx-xxxxx Only numbers allowed And secondly a mobile number in the format of xxxx-xxx-xxx only numbers allowed? any suggestions would be great whether to do a string check or use reg expressions.
Counting Numbers In Array
Assume I have an array which contains the following numbers: 2 5 7 9 How would I go about adding them to eachother?( e.g. in this case 2+5+7+9 would be 23)
Determine Four Highest Numbers From DB
Got this interesting problem, I have a table and in there I have a field called itemid which is set to integer, and basically its a list of numbers. The problem is, how do you go about calculating the 4 highest numbers? I've tried using SQL command but I don't think I have the version which support sub selects select * from t where number in (select max(number) from t)
|