Hello,
I'm currently working on a project that requires me to do the following:
- Find the numbers between any two given integers between 1 and 365 (i.e: 1 and 9, should echo 1,2,3,4,5,6,7,8,9) I'm not exactly sure how these integer should be stored (array, etc.) But they need to be written to an SQL database, I was thinking a for loop, but I'm not sure how to do this.
Please help,
Jeff
Find numbers between 1 and 10
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
generally
Code: Select all
INSERT INTO
tableName
(field1, field2)
VALUES('value1', 'value2')Yes, I know that lol. But I don't know how many values I'm going to have, I could have 365 values, or I could have 2.feyd wrote:generallyCode: Select all
INSERT INTO tableName (field1, field2) VALUES('value1', 'value2')
Thanks alot Feyd, much appreciated. I'll be sure to PM you the next time I need helpfeyd wrote:A foreach() may help, although if your database supports extended inserts, I'd use those too.
There's no need to store every number in the database... store the minimum value, and the maximum value, and then when you take it out of the db, do this...
Code: Select all
$array = range($min, $max);