RE: [PHP-DB] index.html or index.php

2006-09-29 Thread Shaun A Riches
Title: RE: [PHP-DB] index.html or index.php






?
echo I am currently viewing  . $_SERVER[REQUEST_URI];
?

REQUEST_URI and a simple string manipulation will help you.

___
Shaun Riches
Computer Science Student



-Original Message-
From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED]]
Sent: Fri 29/09/2006 04:46
To: PHP DB
Subject: [PHP-DB] index.html or index.php

I have used both index.html and index.php in the various directories.
Is there a way to tell which was loaded if a user visited:

www.domain.com/directory/

?

Ron






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] Array

2006-09-29 Thread Shaun A Riches
Title: RE: [PHP-DB] Array






This is hardly database related but nonetheless.

?
$myString = Check one two three four. You did well to count to four.;
$myString = str_replace(.,,$myString);
$myString = strtolower($myString);

$myWords = explode( , $myString);

// do stuff here with your array
?

How is that?

___
Shaun Riches
Computer Science Student
http://www.sh4un.co.uk



-Original Message-
From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED]]
Sent: Fri 29/09/2006 16:21
To: PHP DB
Subject: [PHP-DB] Array

If I have the sentences

Check one two three four. You did well to count to four.

how do I put each word into an array (so there would be 12 components in
the array) as well as remove the period and make the C in Check and the
Y in You lower case

Ron







-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] Search engine

2006-09-28 Thread Shaun A Riches
Title: RE: [PHP-DB] Search engine






What about the MySQL LIKE command? Research it.

This is assuming your data is stored properly without redundant data and in a MySQL database.

___
Shaun Riches
Computer Science Student



-Original Message-
From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED]]
Sent: Thu 28/09/2006 03:44
To: PHP DB
Subject: [PHP-DB] Search engine



___
Shaun Riches
Computer Science Student



-Original Message-
From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED]]
Sent: Thu 28/09/2006 03:44
To: PHP DB
Subject: [PHP-DB] Search engine

Has anyone wrote a search engine for the web site? I am wondering if
someone has the time to help me walk through doing this. Ron






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DB] Date SELECT with IF

2004-04-15 Thread Shaun
Hi,

Is it possible to have a clause in a mysql SELECT statement? I would the
query to display the date except where it equals the default 000-00-00 to
display n/a or something similar.

For example SELECT DATE_FORMAT(B.Booking_End_Date, \%Y-%m-%d\) AS 'Booking
End Date' FROM Bookings (IF Booking_End_Date = '-00-00' DISPLAY 'n/a');

I hope this illustrates what I am trying to achieve!

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Hi I am new to PHP

2004-04-15 Thread Shaun
It means there is a problem with your query,

if you send the query back to the group someone may be able to help.


