Hello,
I need to write a PHP script capable of doing the following:
- Grab information from a database and load it into an array (I think).
- All information that is going to be grabbed are going to be numbers.
- I then need to use in_array to check if the array containing the values from the database match a number in the script.
I'm not exactly sure about how I should go about loading information from a database into an array, the database structure will have one field named 'date', this will contain the number I want to extract. It will have another field named month. I need it to grab all the dates that correspond to any given month (say, january). Doing that alone isn't a big problem, I can make it output, but I can't make it load into a variable.
Any help is appreciated.
Jeff
Loading a variable with content from a database
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Unless you have a strange storage format, there's no reason to pull all the data into php to search when the database can perform the action faster and with less memory requirements.
The basic idea is:
The basic idea is:
Code: Select all
SELECT field1, field2 FROM table1 WHERE field3 = 'some value';