I am trying to make a bit of code that takes values from 2 arrays,
one array has a list of all the date's of this week starting from sunday,
$arraydate[$n] = "the date"
where $n is an integer between 0+6
the other is a multidimensional array composition as such;
$rota[$staffid][$x] = "date sta
a function to convert any date to ymd...
function datetoymd($date){
$dateymd = date('Y-m-d',$date);
return $dateymd;
}
this function when output gives me the date 1970-01-01 (date of the unix
timestamp start) so, ehm, why!?
cheers,
dave
___
trying to make an array with every date (in -MM-DD format) of the
current week in it...
the below code ain't working, any ideas?!
cheers,
dave
function createdatearray($sunday){
$date = date('Ymd',strtotime($date));
for($x=0; $x<=7; $x++){
$y = $x + 1;
I am trying to make a small function that will me the date in Y-m-d of the
start of the current week (the sunday) I have only the idea of doing it by
making a long drawn out script with if, elseif clauses for every day of the
week... and then doing something like
if ( date('D') = "mon" ) {
$
I want to create an array from results returned from a mysql query. I want
it to go through each row in the returned result, and if the variable in the
array staff exists add 1 to the total, if it doesnt exist, set it as one and
carry on.
But when i run this and do var_dump, it just returns "1"
Here is the complete function I am using.
I returned, for testing i commented out the foreach loop and returned
$staff, then $tips both arrays returned NULL when i did a
var_dump(pointvalue($startdate));
can anyone see how this could be solved?
Cheers,
dave
=
Hey thank's for the ideas but neither of them work, doh...
Okay fredrik I know your idea won't work cos list only works with numericaly
indexed arrays, both the arrays that i am using are indexed by date.
(it produces a parse error when run)
=
while(list($d, $t) = each($tips)
Okay, i have two arrays, $tips and $staff
$tips has a key "date" (which is the date of the first day of the week, the
second result in the array has the key of the second day of the week etc...
) and the value is a floating point decimal.
$staff also has a key "date" and the value is an integer
Okay the problem is adding another result to the multi-dimensional array
When i perform var_dump on the returned varialbe $tips i get
array(1) { [2]=> array(1) { [0]=> string(10) "2003-03-07" } }
I know that there are 2 results missing here for when the key of the array
is 1 ($sta
Just a quick question about dynamic variables
would like to end up with a variable called
$tips_1
$tips_2
...
$tips_n
where "n" is the value of the variable $sid
i have tried
$tips . '$sid';
and other variants, but i can't get one that doesn't return a parse error or
T_VARIABLE error.
___
It took me about 30 mins but after 2 attempts i came up with a function that
subtracts 2 times to give an answer in hours, to two decimal places.
thanks for your help the two people who responded when i posted the
question, your suggestions were a bit out on a tangent from what i wanted.
But th
I know I asked this before buy no-one gave me an answer i was looking for, I
want to subtract two times and the ammount of hours worked to 2decimal
places (3.41 hours)
cheers,
dave
_
Use MSN Messenger to send music and pics to you
I want to take away two times stored in the format "00:00:00" in a mysql
database, i retrieve the times and take them away by using the following
$total = $time1 - $time2 ;
when i echo the total it is a whole number of the hours.. and does not take
the minutes into account, anyone have an ide
Sorry, I forgot to add the part at the bottom where I am calling the
function
=
$start = date('Ymd',strtotime($weekstart));
$query = "SELECT * FROM Rota WHERE date >= $start and date <= ($start +
INTERVAL 6 DAY) ORDER BY staff
Here is the whole code of my function
Whenever i run it, it say's there is a parse error on line 6, can't see what
is the problem
the format of $weekstart (as it is stored in the Database) is -MM-DD
=
$start = date('Ymd',strto
I want to use it in this function that i am creating (it's for a resteraunt
automated tips system, to work out how much tips each staff member is
entitled to.
function tips($weekstart){
/* JUST BELOW HERE IS WHE
I am looking for a way to take a date stored in a mysql database... and find
out the date seven days later.
how would i do this?!
cheers, dave
_
Chat online in real time with MSN Messenger http://messenger.msn.co.uk
--
PHP Data
mation.
I have tested it with other queries that work... and there is no problem, i
am definately connected to the database
From: Koleszár Tibor <[EMAIL PROTECTED]>
To: "David Rice" <[EMAIL PROTECTED]>
Subject: Re: [PHP-DB] need help with fetching a result using a function
I am trying to write a few functions for a project i need to do for school,
this function should return all the inactive, or active users (1 or 0
staffstatusid) as an array for creating a drop down menu.
Now when i perform the following code (yes it is included in a script that
connects to the
I Have made two pages, "sess2.php" and "sess3.php"
trying to create a session variable then access it in the other page.
now when i try and call the session in the second page i get no value,
and i have tried var_dump, and it gives me "NULL" anyone know if there is a
reason for this?!
page 1
Here's something i can't get working it won't go to the last clause of this
page i don't think it can set the session variable
anyone see what im doing wrong? i need more caffeine to get my brain fired
up today lol..
===
I have been having trouble with PHP sessions, the session variables are not
able to be called through the script.
If have commented the area at the bottome where the session variable is NULL
when var dump is called to check it (about 20 lines from the bottom...
depending on if the text is wrapp
It Does have a closing Brace, just check my second email it contains the
FULL code.. i missed the last few lines copying it the first time somehow.
From: "Andreas Sheriff" <[EMAIL PROTECTED]>
To: "David Rice" <[EMAIL PROTECTED]>
Subject: RE: [PHP-DB] need he
"Parse error: parse error in
/home/filterseveuk/public_html/project/login.php on line 34"
That is the exact error message,
Cheers, Dave
session_start();
if(!$HTTP_COOKIE_VARS["username"]) {
/* The Cookie is not set, so load the page as if it is the first time
*/
require("library/in
When i run this script it tells me that I have a parse error on line 34? I
really can't see it anyhelp (please!) would be much appreciated Cheers, Dave
session_start();
if(!$HTTP_COOKIE_VARS["username"]) {
/* The Cookie is not set, so load the page as if it is the first time
*/
inclu
Rite marc,
this is what your gonna have to do, in a new table like this lets say we
call it "MAINSUB"
MAINMENU ID
SUBMENU ID
it only contains those 2 fields to show that there is a link between the two
okay?
now to the actual menu
<
for($x=2, $x < 4, $x++
<
SELECT * FROM MAINSUB WHERE MAINME
SQL-query :
CREATE TABLE `staff` (
`StaffId` INT( 4 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`Name` VARCHAR( 30 ) NOT NULL ,
`Surname` VARCHAR( 30 ) NOT NULL ,
`Address` TEXT( 225 ) NOT NULL ,
`JobId` SMALLINT( 2 ) NOT NULL ,
`PermissionId` SMALLINT( 2 ) NOT NULL ,
`HomePhone` INT( 11 ) NOT NULL
Just a question, is it possible to dynamically create an excel spreadsheet
from data in a mysql database the excel sheet does not have to be displayed,
just to be sent to print, to give better print quality than a webpage tables
equivalent.
Or is there another way of doing this?
__
Making an update query that adapts to the number of fields that are to be
updated
Is there anyway to do like a for loop to create the values part of the query
then combine it with the first part of the string.
something like what i have below... although something that works correctly
as thi
co.uk/admin/index.php
and if you check a table, and choose an edit query on one of the records to
see what i am trying to do.
thank's for your time!
cheers,
David Rice
_
The new MSN 8: smart spam protection and 2 months
okay thank's for the help on my previous question. I've got it to retrieve a
list of column headers now, i want it to retrieve all the records from the
table and print them underneath.
the code i have is
**
/* get a list of
I need to write a script that will extract the names of the columns in my
database eg. "user_id, username" can anyone help as to how to do this!
I have tried
**
***
mysql_select_db("filterseveuk") or die(mysql_error());
$query = "SHOW CO
I am tryin to create a DBMS,
the part of my code that is currently causing a problem is
mysql_select_db("filterseveuk") or die(mysql_error());
$query = "SHOW COLUMNS FROM " .$table. "";
$result = mysql_query ( $query ) or die( mysql_error () );
$numrows = mysql_num_rows ($result);
$r
mysql_select_db("filterseveuk");
$query = ( " SHOW COLUMNS FROM user ");
$result = mysql_query ( $query ) or die( mysql_error () );
while ( $row = mysql_fetch_array ($result) ){
$x = 0 ;
echo $row[$x] ;
$x++ ;
}
I would like to replace the table name "user"
34 matches
Mail list logo