Andy Amol [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 I have posted my problem at No: 33892 of this mailing list. I have
received 1 reply. No: 33897

 My exact problem with second file is as follows:

 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource on line 15


 Can you help me to solve problem, any help would be appreciated.

 Thanks.



 -
 Do you Yahoo!?
 Yahoo! Tax Center - File online by April 15th

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Backup DB

2004-03-06 Thread Shaun
Hi,

Can anyone recommend some software that I can use to backup our MySQL
database on a webserver to a PC in the office on an hourly basis? I have
found SQLjob - related to SQLyog! - which appears to do a exactly what I am
looking for, however I have also come across a few posts about its poor
reliability.

I would be most interested to hear anyone's opinions here.

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Brick Codes

2004-02-17 Thread Shaun
Thanks for your reply,

but what I actually need to do is compare the first 3 or 4 digits of the
postcode stored in locations to the same in the Brick table...


Ricardo Lopes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 That may depend of what database server you are using, for mysql you can
 use:

    WHERE (LEFT('Brick',3) = LEFT(Post Code,3))

 If you are using other dbserver, check your manual.

 - Original Message -
 From: Shaun [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, February 16, 2004 10:45 PM
 Subject: [PHP-DB] Brick Codes


  Hi,
 
  I have a table of Locations around the country. My system produces
reports
  based on these Locations. I also have a table containing Brick Codes
e.g.
 
  BrickPost Code
  AB51AB51
  AB52AB52
  AB55AB55
  AB56AB56
  AL01AL1
  AL02AL2
  AL03AL3
  AL04AL4
 
 
  How can I compare the first 3 or 4 letters of the postcode in the
 Locations
  table to the corresponding entry in the Brick Codes table so I can add
it
 to
  my report?
 
  Thanks for your help
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Brick Codes

2004-02-17 Thread Shaun
Thank you for your replies,

The brick and postcode will never match so I need to compare the Postcode in
Locations to the Postcode in Brick. Something like:

SELECT B.Brick
FROM Locations L, Brick B
WHERE (LEFT(L.Postcode,3) = LEFT(B.Postcode,3))

The problem is that some of the postcodes stored in Brick have three digits
and some have four, is there a way of capturing everything before the first
space in L.Postcode and compare that to B.Postcode?

Thanks for your help

Ignatius Reilly [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hmmm...

 Better try:
 WHERE (LEFT( Brick,3) = LEFT(`Post Code`,3))
 ^^ no quotes^^ back ticks (because of the
 space in the column name)

 HTH
 Ignatius
 _
 - Original Message -
 From: Ricardo Lopes [EMAIL PROTECTED]
 To: Shaun [EMAIL PROTECTED]
 Cc: PHP DB [EMAIL PROTECTED]
 Sent: Tuesday, February 17, 2004 10:23
 Subject: Re: [PHP-DB] Brick Codes


  That may depend of what database server you are using, for mysql you can
  use:
 
     WHERE (LEFT('Brick',3) = LEFT(Post Code,3))
 
  If you are using other dbserver, check your manual.
 
  - Original Message -
  From: Shaun [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, February 16, 2004 10:45 PM
  Subject: [PHP-DB] Brick Codes
 
 
   Hi,
  
   I have a table of Locations around the country. My system produces
 reports
   based on these Locations. I also have a table containing Brick Codes
 e.g.
  
   BrickPost Code
   AB51AB51
   AB52AB52
   AB55AB55
   AB56AB56
   AL01AL1
   AL02AL2
   AL03AL3
   AL04AL4
  
  
   How can I compare the first 3 or 4 letters of the postcode in the
  Locations
   table to the corresponding entry in the Brick Codes table so I can add
 it
  to
   my report?
  
   Thanks for your help
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Brick Codes

2004-02-16 Thread Shaun
Hi,

I have a table of Locations around the country. My system produces reports
based on these Locations. I also have a table containing Brick Codes e.g.

BrickPost Code
AB51AB51
AB52AB52
AB55AB55
AB56AB56
AL01AL1
AL02AL2
AL03AL3
AL04AL4


How can I compare the first 3 or 4 letters of the postcode in the Locations
table to the corresponding entry in the Brick Codes table so I can add it to
my report?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Help With An UPDATE Query Please

2004-02-10 Thread Shaun
Hi,

How can I update a column where the first letter begins with 'M' and adjust
it so that column ends with 'M' instead. So something like 'UPDATE table SET
column = 'xxxM' WHERE column = 'Mxxx'. I hope this explains what I am trying
to achieve!

Thanks

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Help with an UPDATE query please

2004-02-05 Thread Shaun
Hi,

I have (among others) two DATE columns in a table; Booking_Date and
Booking_Completion_Date. How can I run a query that updates
Booking_Completion_Date to be 2 days after Booking_Date where
Booking_Completion_Date is NULL?

Many thanks

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Row count in a query

2004-01-31 Thread Shaun
Hi,

Is it possible to have an incrementing row count in my query that is not
part of the table data?

i.e.

1  data  data
2  data  data
3  data  data
...

This has to be done in the query not the PHP!!

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Help with a COUNT / SELECT query

2004-01-23 Thread Shaun
Hi,

I have a Bookings application. When a Booking is made it is entered in to
the Bookings table. Bookings take place at Areas, held in the Areas table.
Each Area has a unique Area_ID held in the Bookings table for each Booking.
Each Booking needs to be completed and when done so the Booking_Status for
each Booking is updated to '2'. An Area is complete when all Bookings at
that
Area have been completed. How can I run a query that tells me how many
completed Areas there are in the system?

Thanks for your help

CREATE TABLE WMS_Bookings (
  Booking_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  User_ID int(11)  DEFAULT '0' NOT NULL ,
  Project_ID int(11)  DEFAULT '0' NOT NULL ,
  Area_ID int(11)  DEFAULT '0' NOT NULL ,
  Booking_Start_Date datetime  DEFAULT '-00-00 00:00:00' NOT NULL ,
  Booking_End_Date datetime  DEFAULT '-00-00 00:00:00' NOT NULL ,
  Booking_Completion_Date date,
  Booking_Status int(2)  DEFAULT '0' NOT NULL ,
  Additional_Notes text,
  PRIMARY KEY (Booking_ID)
);

CREATE TABLE WMS_Area (
  Area_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  Area_Name varchar(40)  DEFAULT '' NOT NULL ,
  Area_Address varchar(255)  DEFAULT '' NOT NULL ,
  Area_Postcode varchar(10)  DEFAULT '' NOT NULL ,
  Area_Telephone varchar(15)  DEFAULT '' NOT NULL ,
  PRIMARY KEY (Area_ID)
);

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Help with a COUNT / SELECT query

2004-01-23 Thread Shaun
Thanks for your reply,

but that only tells me how many complete Bookings there are. I need to know
how many Areas are complete i.e. for each Area where Bookings take place,
all of those Bookings have been completed.

Any ideas?

Oòvn?Oòsis [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Mensaje citado por Shaun [EMAIL PROTECTED]:

  Hi,
 
  I have a Bookings application. When a Booking is made it is entered in
to
  the Bookings table. Bookings take place at Areas, held in the Areas
table.
  Each Area has a unique Area_ID held in the Bookings table for each
Booking.
  Each Booking needs to be completed and when done so the Booking_Status
for
  each Booking is updated to '2'. An Area is complete when all Bookings at
  that
  Area have been completed. How can I run a query that tells me how many
  completed Areas there are in the system?

 SELECT count(*) FROM WMS_Bookings WHERE Booking_Status = 2;

 Saludos... :-)

  Thanks for your help
 
  CREATE TABLE WMS_Bookings (
Booking_ID int(11)  DEFAULT '' NOT NULL auto_increment,
User_ID int(11)  DEFAULT '0' NOT NULL ,
Project_ID int(11)  DEFAULT '0' NOT NULL ,
Area_ID int(11)  DEFAULT '0' NOT NULL ,
Booking_Start_Date datetime  DEFAULT '-00-00 00:00:00' NOT NULL ,
Booking_End_Date datetime  DEFAULT '-00-00 00:00:00' NOT NULL ,
Booking_Completion_Date date,
Booking_Status int(2)  DEFAULT '0' NOT NULL ,
Additional_Notes text,
PRIMARY KEY (Booking_ID)
  );
 
  CREATE TABLE WMS_Area (
Area_ID int(11)  DEFAULT '' NOT NULL auto_increment,
Area_Name varchar(40)  DEFAULT '' NOT NULL ,
Area_Address varchar(255)  DEFAULT '' NOT NULL ,
Area_Postcode varchar(10)  DEFAULT '' NOT NULL ,
Area_Telephone varchar(15)  DEFAULT '' NOT NULL ,
PRIMARY KEY (Area_ID)
  );
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


 --
 select 'mmarques' || '@' || 'unl.edu.ar' AS email;
 ---
 Martín Marqués  |   Programador, DBA
 Centro de Telemática | Administrador
Universidad Nacional
 del Litoral
 ---

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] A site mapped in a database / xml

2004-01-21 Thread Shaun
Hi,

I have an question on how to create a completely database / xml driven site
i.e. the page names, links, the site map etc are held in the database. I
think I have solved most problems but what I would really like to do is
limit the number of pages I need. Can I manipulate the server such that if I
have links to a pages; a href=red_hats.phpred_hats.php/a and a
href=yellow_hats.phpyellow_hats.php/a can both these pages and others
link to a different page that dynamically constructs whilst the links aren't
altered. Maybe is there some way that a default php page is called that
reads the link of the page called etc.

I would be most grateful for your input on this.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Get Names of columns of a table

2003-12-17 Thread Shaun
Hi,

is there a PHP function that wil return the names of the columns for a given
table?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Retrieve data and column names from a table

2003-12-17 Thread Shaun
Hi,

I need to retrieve the data and column names from a single row in a table,
i.e. 'SELECT * FROM Table WHERE Field_ID = 1'

How can I get PHP to show the data and the column names? With reference to
my earlier post and the replies I can't use DESCRIBE in conjunction with
SELECT and I don't want to use a deprecated PHP function...

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] MySQL Field length

2003-12-16 Thread Shaun
Hi,

What is the maximum length for the name of a column in MySQL?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] DATETIME Query

2003-10-07 Thread Shaun
Hi,

I have a table called Bookings which has two important columns;
Booking_Start_Date and Booking_End_Date. These columns are both of type
DATETIME. The following query calculates how many hours are available
between the hours of 09.00 and 17.30 so a user can see at a glance how many
hours they have unbooked on a particular day (i.e. 8.5 hours less the time
of any bookings on that day). However, when a booking spans more than one
day the query doesn't work, for example if a user has a booking that starts
on day one at 09.00 and ends at 14.30 on the next day, the query returns 3.5
hours for both days. Any help here would be greatly appreciated.

SELECT
8.5 - (SUM(((DATE_FORMAT(B.Booking_End_Date, '%k') * 60 ) +
 DATE_FORMAT(B.Booking_End_Date, '%i')) -
   ((DATE_FORMAT(B.Booking_Start_Date, '%k') * 60 ) +
 DATE_FORMAT(B.Booking_Start_Date, '%i'))) / 60) AS
Available_Hours
FROM WMS_Bookings B
WHERE B.User_ID = '16'
AND B.Booking_Status  '1'
AND NOT ( '2003-10-07'  DATE_FORMAT(Booking_Start_Date, %Y-%m-%d) OR
'2003-10-07'  DATE_FORMAT(Booking_End_Date, %Y-%m-%d) )

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Selecting two names from a table

2003-10-06 Thread Shaun
Hi,

I have a table called Bookings and a table called User. Bookings are created
and hold the User_ID of the User who created it (Booking.Booked_User) and
the User who will be going on the booking (Booking.Booking_Creator). How can
I create a report that lists both users on each row. If I do 'SELECT
U.User_Name, B.Booking_Date FROM WMS_User WHERE B.Booking_Creator =
U.User_ID AND B.Booked_User = U.User_ID', then the query returns no data. So
for each row in the table I need to somehow select 2 names from the user
table based on 2 different User_ID's held in the Bookings table. Any help
would be greatly appreciated.


Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Selecting two names from a table

2003-10-06 Thread Shaun
Thank you!


Jacob A. Van Zanen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 Try something like this:

 SELECT U1.User_Name
 , U2.User_Name
 , B.Booking_Date
 FROM USER U1
 , USER U2
 , BOOKING B
 WHERE B.Booking_Creator = U1.User_ID
 AND B.Booked_User = U2.User_ID'

 Jack



 -Original Message-
 From: Shaun [mailto:[EMAIL PROTECTED]
 Sent: Monday, October 06, 2003 11:24 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Selecting two names from a table


 Hi,

 I have a table called Bookings and a table called User. Bookings are
 created and hold the User_ID of the User who created it
 (Booking.Booked_User) and the User who will be going on the booking
 (Booking.Booking_Creator). How can I create a report that lists both
 users on each row. If I do 'SELECT U.User_Name, B.Booking_Date FROM
 WMS_User WHERE B.Booking_Creator = U.User_ID AND B.Booked_User =
 U.User_ID', then the query returns no data. So for each row in the table
 I need to somehow select 2 names from the user table based on 2
 different User_ID's held in the Bookings table. Any help would be
 greatly appreciated.


 Thanks for your help

 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] HELP With UPDATE Query in mySQL

2003-10-04 Thread Shaun
Hi,

I have two columns in my Bookings table of type DATETIME -
Booking_Start_Date and Boking_End_Date. How can i update every row so that
all of the times for Booking_Start_Date are 09.00 and all of the times for
Booking_End_Date are 17.30, without affecting any of the dates?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Help With Another UPDATE Query Please!

2003-10-04 Thread Shaun
Hi,

I am making some alterations to my Database. I have a table called projects
and a table called Work_Types. Projects currently contains the name of the
work type (Work_Type) but now I want to change this so it contains the
Work_Type_ID, is it possible to update Projects with one query?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Help With Another UPDATE Query Please!

2003-10-04 Thread Shaun
I am using mySQL 3.23

Each project has a work type associated with it, currently the Work Type
column of the Project table holds the work type name, however i have now
added a Work_Type_ID column to the Work_Type table and i would like Projects
to hold the Work_Type_ID as opposed to the Work Type Name.

Thanks for your help

Jeff Shapiro [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 It all depends on what database server (and version) you are using. I'm
 not really sure what you are asking, and could use a little more detail
 about the tables and what are needing to do.

 On Sat, 4 Oct 2003 13:45:56 +0100, Shaun spoke thusly about [PHP-DB]
 Help With Another UPDATE Query Please!:
  Hi,
 
  I am making some alterations to my Database. I have a table called
projects
  and a table called Work_Types. Projects currently contains the name of
the
  work type (Work_Type) but now I want to change this so it contains the
  Work_Type_ID, is it possible to update Projects with one query?
 
  Thanks for your help

 ---
 Listserv only address.
 Jeff Shapiro

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Calculating time unused

2003-10-03 Thread Shaun

David Robley [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 In article [EMAIL PROTECTED], [EMAIL PROTECTED]
 says...
  Hi,
 
  I have a table called Bookings which has two important columns;
  Booking_Start_Time and Booking_End_Time. These columns are both of type
  DATETIME. Given any day how can I calculate how many hours are available
  between the hours of 09.00 and 17.30 so a user can see at a glance how
many
  hours they have unbooked on a particular day, can this be done with a
query
  or do I have to work it out with PHP?
 
  Thanks for your help

 Seems easy enough - just sum the time booked per day and subtract it from
 the constant which is the total of available hours, and group by day.
 You'll need to calculate the booked time based on existing start/end
 values but you should be able to do that in SQL.

 Cheers
 -- 
 Quod subigo farinam

 A: Because it messes up the order in which people normally read text.
 Q: Why is top-posting such a bad thing?
 A: Top-posting.
 Q: What is the most annoying thing on usenet?

Thanks for your reply,

I am having some odd results with this, just wondering if you could check
this query for me:

SELECT COUNT(B.Booking_ID) AS Booking_ID,
   SUM(8.5 - (DATE_FORMAT(Booking_Start_Date, '%h:%i:%s')) +
(DATE_FORMAT(B.Booking_End_Date, '%h:%i:%s'))) AS Available_Hours
   FROM WMS_Bookings B
   WHERE B.User_ID = '.$user_id.'
   AND B.Booking_Status  '1'
   AND '.date(Y-m-d,
strtotime($loop3_this_year-$loop3_this_month-$loop3_this_day)).' =
DATE_FORMAT(Booking_Start_Date, '%Y-%m-%d');

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Hours available in a day

2003-10-03 Thread Shaun
Hi,

I have a table called Bookings which has two important columns;
Booking_Start_Time and Booking_End_Time. These columns are both of type
DATETIME. Given any day how can I calculate how many hours are available
between the hours of 09.00 and 17.30 so a user can see at a glance how many
hours they have unbooked on a particular day (i.e. 8.5 hours less the time
of any bookings on that day), can this be done with a query
or do I have to work it out in my code?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Round a number

2003-10-03 Thread Shaun
Hi,

I have a query that returns a number from  culculation in my table. It
returns say 4.00, 8.75, 0.00, 12.50 etc. How can I get MySQL to return the
number without any zeros, i.e. 4, 8.75, 0, 12.5 etc?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Hours available in a day

2003-10-03 Thread Shaun

Shaun [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 I have a table called Bookings which has two important columns;
 Booking_Start_Time and Booking_End_Time. These columns are both of type
 DATETIME. Given any day how can I calculate how many hours are available
 between the hours of 09.00 and 17.30 so a user can see at a glance how
many
 hours they have unbooked on a particular day (i.e. 8.5 hours less the time
 of any bookings on that day), can this be done with a query
 or do I have to work it out in my code?

 Thanks for your help

Fixed:

$query = SELECT
  8.5 - (SUM(((DATE_FORMAT(B.Booking_End_Date, '%k') * 60 ) +
DATE_FORMAT(B.Booking_End_Date, '%i')) -
 ((DATE_FORMAT(B.Booking_Start_Date, '%k') * 60 ) +
DATE_FORMAT(B.Booking_Start_Date, '%i'))) / 60) AS
Available_Hours
 FROM Bookings B
  WHERE B.User_ID = '.$user_id.'
  AND DATE_FORMAT(Booking_Start_Date, '%Y-%m-%d') = '.date(Y-m-d,
strtotime($year-$month-$day)).';

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Calculating time unused

2003-10-03 Thread Shaun

Shaun [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 David Robley [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  In article [EMAIL PROTECTED],
[EMAIL PROTECTED]
  says...
   Hi,
  
   I have a table called Bookings which has two important columns;
   Booking_Start_Time and Booking_End_Time. These columns are both of
type
   DATETIME. Given any day how can I calculate how many hours are
available
   between the hours of 09.00 and 17.30 so a user can see at a glance how
 many
   hours they have unbooked on a particular day, can this be done with a
 query
   or do I have to work it out with PHP?
  
   Thanks for your help
 
  Seems easy enough - just sum the time booked per day and subtract it
from
  the constant which is the total of available hours, and group by day.
  You'll need to calculate the booked time based on existing start/end
  values but you should be able to do that in SQL.
 
  Cheers
  -- 
  Quod subigo farinam
 
  A: Because it messes up the order in which people normally read text.
  Q: Why is top-posting such a bad thing?
  A: Top-posting.
  Q: What is the most annoying thing on usenet?

 Thanks for your reply,

 I am having some odd results with this, just wondering if you could check
 this query for me:

 SELECT COUNT(B.Booking_ID) AS Booking_ID,
SUM(8.5 - (DATE_FORMAT(Booking_Start_Date, '%h:%i:%s')) +
 (DATE_FORMAT(B.Booking_End_Date, '%h:%i:%s'))) AS Available_Hours
FROM WMS_Bookings B
WHERE B.User_ID = '.$user_id.'
AND B.Booking_Status  '1'
AND '.date(Y-m-d,
 strtotime($loop3_this_year-$loop3_this_month-$loop3_this_day)).' =
 DATE_FORMAT(Booking_Start_Date, '%Y-%m-%d');

 Thanks for your help

Fixed it :)

$query = SELECT
  8.5 - (SUM(((DATE_FORMAT(B.Booking_End_Date, '%k') * 60 ) +
DATE_FORMAT(B.Booking_End_Date, '%i')) -
 ((DATE_FORMAT(B.Booking_Start_Date, '%k') * 60 ) +
DATE_FORMAT(B.Booking_Start_Date, '%i'))) / 60) AS
Available_Hours
 FROM Bookings B
  WHERE B.User_ID = '.$user_id.'
  AND DATE_FORMAT(Booking_Start_Date, '%Y-%m-%d') = '.date(Y-m-d,
strtotime($year-$month-$day)).';

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Calculating time unused

2003-09-30 Thread Shaun
Hi,

I have a table called Bookings which has two important columns;
Booking_Start_Time and Booking_End_Time. These columns are both of type
DATETIME. Given any day how can I calculate how many hours are available
between the hours of 09.00 and 17.30 so a user can see at a glance how many
hours they have unbooked on a particular day, can this be done with a query
or do I have to work it out with PHP?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Help with UPDATE query

2003-09-29 Thread Shaun
Hi,

I have two columns in my Bookings table of type DATETIME -
Booking_Start_Date and Boking_End_Date. How can i update every row so that
all of the times for Booking_Start_Date are 09.00 and all of the times for
Booking_End_Date are 17.30, without affecting any of the dates?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] If in a query

2003-09-27 Thread Shaun
Hi,

is it possible to create a query with parameters such that it selects a
field if it isn't null?

for example:

SELECT
  A.Column1,
  A.Column2,
  (if not null, B.Column1)
FROM Table1 A, Table2 B

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: If in a query

2003-09-27 Thread Shaun
i'm sorry,

i rushed that previous post!!!

what i meant to ask was, if the value of B.Column1 is null then can the
query be written such that we dont select A.Column2.

Sorry!

Shaun [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 is it possible to create a query with parameters such that it selects a
 field if it isn't null?

 for example:

 SELECT
   A.Column1,
   A.Column2,
   (if not null, B.Column1)
 FROM Table1 A, Table2 B

 Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] UPDATE part of a column

2003-09-23 Thread Shaun
Hi,

I have a column in my table called address. When users add an address with a
textarea they sometimes press return for a new line and this seems to be
putting line breaks into the database, so I have 2 questions:

1. How can I clean the table, so for example changing:
Ashfield Business CentreBR The Idlewells PrecinctBR
Sutton-in-AshfieldBR
to:
Ashfield Business Centre, The Idlewells Precinct, Sutton-in-Ashfield,

2, Is there a way to make sure the data is 'clean' before entering into the
table?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] UPDATE Query

2003-09-12 Thread Shaun
Hi,

I have (amogst others) three tables in my database named Bookings, User, and
Representative. A User and a Representative are different types of user,
however I now want to merge these tables into one - User. When a Booking is
made, the User_ID and the Rep_ID are stored in the Booking table. I have now
merged the two tables (User and Representative), how can I update the Rep_ID
column in Bookings so that it refers to the User_ID for each Representative
in the User table?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] ORDER BY Query

2003-09-05 Thread Shaun
Hi,

I have a table in my database called Users. This table has (among others)
two columns called Location and Name. Location will be either 1, 2, 3, or 4.
How can I produce a query that groups the result into Location and then for
each Location order the User by Name?

Thanks for your help.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] COUNT AVG

2003-09-05 Thread Shaun
Hi,

Is it possible to combine the COUNT  AVG functions using MySQL? I have a
table called Bookings and I need to find out the average number of bookings.
So I need to count the number of bookings in the table and then get the
Average, is this possible?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Viewing Data From MySQL

2003-09-03 Thread Shaun
Hi,

Is it possible to change the way a query is displayed from a MySQL database.
For example if I have a column that contains '1' or '0' can I run a query
that returns 'Yes' for every '1' and 'No' for every '0'?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] SELECT Part of a Field

2003-08-29 Thread Shaun
Hi,

How can I SELECT a portion of a field in a table for example the first
character, or the second two characters etc?

Thanks for your help

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Help with a DELETE query

2003-08-20 Thread Shaun
Hi,

In a small part of my database I have two tables as follows:

# -- MySQL dump -- 
#
# Table structure for table 'WMS_Data'
#
CREATE TABLE WMS_Data (
Data_ID int(11) DEFAULT '' NOT NULL auto_increment,
Booking_ID int(11) DEFAULT '0' NOT NULL ,
Data_Field_1 varchar(100) ,
Data_Field_2 varchar(100) ,
Data_Field_3 varchar(100) ,
Data_Field_4 varchar(100) ,
Data_Field_5 varchar(100) ,
Data_Field_6 varchar(100) ,
Data_Field_7 varchar(100) ,
Data_Field_8 varchar(100) ,
Data_Field_9 varchar(100) ,
Data_Field_10 varchar(100) ,
PRIMARY KEY (Data_ID)
);

#
# Table structure for table 'WMS_Fields'
#
CREATE TABLE WMS_Fields (
Field_ID int(11) DEFAULT '' NOT NULL auto_increment,
Field_Name varchar(40) DEFAULT '' NOT NULL ,
Project_ID int(11) DEFAULT '0' NOT NULL ,
Work_Type_ID int(11) DEFAULT '0' NOT NULL ,
Data_Field varchar(20) ,
PRIMARY KEY (Field_ID)
);

# --- Dump ends --- 

The purpose of this is for every project created in the database the user
can create various data fields and collect data. The data is stored in table
WMS_Data and the data fields are named in table WMS_Fields. In this table
column Data_Field stores the column name of the corresponding Data_Field in
table WMS_Data. How can i create a query that deletes everything from a
given column in table WMS_Data, if I only have the Field_ID for table
WMS_Fields?

Something like: DELETE FROM WMS_Data D COLUMN WHERE WMS_Fields.Data_Field =
D.Column_Name AND WMS_Fields.Field_ID = '$my_variable';

Please excuse the poor SQL, just trying to explain what I am trying to do!

Thanks for your help




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] PHP MSSQL

2003-08-11 Thread Shaun Bentley
Hi
I am currently trying to use PHP and MSSQL together but I am having a
few problems.

I can enter data into the Db OK, but when pulling the data back to display
on the page, the string cuts to around 250 chars. The Db field is VarChar
6000 and I can see the whole data in the field.

I have tried pulling the data out as object, array  row but always lose the
end.

Any help please!

Shaun



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Total Values with MySQL

2003-06-03 Thread shaun
Hi,

Is it possible to get MySQL to total the values of a select statement, say
'SELECT ColumnName FROM Table WHERE ColumnName = '1''

Say I have three values in ColumnName all of '1' then can I get MySQL to
return 3?

Thanks for your help



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Database Design Help

2003-04-02 Thread shaun
Thanks for your reply but the data fields to be captured have to be the same
for each project, ie when an administrator sets up project A, he might want
to capture fields X, Y, Z for each booking taken for that project...

Gustavo Del Castillo Meza [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 The easiest way to deal with this is to add a TEXT field to the end of the
 Booking table and
 have the user put in there all the extra data they need.
 If this doesnt resolve your problem you could add an etra table called
 extraData or something like that it may look like this:

 extraData:

 PK  extraData_ID
 FK  Booking_ID
Description   Here you describe the data to be captured Ej.
 Location
Data-And here the actual data Ej. Quebec

 This way you can capture N records of extra data for the booking

 Shaun [EMAIL PROTECTED] escribió en el mensaje
 news:[EMAIL PROTECTED]
  the data colleccted at each booking will be the fields set by an
  administrator that he/she feels are appropriate to collect for that
 project.
 
 
  Gustavo Del Castillo Meza [EMAIL PROTECTED] wrote in
message
  news:[EMAIL PROTECTED]
   What kind of data do you need to collect at each booking?
  
   Shaun [EMAIL PROTECTED] escribió en el mensaje
   news:[EMAIL PROTECTED]
Hi,
   
I am creating a database for a web application. The idea for the
   application
is for a company administrator to be able to log into the site and
   allocate
staff to a project.
   
Staff will be able to log in and update the status of the project
they
  are
working on and clients will be able to log in and book a member of
 staff
to their own projects.
   
Administrators will be able to add / edit / delete - staff / clients
/
projects.
   
Here is my database diagram:
   
http://www.mania.plus.com
   
My problem is each different project will need to have different
data
collected for it at each booking. How could I handle this in the
  database
model? The administrator would like to be able to edit the data
  collected
for each project via the site...
   
Any other comments on my database model would be appreciated as this
 is
  my
weakest area of web development by far!
   
   
  
  
 
 





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Database Design Help

2003-04-01 Thread shaun
the data colleccted at each booking will be the fields set by an
administrator that he/she feels are appropriate to collect for that project.


Gustavo Del Castillo Meza [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 What kind of data do you need to collect at each booking?

 Shaun [EMAIL PROTECTED] escribió en el mensaje
 news:[EMAIL PROTECTED]
  Hi,
 
  I am creating a database for a web application. The idea for the
 application
  is for a company administrator to be able to log into the site and
 allocate
  staff to a project.
 
  Staff will be able to log in and update the status of the project they
are
  working on and clients will be able to log in and book a member of staff
  to their own projects.
 
  Administrators will be able to add / edit / delete - staff / clients /
  projects.
 
  Here is my database diagram:
 
  http://www.mania.plus.com
 
  My problem is each different project will need to have different data
  collected for it at each booking. How could I handle this in the
database
  model? The administrator would like to be able to edit the data
collected
  for each project via the site...
 
  Any other comments on my database model would be appreciated as this is
my
  weakest area of web development by far!
 
 





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Entering a Query

2003-04-01 Thread shaun
Hi,

I would be very interested to see an example of how it would be possible to
enter a query into a text area and the results of the query displayed on the
next page, similar to PHP admin I guess, are they any examples out there?



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Entering a Query

2003-04-01 Thread shaun
thanks for your reply,

What i was after is a way of representing the data, given that you dont know
what columns will be displayed and how many rows etc?

I would only be looking to do 'selects' so how can i ensure that this is the
only type of query run?

Thanks for your help

Ronan Chilvers [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi Shaun

 Comments inline ...

 On 01 Apr,2003 at 13:37 shaun shaun wrote:

 snip
  Hi,
 
  I would be very interested to see an example of how it would be possible
to
  enter a query into a text area and the results of the query displayed on
the
  next page, similar to PHP admin I guess, are they any examples out
there?
 
 /snip

 Fairly simple At its most basic you have a form :-

 form method=post action=do_query.php
 textarea name=myquery/textarea
 input type=submit name=submit value=Submit
 /form

 which posts to your php page :-

 ?php

 $sql = $HTTP_POST_VARS[myquery];

 // You'll need code here to sanitize the query and make sure there's
 // no nasty surprises in it.

 // then simply create your connection (assuming a function here)
 $conn = db_connect();

 $result = mysql_query($sql);

 // Code to display the result here

 ?

 You would need to have some checking involved for the query.  Also, as
always, apply 'least privilege' to the user the query runs as.  I don't know
what you're using it for but be VERY careful - I would only allow selects
here unless you're sure you know how it will be used.

 Hope this helps ... :-)

 --
 Ronan
 e: [EMAIL PROTECTED]
 t: 01903 739 997
 w: www.thelittledot.com

 The Little Dot is a partnership of
 Ronan Chilvers and Giles Webberley



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Database Design Help

2003-03-31 Thread shaun
Hi,

I am creating a database for a web application. The idea for the application
is for a company administrator to be able to log into the site and allocate
staff to a project.

Staff will be able to log in and update the status of the project they are
working on and clients will be able to log in and book a member of staff
to their own projects.

Administrators will be able to add / edit / delete - staff / clients /
projects.

Here is my database diagram:

http://www.mania.plus.com

My problem is each different project will need to have different data
collected for it at each booking. How could I handle this in the database
model? The administrator would like to be able to edit the data collected
for each project via the site...

Any other comments on my database model would be appreciated as this is my
weakest area of web development by far!



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Catch Errors

2003-03-30 Thread shaun
Hi,

Is it possible to catch the type of error message returned form a
mysql_query(); funtion

for example

if ($error == //duplicate row for table)
{
echo This row already exists in the table;
}



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Table structure

2003-03-25 Thread shaun
Hi,

I would be very grateful if someone could look at my table design for me
please. The sytem will be used to
allow users to log in to a web site and book staff. Here is my design so
far.

# -- MySQL dump --
#
# Table structure for table 'WMS_Allocations'
#
CREATE TABLE WMS_Allocations (
  Allocation_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  Project_ID int(11)  DEFAULT '0' NOT NULL ,
  User_ID int(11)  DEFAULT '0' NOT NULL ,
  PRIMARY KEY (Allocation_ID),
  KEY Project_ID (Project_ID,User_ID)
);

#
# Table structure for table 'WMS_Bookings'
#
CREATE TABLE WMS_Bookings (
  Booking_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  Booking_Date date  DEFAULT '-00-00' NOT NULL ,
  PCT_address varchar(255),
  PCT_postcode varchar(255),
  PCT_telephone varchar(255),
  PCT_manager varchar(255),
  PCT_gp varchar(255),
  P_address varchar(255),
  P_postcode varchar(255),
  P_telephone varchar(255),
  P_manager varchar(255),
  P_gp varchar(255),
  Allocation_ID int(11),
  PRIMARY KEY (Booking_ID),
  KEY Allocation_ID (Allocation_ID)
);

#
# Table structure for table 'WMS_Projects'
#
CREATE TABLE WMS_Projects (
  Project_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  Project_Name varchar(255),
  PRIMARY KEY (Project_ID)
);

#
# Table structure for table 'WMS_User'
#
CREATE TABLE WMS_User (
  User_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  User_Username varchar(100)  DEFAULT '' NOT NULL ,
  User_Password varchar(100)  DEFAULT '' NOT NULL ,
  User_Name varchar(100)  DEFAULT '' NOT NULL ,
  User_Type int(11)  DEFAULT '0' NOT NULL ,
  User_Email varchar(100),
  PRIMARY KEY (User_ID),
  UNIQUE User_Username (User_Username)
);

A user could be a client, a staff member, or an administrator. Clients can
log in and book staff to their own projects. Administrators can log in,
allocate staff to any project, add/edit/delete - projects/staff/clients, and
book staff on a project they are allocated to. A staff member will be able
to log in and complete a booking they have undertaken and add in data needed
for the project.

At the moment i have a single table to incorporate all three types of user
but i think i need to change this as the relationship between a client and a
project is different to a staff member/administrator and a project. A client
can have many projects but a project will only belong to one client where as
a staff member/administrator could be allocated to many projects and project
could be allocated to many staff members/administrators. My MySQL
installation doesnt support Foreign Keys which makes life a little
difficult!

Any thoughts comments on this would be greatly appreciated.

Thanks for your time.




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Help with a query please

2003-03-24 Thread shaun
Hi,

I have the following table structure, as my installation of MySQL doesnt
support Foreign keys i have to maintain the referential integrity myself. So
if i delete a user, how can i make sure that the allocations from the
allocations table where the user_id is the same as the one being deleted and
that bookings are deleted where the allocations_id is the same as the
allocations deleted for that user_id?

Thanks for your help

# -- MySQL dump --
#
# Table structure for table 'WMS_Allocations'
#
CREATE TABLE WMS_Allocations (
  Allocation_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  Project_ID int(11)  DEFAULT '0' NOT NULL ,
  User_ID int(11)  DEFAULT '0' NOT NULL ,
  PRIMARY KEY (Allocation_ID),
  KEY Project_ID (Project_ID,User_ID)
);

#
# Table structure for table 'WMS_Bookings'
#
CREATE TABLE WMS_Bookings (
  Booking_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  Booking_Date date  DEFAULT '-00-00' NOT NULL ,
  PCT_address varchar(255),
  PCT_postcode varchar(255),
  PCT_telephone varchar(255),
  PCT_manager varchar(255),
  PCT_gp varchar(255),
  P_address varchar(255),
  P_postcode varchar(255),
  P_telephone varchar(255),
  P_manager varchar(255),
  P_gp varchar(255),
  Allocation_ID int(11),
  PRIMARY KEY (Booking_ID),
  KEY Allocation_ID (Allocation_ID)
);

#
# Table structure for table 'WMS_Projects'
#
CREATE TABLE WMS_Projects (
  Project_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  Project_Name varchar(255),
  PRIMARY KEY (Project_ID)
);

#
# Table structure for table 'WMS_User'
#
CREATE TABLE WMS_User (
  User_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  User_Username varchar(100)  DEFAULT '' NOT NULL ,
  User_Password varchar(100)  DEFAULT '' NOT NULL ,
  User_Name varchar(100)  DEFAULT '' NOT NULL ,
  User_Type int(11)  DEFAULT '0' NOT NULL ,
  User_Email varchar(100),
  PRIMARY KEY (User_ID),
  UNIQUE User_Username (User_Username)
);




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Help with this query

2003-03-21 Thread shaun
Hi,

I have the following tables in my database:

CREATE TABLE WMS_Allocations (
  Allocation_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  Project_ID int(11)  DEFAULT '0' NOT NULL ,
  User_ID int(11)  DEFAULT '0' NOT NULL ,
  PRIMARY KEY (Allocation_ID),
);

CREATE TABLE WMS_Projects (
  Project_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  Project_Name varchar(255),
  PRIMARY KEY (Project_ID)
);

CREATE TABLE WMS_User (
  User_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  User_Username varchar(100)  DEFAULT '' NOT NULL ,
  User_Password varchar(100)  DEFAULT '' NOT NULL ,
  User_Name varchar(100)  DEFAULT '' NOT NULL ,
  User_Type int(11)  DEFAULT '0' NOT NULL ,
  PRIMARY KEY (User_ID),
  UNIQUE User_Username (User_Username)
);

How can i select users from WMS_User where no users have been allocated to a
particular project - seems a little tricky with MySQL?



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Nested MySQL Query

2003-03-18 Thread shaun
Hi,

I have just found out that I can't use nested queries with MySQL so could
someone tell me how i can transform the following query for use with MySQL?

SELECT * FROM Allocations WHERE (SELECT Project_ID FROM Project WHERE
Project_Name = $_POST[project_name])

thanks for your help



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: storing files in database

2003-03-18 Thread shaun
a more prerferable way to do this would be to store a reference to each file
in the database, maybe renaming each file name to the 'files_id' of your
table...

Michiel Van Heusden [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 is there any possibility using PHP 4 to store entire files as a database
 field in a MySQL database?
 and if so, does anybody know a way, or a tutorial describing this?

 thanks
 michiel





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Listing Tables

2003-03-15 Thread shaun
Hi,

i would like to list all of the tables and field names in my database

e.g.

table 1
  field 1
  field 2
  field 3
table 2
  field 1
  field 2
  field 3
table 3
  field 1
  field 2
  field 3
etc

is there a simple way to do this?

thanks for your help



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] table relationship

2003-03-10 Thread shaun
Hi,

I am creating a web site which will have different types of users:
Administrators, clients and staff. Is it possible/good practice to have 3
tables related to one table i.e.


 USER
 user_id (PK)
  |
  |
  |   ||
  |   ||
AdministratorClient  Staff
admin_id(PK)   client_id(PK)   staff_id(PK)
user_id(FK)  user_id(FK)user_id(FK)


Thanks in advance for any advice offered.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] content management

2003-03-10 Thread shaun
I would really appreciate some advice from anyone who has worked with or
developed their own content management system.

This is my scenario, when i have finished creating a site, i want to be able
to add in the CMS with a minimum amount of fuss. I want to be able to get
the CMS to recognize all the tables and somehow allow me to set the tables
and fields that the client can update safely (i.e. if it is an employment
recruitment site then they will be able to add jobs but not job_id). This
will save me so much time rather than having to handcode the CMS for every
site.

I think i have an answer to my problem, and would be interested to hear your
opinion. When i install the CMS it will read the existing tables and create
2 new tables:

CMS_TABLES
cms_table_id(PK)
cms_table_name
cms_table_is_editable

CMS_FIELDS
cms_field_id(PK)
cms_table_id(FK)
cms_field_name
cms_field_is_editable
cms_field_type
cms_field_size
cms_field_is_primary_key

As an administrator I will be able to set fields and tables which are
editable. Now when i go to the database management page i can do 'SELECT *
FROM CMS_FIELDS WHERE cms_table_id = '$_GET[table_id]' AND
cms_field_editable = TRUE

Also does anyone have any suggestions for editing static content?

Any comments here would be greatly appreciated.

Thanks





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Database design

2003-03-10 Thread shaun
Hi,

I am creating a database for a web application. The idea for the application
is for a company administrator to be able to log into the site and allocate
staff to a project which will be a clinical trial at a particular practice.
Staff will be able to log in and update the status of the project they are
working on and clients will be able to log in and book a member of staff.
Administrators will be able to add / edit / delete - staff / clients /
clinical trials.

Here is my database diagram:

http://www.mania.plus.com

My problem is each different clinical trail will need to have different data
collected for it. How could I handle this in the database model? The
administrator would like to be able to edit the data collected for each
trial via the site...

Any other comments on my database model would be appreciated as this is my
weakest area of web development by far!




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Add column to a table

2002-10-31 Thread Shaun Thornburgh
Hi,

Please could someone tell me what the syntax is to add a column to a table?

Thanks



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Global Connection object

2002-05-01 Thread Shaun Johnston

Is it possible to make a MySQL connection object global, so that it doesn't
need to be declared as a parameter to be accessed from individual functions?



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Why do 95% of internet business fail only 5% succeed

2001-10-31 Thread Shaun

Dear Entrepreneur:

Can you honestly say that you're earning the type of income you 
thought you would when you first began your networking career?

Unfortunately, the history of networking says that there's a 95% 
chance you are not earning what you would like to earn.

How many different opportunities have you been involved with?

How many times have you thought, This is the one?

If you are one of the 5% of networkers who is earning a good 
income, what about your team?  How many of them are successful? 
Regretfully, you know the answer to that question as well as we 
doVERY FEW! 

Does it bother you to know that as many as 95% of the people in 
your group won't even recover what they have paid to get involved?

It DOES NOTT MAKE SENSE, DOES IT?

How can so many people who have been successful in other walks 
of life, fail so miserably in networking?

The Answer:
Network marketing for the most part, is based on the theory 
of Internal Consumption. That is, the VAST majority of the 
company's products are purchased and consumed by distributors, 
NOT real customers!

Let me ask you:
How many supermarkets, department stores, car dealerships, etc., 
do you think would survive if they depended PRIMARILY on 
purchases by their employees of the company's products to keep 
them in business?

As the same rule applies in the real world of business  ... It is the 
same with networking and home-based business.  A 95% failure rate 
makes this clear.

Even networking companies that are truely product and consumer 
driven find many of their distributors failing. Why? Because people 
simply DO NOT LIKE TO SELL!

Unfortunately, for 90% or more of the distributors in any typical 
network marketing company, it DOESN'T MATTER how great 
their products are supposed to be, or how fantastic the comp plan 
is, or how strong the company and management team are...

The VAST MAJORITY of distributors WILL STILL FAIL because 
people simply DO NOT LIKE TO SELL!! You nor I will EVER 
change that part of human nature for the masses.

Is there an answer? 
Yes, there is, but you won't find it in any Network Marketing 
training manual.

Unfortunately, most company owners and their top leaders already 
know that the vast majority won't be successful. Yet, we continue to 
see company after company spring up with more rhetoric, promises, 
etc.

Why? 
Because the ONLY people who are guaranteed to earn any 
significant income if the company lasts, are the owners and their top 
people. 
Sorry, but the truth is the truth!

Forget the rhetoric we're now hearing about selling online because, 
once again, in the year 2000, more than 90% of all online businesses 
DIDN'T MAKE A PROFIT!

The sad part is, if we continue to do the same things over and over 
again that have only produced failure in the past, the result will 
always be the same: MORE FAILURE.

While a quality product, good compensation, a strong management 
team, and a financially sound company are all important to the 
success of any company, none of these factors can replace the 
single most important feature that a networking company MUST 
HAVE ... The average person must have a chance of finding 
LONGTERM success. 

Does this mean that networking is bad? Not at all. What it does 
mean is that the way networking has been historically promoted for 
years with the emphasis on internal product consumption (where 
the distributors purchase the vast majority of products for 
personsal use) will continue to produce a 95% failure rate.

We have a solution that works for anyone who is willing to work 
steadily, is consistent, and can read and follow a very simple system 
that was designed for beginners.  This system has proven successful 
every time over the years for those who followed it.

If you would like to experience results in your life, email us at 
 [EMAIL PROTECTED]   with Information request in the subject.  
Please include your name, country, and phone number so that we 
can send you the correct information.  We will email you an 
introduction about our company and our entire system at no cost to 
you.

We will not email you ridiculous promises, or UNPROVEN OR 
FAILED THEORIES...Just the facts!

While no one can or should ever guarantee your success in any 
business, here's one thing we do promise you:
The TRUTH and a system that will show you HOW TO DO 
THINGS STEP-BY-STEP!

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Newbie Question: Convert SELECT to DELETE statement in mysql

2001-10-18 Thread Shaun Honsvick

No, I am not trying to delete with a select statement. That was just there
to show my tables, fields, etc.

So if I understand what you are saying I can not do a delete statement with
a join in it. I would have to query each individual row for the ID that need
to be deleted, delete the row in the first table, then delete the row in the
second table, third table, etc. Then loop for the next intance. Theres got
to be a better way.  Also, after this is done should I run some sort compact
or defrag on the database that restore wasted space?

Thanks,
Shaun


Rick Emery [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 Are you trying to delete records with a SELECT statement?  That can't be
 done.

 To delete from two different tables, you must use two different DELETE
 statements.

 -Original Message-
 From: Shaun Honsvick [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, October 16, 2001 3:59 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Newbie Question: Convert SELECT to DELETE statement in
 mysql


 I am trying to run a delete on a mysql database. The delete query needs to
 delete from 2 tables. The select statement is:

 SELECT tinvoices.*, ttrackingnumbers.* FROM tinvoices LEFT JOIN
 ttrackingnumbers ON tinvoices.InvoiceID = ttrackingnumbers.InvoiceID WHERE
 Date  '2001-08-01';

 I can't seem to get a delete statement to work. (This is my first project)

 Thanks,
 Shaun



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] connecting to sybase

2001-04-06 Thread shaun

Fiesta
does anybody know how to connect to a sybase database thats using the
adaptive server anywere driver???

i tried

$hostname =  "host";
$username =  "user";
$password =  "pass";
$dbName =  "database name";
$table = "table name";
Sybase_CONNECT($hostname, $username, $password) OR DIE( "Unable to connect
to database");
any insight would help
please email me anything you have that could help me

[EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]