hi ,
I have two variables both containg dates,
x= `date`
and
y= `date'
their format being -> Fri Nov 12 22:59:50 MST 2004
how do I compare which one is greater.
->Can dates be converted into integer and then compared?
( one lengthy way would be to compare the words one by... (7 Replies)
Hi guys
I have a a variable called check_ts which holds a date value. this date value keeps refreshing every 15 minutes.
I am going to start a cron job 5 minutes after the refresh. I have to check if the current date > 20 min of check_ts. how do i do that.
thanks
ragha (17 Replies)
Hello friends,
I am looking for a script or method that can display all the dates between any 2 given dates.
Input:
Date 1
290109
Date 2
010209
Output:
300109
310109
Please help me. Thanks. :):confused: (2 Replies)
Hi I have yesterday date and todays date stored in two variables.
Today date is stored in variable -- testdate=`date +%m/%d/%Y`
I found the yesterday date and stored in variable -- ydate=$month'/'$day1'/'$year
Now i am trying to find out whether $testdate is less that $ydate.
I am... (6 Replies)
Hi,
I have written the following script which will provide the first date of the 3rd previous month and last date of the 2nd previous month but when I change the month for 03 (March) then I am getting the incorrect results.
Ex : - If today is 1 Jan 2010 then the script should provide the... (1 Reply)
Hi,
I want to compare today's date(DDMMYYYY) with yesterday(DDMMYYYY) from system date,if (today month = yesterday month) then execute alter query else do nothing.One more condition is change of year also i.e today is Jan1 2012 and yesterday is Dec 31 2011.
The above rek i want in Shell... (4 Replies)
Hi
I'm trying to compare the current date (dd-Mmm-yyyy) against a variable that is an extracted date from an sql script. Below is the code:
datenow=`date '+%d-%h-%Y'`
#datenow is the current date in the format dd-Mmm-yyyy
sqlplus $dbuserid/$dbpassword @ $SCRIPT_PATH/business-date.sql >... (3 Replies)
Hi
I am failing to write a script which compares a list of dates in a file with today's date.
OS: Solaris 10
I have a file which has server names & dates, i need to compare the date in this file with today's date, if it is less than today it should print the server name.
code i tried is ... (3 Replies)
Discussion started by: nanz143
3 Replies
LEARN ABOUT PHP
db2_prepare
DB2_PREPARE(3) 1 DB2_PREPARE(3)db2_prepare - Prepares an SQL statement to be executedSYNOPSIS
resource db2_prepare (resource $connection, string $statement, [array $options])
DESCRIPTION db2_prepare(3) creates a prepared SQL statement which can include 0 or more parameter markers ( ? characters) representing parameters for
input, output, or input/output. You can pass parameters to the prepared statement using db2_bind_param(3), or for input values only, as an
array passed to db2_execute(3).
There are three main advantages to using prepared statements in your application:
o Performance: when you prepare a statement, the database server creates an optimized access plan for retrieving data with that
statement. Subsequently issuing the prepared statement with db2_execute(3) enables the statements to reuse that access plan and
avoids the overhead of dynamically creating a new access plan for every statement you issue.
o Security: when you prepare a statement, you can include parameter markers for input values. When you execute a prepared statement
with input values for placeholders, the database server checks each input value to ensure that the type matches the column defini-
tion or parameter definition.
o Advanced functionality: Parameter markers not only enable you to pass input values to prepared SQL statements, they also enable
you to retrieve OUT and INOUT parameters from stored procedures using db2_bind_param(3).
PARAMETERS
o $connection
- A valid database connection resource variable as returned from db2_connect(3) or db2_pconnect(3).
o $statement
- An SQL statement, optionally containing one or more parameter markers..
o $options
- An associative array containing statement options. You can use this parameter to request a scrollable cursor on database servers
that support this functionality. For a description of valid statement options, see db2_set_option(3).
RETURN VALUES
Returns a statement resource if the SQL statement was successfully parsed and prepared by the database server. Returns FALSE if the data-
base server returned an error. You can determine which error was returned by calling db2_stmt_error(3) or db2_stmt_errormsg(3).
EXAMPLES
Example #1
Preparing and executing an SQL statement with parameter markers
The following example prepares an INSERT statement that accepts four parameter markers, then iterates over an array of arrays con-
taining the input values to be passed to db2_execute(3).
<?php
$animals = array(
array(0, 'cat', 'Pook', 3.2),
array(1, 'dog', 'Peaches', 12.3),
array(2, 'horse', 'Smarty', 350.0),
);
$insert = 'INSERT INTO animals (id, breed, name, weight)
VALUES (?, ?, ?, ?)';
$stmt = db2_prepare($conn, $insert);
if ($stmt) {
foreach ($animals as $animal) {
$result = db2_execute($stmt, $animal);
}
}
?>
SEE ALSO db2_bind_param(3), db2_execute(3), db2_stmt_error(3), db2_stmt_errormsg(3).
PHP Documentation Group DB2_PREPARE(3)