What do I need and where can I get it?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
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
the table name "user" with a variable $table, that
wil automatically take the value of the selected table. I have tried many
times but cannot get the correct sql syntax, it keeps saying
"you have an error in your sql syntax near 'user' line 1" when i try it with
$table.
On Tue, 20 Aug 2002 18:34:48 -0500
"Shiloh Madsen" <[EMAIL PROTECTED]> wrote:
> I was wondering if there were any good documents out there about
> good database design...I know the basics of creating tables,
> setting data types and such, and now i want to know how to use it
> to the best effect.
On Sat, 10 Aug 2002 17:41:56 +0200
"andy" <[EMAIL PROTECTED]> wrote:
> > > Hi there,
> > >
> > > I am searching for the best way to store true or false inside
> > > a MySQL DB. With best I mean the most data efficient way and
> > > in the same time the best for fast searching later on the
> > > t
On Sat, 10 Aug 2002 16:46:54 +0200
"andy" <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I am searching for the best way to store true or false inside a
> MySQL DB. With best I mean the most data efficient way and in the
> same time the best for fast searching later on the table to find
> all which
On Mon, 29 Jul 2002 20:44:54 -0700
Georgie Casey "Georgie Casey" <[EMAIL PROTECTED]> wrote:
> rite,
>
> my primary key column ("id") is set to auto_increment as usual
> which is very
> handy. But when I delete a row, the auto_increment just keeps
> incrementing
> and there's this 'hole' left whe
On Wed, 24 Jul 2002 16:49:38 -0400
Martin Clifford "Martin Clifford" <[EMAIL PROTECTED]> wrote:
> You're trying to use double quotes, in which the variable is
> evaluated and the stored value is shown, right? Try using single
> quotes. For example, with $name = "Martin".
>
> echo "My name is $
On Wed, 24 Jul 2002 13:23:54 +1200
David Robley David Robley <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] says...
> > I've run out of ideas. I want to store a variable name and a
> > function call in a text column of a MySQL database and have them
> > interpr
I've run out of ideas. I want to store a variable name and a
function call in a text column of a MySQL database and have them
interpreted at runtime, but I can't figure out how to do it.
Examples:
"This is the $nbrtimes you've asked."
and
"$answer is the square root of sqrt($nbr)."
I've tried
On Sun, 30 Jun 2002 20:21:18 -0400
Chris Payne "Chris Payne" <[EMAIL PROTECTED]> wrote:
> Hi there everyone,
>
> I have my id field auto incrementing (Of course) and I have a
> utility
> that allows me to remove items from it, the problem is when I
> remove
> something the items after it keep t
On Thu, 7 Feb 2002 17:07:35 +0100
Andy "Andy" <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I have a tabel with 250 entries showing a country code lik "CA"
>
> Now my application does not work on linux, because they have to be
> in lower
> case.
>
> Can I make anyhow an bufix, or even better crea
On Sun, 27 Jan 2002 13:04:09 +0200
Thomas \ "Thomas \"omega\" Henning" <[EMAIL PROTECTED]> wrote:
> Hello how can i upload something from my hdd to the webserver
> using php?
>
> note: don't have ftp on the machine!!
>
> Thanks
>
> Thomas "omega" Henning
I usually don't like saying this, but
On Fri, 11 Jan 2002 17:21:28 -0800
Jerry Leonard "Jerry Leonard" <[EMAIL PROTECTED]> wrote:
> Okay this is the way I understand the statement below. The uid
> will be a
> number from 1 to 10, max length of ten digits say starting at 1
> then as the
> next user registers it will automatically make
On Fri, 11 Jan 2002 15:02:00 -0800
Jerry Leonard "Jerry Leonard" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am really new to MySQL and am wondering this:
>
> I understand how to make a database and tables but what I don't
> understand
> is when to make a row an "int" with auto_increment or just a p
On Sat, 5 Jan 2002 01:12:21 -
Nathon Jones "Nathon Jones" <[EMAIL PROTECTED]> wrote:
> Hi.
>
> I have a PHP page calling a set of results from a MySQL database.
> They
> appear in the following format on the results page:
>
> Title
> Description
> Link
>
> Problem I'm having. When a db r
On Mon, 3 Dec 2001 17:31:30 -0500
Thomas "Thomas" <[EMAIL PROTECTED]> wrote:
> I have looked into some source code that I found, but I'm a newbie
> at this,
> and don't understand..
>
> if ( 0 == $this->link_id) {
>
> In this statment, what does the '->' repersent? this statment
> (operator?)
On Fri, 23 Nov 2001 14:04:00 -0600
Terry Romine Terry Romine <[EMAIL PROTECTED]> wrote:
> I seem to have run into a strange bug where when I enter text
> through a
> form, and use the nl2br call in PHP, instead of getting "" I
> get
> "" and then my parsing fails on the display side (where I
>
On Tue, 13 Nov 2001 04:30:06 +0800
Brian Tegtmeier "Brian Tegtmeier" <[EMAIL PROTECTED]> wrote:
> Sup all. I'm currently running into a problem (can send source if
> needed) with this news script called "PHP-News" at
> http://www.hotscripts.com/Detailed/7145.html where if I login to
> the admin a
On Sat, 27 Oct 2001 13:36:57 +1000
"Andrew Duck" <[EMAIL PROTECTED]> wrote:
> Error
> SQL-query :
>
> CREATE TABLE mail (
> from int(32) NOT NULL default '0',
> to int(32) NOT NULL default '0',
> subject varchar(80) NOT NULL default '',
> message text NOT NULL
> ) TYPE=MyISAM
>
>
>
On Sat, 20 Oct 2001 09:16:26 -0400
David Bedingfield <[EMAIL PROTECTED]> wrote:
> ...still no luck with this... any help?
>
> David Bedingfield wrote:
>
> > With a basic php document, I am trying to create a table. I have
a good
> > code for the table (I think) but I cannot connect to the SQL
s
> > -Original Message-
> > From: TJayBelt <[EMAIL PROTECTED]>
> > To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> > Date: Thursday, October 18, 2001 8:28 AM
> > Subject: [PHP-DB] Sessions and Frames
> >
> >
> > >I have a site that is successfully using sessions and
authentication.
> > >However
On Thu, 4 Oct 2001 14:17:22 -0300
WebDev <[EMAIL PROTECTED]> wrote:
> Thursday, October 04, 2001, 1:13:59 PM, you wrote:
>
> RR> When you define your auto-incrementing column, can't you
specify
> RR> "ZEROFILL"? I believe it pads to the left with zeroes.
>
> Hello Raquel,
>
> Yes, but is it p
On Wed, 3 Oct 2001 09:49:20 -0600
Ricky Theil <[EMAIL PROTECTED]> wrote:
> I just recently started using Cardservice International for all my
> precessing. The only drawback was that I had to purchase an API
wrapper,
> but it is a PHP wrapper. It was $95. It's extremely fast, and
easy to use.
Tom Peck wrote:
> >
> >How about writing a text file that would be your "lock" file, rather
> >than depending upon MySQL to do it for you?
> >
> >--
> >Raquel
>
> So what you mean is:
>
> If someone clicks on a car to edit, a txt file is written (maybe called the
> carID.txt). Then if someone e
Tom Peck wrote:
>
> Thanks for the reply Manual.
>
> The updating IS done with one single query - but the problem is that if two
> people are editing the same car, the second update will overwrite the
> first. Not a huge problem - and the chance of it happening is almost nil -
> but there is st
nching, it might be encountering an error and
> quietly dieing as soon as you launch it. I'm successfully running Apache
> 1.3.19, PHP 4.0.5, and MySQL 3.23.38. When I upgraded from MySQL 3.23.32
I
> had that same warning come up, all it took was restarting mysqld and the
> warning
I have the same problem as you when using apache1.3.19, php4.0.5 and
mysql3.23.38 and get the same warning message. I've spent many time to
compile
the system again but failed. So I forgive to use the newest version and use
apache1.3.17, php4.0.4 and mysql3.23.38. It works now!
Hope someone can h
60 matches
Mail list logo