Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Fetch A Range


How would I go about generating a column of incrementing dates when provided a given start and end date/number of days? e.g.:

2006-05-07
2006-05-08
2006-05-09
2006-05-10
2006-05-11
2006-05-12
2006-05-13
2006-05-14
...

These dates should be in seperate rows. I know I could create a table and then have PHP automatically populate it, but I would like to know if there is a way that I could do this with just MySQL. I've done some searching, but have had trouble locating exactly what I need. Ultimately I'm going to use this table to peform a join against another table that has a date field, and I want a seperate copy of each row for every day that it coincides with.




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Weird Warning: Db2_fetch_array() [function.db2-fetch-array]: Fetch Failure
I've written a class Cars that is a holder class for <code>Car</code> and it's designed to fetch Car records from  out DB2 database. And it works fine until I return the $result to the calling function.

I can use my $result to print html table but only inside the getAll method.
When the $result is returned to the calling function the $result source is no more working  properly as expected by me though the resource id stays the same. Code:

View Replies !   View Related
Need To Fetch The Minimal Value Of The Items In The Array And Fetch The Key
function func_select_min_id($type_id_array){
foreach ($type_id_array as $type_id)
$item_query = 'SELECT * FROM prefs'." WHERE id='".mysql_real_escape_string($type_id)."'";
$item_result = mysql_query($item_query) or die ("Error doing query for this item ");
$item_row = mysql_fetch_array($item_result);
$rewards[] = ($item_row['paid']*$item_row['paid2']);
}
}

what this function does isnt that hard, I pass it an array of possible id's, which are basically mysql field id nr's and it looks up the concerning row, fetches 2 values and multiplies the 2, then the result is stuffed in a new array . My problem is I need to fetch the minimal value of the items in the array and fetch the key (so I need to re-establish which key actually corresponds to the product of the 2 values) .

View Replies !   View Related
Specify A Date Range And Have Only Entries That Are In That Date Range
I have this database with lots of info all time stamped with this format "May 15 2007  9:44AM".  What I would like to be able to specify a date range and have only entries that are in that date range be pulled from the table so that I can post the results. I know this must be possible but I have no idea host to even start.

View Replies !   View Related
Using A Range In Php
Hi,

I am trying to create a online blood glucose level reader. I have created a page with the following text fields (which become variables on the following page).

name which becomes $name
glucose which becomes $glucose

View Replies !   View Related
Range Of Value
I have the following scenario.

Let say I have A1, A2, A3, B3, B4, B5, MC01, MC02, MC03

I also have the following value "A1-A3" ,"MC01-MC03", "B1-B4"

Let say I need to write a function to detemine A1 is belog to A1-A3, MC2 is belong to MC01-MC03, B4 is belog to "B1-B4". How could I accomplish this.

View Replies !   View Related
Range A-z + 0-9
i have a lyric page that sort artist from a-z each letter; however, i want to add 0-9 in front of a, b, c... example:

0-9 in 1 group

A

B

C
.
.
.
Z

i try to use this code, but the song title from 0-9 does not appear. Anybody know why? (again, i want my array to be like 0-9, A, B, C, D...Z). PHP Code:

foreach(array_merge(array(&#390;-9'),range('A','Z')) as $_letter)

View Replies !   View Related
Age Range
I have a field with user's date of birth. I would like to be able to show where the age fall into i.e.

25-30 years old

instead of

27 years old

I suppose I need to create an array with the ranges but not sure how to do the rest.

View Replies !   View Related
Fetch?
If I want to retrieve a single row. I would make a query and than use msql_fetch_row. (If I use this in a loop it will fetch the next row until it becomes false).

If I want to retrieve multiple rows. I would make a query and than use msql_fetch_array etc..

Say I use a loop with msql_fetch_array and display the data in a table do I have to make a new query to display say the third row of the original table somewhere else on the page?

View Replies !   View Related
PHP SQL Fetch
I want this script to get the contact info from the database and simply display the row i want it to. My database structure is like this

id contact_key contact_value
1 ContactAddress 123 Test Close

and so on

<?php
$query = "SELECT * FROM $DB_Contact";
$result = mysql_query($query, $Link) or die('Contact get setup died with error: '.mysql_error());
while($ROW = mysql_fetch_array($result)) $sxContact[$ROW[contact_key]] = $ROW[contact_value];
?>

<table border="0" cellpadding="0" cellspacing="0" class="site_table" align="center">
<tr>
<td width="220" valign="top">
<?PHP echo parseSpecial($sxContact['ContactAddress']); ?></td>
<td width="380" valign="top">
<br/></td>
</tr>
</table>

View Replies !   View Related
PHP Date Range?
Is there a way I can get PHP to echo a date range, and have it update weekly? I want it to show "Monthnow", "Datenow" - "Monththen", "Datethen" (Where Month/Datenow is the last recognized Wednesday, and Month/Datethen is the next upcoming Wednesday). Example, for the current week, the page displays: July 23 - July 30.

I'd like it to update that automatically on a weekly basis, if possible, using the date/time features of PHP. (I have no database).

View Replies !   View Related
Ordering Range()
how to reverse the order in following script? PHP Code:

View Replies !   View Related
Dynamic IP Range
I do not know where posting it? Is there a way to find (and where to find it) the high end and low end of the USA dynamic IP range. I am not even sure that it is possible to get such an answer.

View Replies !   View Related
Range Of Dates
I'm trying to create a report in PHP/HTML showing all deliveries made from our database. I'd like to automatically generate a different report for each month of the year.

So I need to do two things: First I need to be able to find the earliest occurence of the date in the field called date_delivered in my SQL database - is there a particular function I should be using to achieve this?

And then secondly I need to automatically create a link to each month which will take the user to a page showing all deliveries that month?

View Replies !   View Related
Identifying A Value Range
i have a form that submits to a php file, the form basically has a hidden field called number:

<input type="hidden" name="number" value="12">

i know how to read the value of that, its simply putting <?php echo $_POST['number']?> but what i want to do is check if the number is between 1 and 25 and if it is then echo A else if it is between 25-75 then echo B else if it is anything above 75 then echo C .

View Replies !   View Related
Out Of Range Error
When I run this query on MySQL 5.0 server through PHP 4.3.10, I get an error.

mysql_query("INSERT INTO `tbl_graphics` VALUES('', '$height', '$width', '$format', '$details');") or die(mysql_error());

MySQL Error: Code:

View Replies !   View Related
IP From Private Range
Is it possible to get client's IP (private, you know 10.*.. 172.16.* 192.168.*...) not proxy or NAT address (using cookies maybe) ? I saw few pages that can do this but I'm not sure if they used PHP and/or something else so here's my wuestion. any ideas how ?

View Replies !   View Related
Preg_match() To Specify A Range
How can I use preg_match() to check if a number is between two values (specifically 2004 and $currentYear, which is equal to date(Y))? The pattern must be between 2004 and $currentYear, I want to return an error for any year out of that range, so I can't simply use [0-9]{4}. code;

if ( preg_match("/2004¦2005¦2006¦all/i", $_GET['year']) ) {
$year = strip_tags($_GET['year']);

} else {
die("Please enter a year in the form of four digits between 2004 and $currentYear, or enter 'all' to see all years.");
}

View Replies !   View Related
Selecting A Range
How does one select a certain range of arrays without having to write them all out? I am wondering, how would one go about the following? So we have the following indexed arrays:

$array[0] = "A";
$array[1] = "B";
$array[2] = "C";
$array[3] = "D";

i'd like this fantasy if statement to work: if ($array[range 0-3] != A) print "blah blah blah"; elseif ($array[range 1-2] != A) print" do de do "; of course me putting the range inside the brakets is an absolute violation and won't work, how would i go about coding this properly?

View Replies !   View Related
How To Find IP Range
Is it possible using php to find the IP block that a partucular IP belongs in?

E.g. I can go to dnsstuff.org and type the IP address 209.126.158.167. This comes back with an IP range of

209.126.0.0 to 209.127.255.255 Is it possible to do this using PHP?

View Replies !   View Related
Getting Range Of Dates
I'd like to do a select on a range of dates. So for example I would like to select a week's worth of events. So for example I would like to select everything from 01/29/2006 to 02/05/2006 or something like that. My problem is for something like this how do I determine when the month changes and start over.

View Replies !   View Related
Date Range
The >= statement below returns rows, but when I add the 2nd statement I get nothing. Is there a better syntax to use with MySQL 4? The <= doesn't work by itself either. Looks like <= can't be used at all.

AND CloseDateTime >= &#3908;/01/2007'
AND CloseDateTime <= &#3912;/31/2007'

View Replies !   View Related
Using A Range Of Numbers
I'm trying to search for a wildcard within a variable. My question is how can i set the wildcard to be a range of numbers? e.g. my wildcard range of 19968 to 40891 should match the variable "&# 36544 ;"

View Replies !   View Related
Range Or Array?
i am trying to make a set of numbers from 0,1,2,3.... up to 100 into a variable so that i can check another variable is equal to 0 to 100

problem is i could easily use array (0 , 1 , 2 , etc but this is far to big a code and when i tried range it just put 100 into the variable.

View Replies !   View Related
Date Is Within A Range
Suppose i have 2 dates as range i.e: 10-03-2005 to 20-03-2005. Now i want to check if 15-03-2005 falls in the above range or not.

View Replies !   View Related
MySQL Between A Range
PHP Code:

$result = mysqli_query($link,"SELECT * FROM pageref WEHRE pagerefno BETWEEN $leastinterestref AND $maxpageref");

View Replies !   View Related
Boolean Range
I want to check a variable to see if it is between a range but am not quite sure how to approach this for an if tree.

$a = 1;

if (0 < $a < 2) {
do whatever;
}

I tried "joining" but using two functions 0 < $a AND 2 < $a but that doesn't use 2 as a max and 0 as a min.

View Replies !   View Related
Fetch & Process
I doing a straight forward webpage fetch and saving it to a file: CODE:

$open = @fopen($url, "r");
$urlfile = @fread($open, 50000);
@fclose($open);
$page = split("",$urlfile);
$datafile = fopen($tempfile, 'w');
foreach ($page as $line) {
echo($line);
fwrite($datafile,$line); }
fclose($datafile);

So I basically just write the fetched HTML line by line to a local file. The weird thing is I'm getting a bunch of ^M characters in the final file after every $line is written to the file.

View Replies !   View Related
Fetch A Column
Is it possible to fetch a column from a queryresult?

View Replies !   View Related
Fetch A Php File
In my HTML I want to fetch a php file (the php file is a form for a user to fill out) but I want the form pasted on my page but instead it ries to open the form page in a new window of it's own... I tried href but also include.. I don't know that I am using the include properly..  any ideas?

View Replies !   View Related
Fetch Out Of Sequence
I would like to know if there is a similar function with OCI8 (oracle) to this one: mysql_data_seek ? I would like to do twice:

while (ocifetch($stmt)) {
....
}

How can I set the cursor to the first element?

View Replies !   View Related
Fetch An Image
for some reason i cannot find how to get an image from an internet location, as i have a server for dynamically generates images and i want to get the image and save it to another server for hosting.

View Replies !   View Related
Fetch The Records
i have a mysql table.it has 2 fields . 1.register_number 2.registered_date

values
333333----2007/08/21
245678----2007/06/30
123123----2007/09/20
123222----2007/09/21
125553----2007/09/22

i have select box on a page and it's option values from january-december. when i select the month from select box and press submit button,it should fetch those records that are registered in that particular month. i just need the sql query logic to fetch the records of that particular month.

View Replies !   View Related
Fetch Data
I have a mysql database on the server and a SQL server database on my local machine. What I want to make a script that fetches the data from that mysql database on the server and stores it into the SQL server database on the local machine. Any idea about how can I achieve that?

View Replies !   View Related
Ftp Fetch Files
Ive got a problem, my server that im hosted on is a shared server and has a fire wall on the port i want to use for fetching images from another server that i rent.

The only way i can do what i want to do is by ftp, I want to write a script on my web site server that fetches all the images from my other server via ftp.

I have written a little script thats logs me in and browses the directorys, but im having problems fetching the images back to my web page server.

Ive lookd into the ftp_fgets function but carnt seem toget around it. theres about 100+ images that change daily that i want to bring from the game server to my web page server.

The ftp_fgets functions ect, gets them but as i can see puts them into a open file on my server. How can i do it for images?

Anyone know of a tutorial or a ready made script i could use for fetchingthese images. Ive tryed a few from hotscripts and not had much luck,

The game server that holds the images is hosted on windows and the web page server is hosted on linux,

Like i said im nearly there, i have the files i want in a array i just need some way of getting them back to my page server.


Slap wake up...

By the way the game server is not http enabled, on way in is ftp .

View Replies !   View Related
Query Fetch Row
I have a code which checks if the row is not found but then i have another line to get the row that is found straight after... but for some odd reason say i have 2 rows in the database itll only show the second row. Code:

View Replies !   View Related
Mysql Fetch Row
mysql_connect("$server_ip:$mysql_port","$user","$pw");
mysql_select_db("$db") or die(mysql_error());

$fetchname = "SELECT * FROM realmlist";
$row = mysql_query($fetchname);

while($queryresult=mysql_fetch_array($row))

{$igda=($queryresult["name"]);}

echo "<center><span class='style1'>$igda</span></center>";

mysql_free_result($row);

ive had this problem before where it only outputs one result, so if i have 2 names in there, itll output only one name, i want it to ouput the whole row.

View Replies !   View Related
Fetch Arrays
I keep getting this error that my fetch arrays are not a valid resource for the two located near the bottom of my code, the ones hilighted. Can anyone see what I'm doing wrong? I'm trying to pull out entries for a simple forum, using three database tables that tie together. Code:

View Replies !   View Related
File Fetch
I need to fetch a file by providing the url and save it in my server.

View Replies !   View Related
Fetch Array
I have designed a debit-system database with a PHP frontend. The amounts need to be updated on a monthly basis. now i have 10 clients in the system. i can get all the fields and display them, but next to that, i need to insert a field where we can enter an amount per client and after all the new amounts have been filled in, i need to update the database with those amounts entered.
I know that by using html forms to enter the info, i can submit the info and do a update statement but the problem is, is that i need to dynamically add the field to update the amount according to the amount of results resturned from the database.

View Replies !   View Related
Fetch Users
I'm trying to write a code to have all my users and their information they entered when they joined into one page, and its not working. Here is what I got

<table border="0" width="100%">
<tr>
<td width="33%"><b>Username</b></td>
<td width="33%"><b>Email</b></td>
<td width="34%"><b>some_info</b></td>
</tr>
<?php
include('config.php');
$sql = "SELECT id From members";
$get_id = mysql_query($sql);
if (!$get_id) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
if (mysql_num_rows($get_id) == 0)
...........

View Replies !   View Related
Submitting Date Range...
<?php
$query="SELECT SUM(hours) from log WHERE
pid='$'pid' AND uid = '$uid' AND
date >= '$start_date' AND date <= '$end_date'";
?>

Does this look right? I'm gonna create a form using genDateSelector(). Eg. to allow user to select a start date and end date to view summary report for that date range only. What am I missing?

View Replies !   View Related
Displaying A Date Range
I would like to display a user specified date range e.g Monday to Monday next week or maybe Monday next month. When I have the basic function worked out I would like to get Data from a Mysql Database. here is what I have thought about. Code:

View Replies !   View Related
Date Range Function
Is there any function i can use, somthing like date range, like all the dates between:
6/8/2001 "to" 12/8/2001 .

View Replies !   View Related
Selecting Date Range
How do I query a date range? I have a date column in my mysql table. I want to select a range of rows between : Ex. 2007-08-05 through 2007-08-30 .

I also would like to have the page that sends the query as a form.. option value that shows all of the available dates, so i can select a from date and a to date.

View Replies !   View Related
Selecting Within A Date Range
Basically I want to list all events that are active on a particular day. The events are saved in an SQL table with a start date and a duration. The following code appears to work but only returs one event when there should be 3! Code:

View Replies !   View Related
Query Date Range
I have a table which holds a bunch of dates

id   datefrom       dateto
1    2007-02-22   2007-03-05
2    2007-05-13   2007-06-23
3    2007-05-25   2007-07-23

the `datefrom` and `dateto` are dates in the format YYYY-MM-DD, the `datefrom` means the date the event starts and the `dateto` means the date the event ends.

What I want to run a query on this table and return any rows which have todays date between the 'datefrom' and the 'dateto'.

Does that make much sense?

View Replies !   View Related
Date Range Validation
I'm a sysadmin who just took over a php application and have no php training. I have this function: Code:

View Replies !   View Related
Viewing Range Of Results
is there any way to view a range of results in mysql, and by that i mean is there any way i can see the first 100 results of a query or the 50th through 100th results of a query.

is there any way to do that? i read about using views, but i didnt see anything about viewing a certain number of results. should i just feed my results into an array in php, and then sift through the array?


View Replies !   View Related
SELECT Rows Only Within A Certain Range
I want to find an easy way to select only rows within a certain range when I do a select. Im sure I have seen this done with a SELECT statement but cant remember if or how it was done. If not SELECT, whats the simplest way to do this? I have in the past
selected all rows, and using a counter and conditional statement I will only output if within range

//while shifting through the table select
if (($i 10) and ($i < 21))
{
//within range, output
}

Is this the simplest method?

View Replies !   View Related
Scanning IP And Port Range
I need to create a script that scans an IP range (and in turn a range of ports for each IP) and update a MySQL Database with all IPs:Ports that are found and respond to ping.

(It's mainly going to be pinging HL and HL2 game servers, but that is an un-necessary detail). I aim to have this script on a CRON Job type thing so it's run automatically at, say, 3AM each morning.

View Replies !   View Related
How To Remove 'out Of Range Error'
i got a following error while inserting data from my php program. Out of range value adjusted for column 'requestid' at row 1 what can i do, and how to remove this error Code:

View Replies !   View Related
Calculating Week Range
I am sure this has been asked before but it is difficult to search for. Given a date, is there a function or a already written script out there that will allow my to get the previous Monday before the date given?

This is so that given the current date, I can show all events that are happening for that week. I also will want to do the same for the month. I know I could go about writing algorithms to calculate this, but I am sure this is something that has been done numerous times before.

Also is there anywhere out there built an easy to plug in calendar view function that rather then my user manually entering the dates they want to select,can just select a particular date?


View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved