[PHP-DB] commas

2003-07-17 Thread Chris Mach
Is there a function that will strip or add commas?

I'm trying to do calculations with attendance numbers of football games...
for example:  33,153

right now I don't have a comma for the numbers in the database. So the above
example is 33153 in my database. If I put the comma in, when I try to do
calculations with php it sees it as 33 instead of 33,153.

So is there a way to add that comma afterwards? Perhaps a string function at
will put the comma in after the first 3 characters?

Thanks





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



RE: [PHP-DB] commas

2003-07-17 Thread Gary . Every
Check out the php function number_format($field,0)

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Chris Mach [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 17, 2003 7:43 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] commas
 
 
 Is there a function that will strip or add commas?
 
 I'm trying to do calculations with attendance numbers of 
 football games...
 for example:  33,153
 
 right now I don't have a comma for the numbers in the 
 database. So the above
 example is 33153 in my database. If I put the comma in, when 
 I try to do
 calculations with php it sees it as 33 instead of 33,153.
 
 So is there a way to add that comma afterwards? Perhaps a 
 string function at
 will put the comma in after the first 3 characters?
 
 Thanks
 
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


RE: [PHP-DB] commas

2003-07-17 Thread Edward Peloke
format_number() should do what you want

http://us3.php.net/manual/en/function.number-format.php

Eddie

-Original Message-
From: Chris Mach [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 17, 2003 8:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] commas


Is there a function that will strip or add commas?

I'm trying to do calculations with attendance numbers of football games...
for example:  33,153

right now I don't have a comma for the numbers in the database. So the above
example is 33153 in my database. If I put the comma in, when I try to do
calculations with php it sees it as 33 instead of 33,153.

So is there a way to add that comma afterwards? Perhaps a string function at
will put the comma in after the first 3 characters?

Thanks





--
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] commas

2003-07-17 Thread Edward Peloke
sorry, I am a backwards today...number_format()

-Original Message-
From: Edward Peloke [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 17, 2003 9:01 AM
To: Chris Mach; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] commas


format_number() should do what you want

http://us3.php.net/manual/en/function.number-format.php

Eddie

-Original Message-
From: Chris Mach [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 17, 2003 8:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] commas


Is there a function that will strip or add commas?

I'm trying to do calculations with attendance numbers of football games...
for example:  33,153

right now I don't have a comma for the numbers in the database. So the above
example is 33153 in my database. If I put the comma in, when I try to do
calculations with php it sees it as 33 instead of 33,153.

So is there a way to add that comma afterwards? Perhaps a string function at
will put the comma in after the first 3 characters?

Thanks





--
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] Full text search

2003-07-17 Thread Angelo Zanetti
Hi guys can anyone point me to some resources with regard to doing full-text searches 
in php. I looked at the mySQL docs and there doesnt seem to be much there. 

TIA.

Angelo


[PHP-DB] PHP Full Text SOLVED-dont worry

2003-07-17 Thread Angelo Zanetti



[PHP-DB] Oracle ODBC connection Problem

2003-07-17 Thread angel
i'm trying to connect to a oracle database using the odbc driver with the
followin script:

-
?php$user=user;$upasswd=password;$dsn = dsn;
$query = select sysdate from dual;print pquery is:
code$query/codebr;   $conn = odbc_pconnect($dsn,
$user,$upasswd );
if (!$conn) {print Connection failed\n/html;
 exit;   } if ($result = odbc_Exec($conn, $query)) {print
Query returned :  . odbc_num_rows($result) .  rows;
odbc_result_all($result, border = 1);}?

-and received the following error: Warning: SQL error:
[Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:could not resolve
service name, SQL state 08001 in SQLConnect in c:\php\files\p.php on line
11how can i make this script work perfectly?




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



[PHP-DB] PDF Implementation

2003-07-17 Thread dpgirago


Good Morning All ,

Has anyone successfully implemented PDF functionality within their PHP / MySQL
projects?  My needs are very basic, so I'd like to use something like ezPDF
creation to avoid buying a license. But I haven't yet got ezPDF to work
correctly.  Set up is Win2k, PHP 4.3.2, Apache 1.3.24, MySQL 4.0.13.

Specifics are much appreciated.

Thanks,

David



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



[PHP-DB] osCommerce - which merchant service/payment gateway?

2003-07-17 Thread Becoming Digital
I'm in the midst of a project for which I am using the osCommerce shopping cart
and I'm currently trying to find a merchant service and payment gateway that
will integrate smoothly with it.  I'm currently leaning towards payQuake
(http://www.payquake.com) as their fee structure is quite reasonable, but I'd
like to know what others have used.

I'm sorry for going slightly off-topic, but I'm sure many of you have experience
with this issue.  Every shopping cart *does* use a database, after all, and I'm
sure someone else will find this useful, too.  Thanks a lot.

Edward Dudlik
Becoming Digital
www.becomingdigital.com




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



Re: [PHP-DB] osCommerce - which merchant service/payment gateway?

2003-07-17 Thread mike karthauser
on 17/7/03 3:07 pm, Becoming Digital at [EMAIL PROTECTED] wrote:

 I'm sorry for going slightly off-topic, but I'm sure many of you have
 experience
 with this issue.  Every shopping cart *does* use a database, after all, and
 I'm
 sure someone else will find this useful, too.  Thanks a lot.

http://www.protx.com/ provide a gateway for oscommerce. Its in the
contributions section. Easy to install and the cheapest gateway we;ve seen.

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



Re: [PHP-DB] osCommerce - which merchant service/payment gateway?

2003-07-17 Thread Becoming Digital
Thanks, Mike.  I should have specified that I'm in the States and accordingly
need a US-based gateway.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU



- Original Message -
From: mike karthauser [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, 17 July, 2003 10:11
Subject: Re: [PHP-DB] osCommerce - which merchant service/payment gateway?


on 17/7/03 3:07 pm, Becoming Digital at [EMAIL PROTECTED] wrote:

 I'm sorry for going slightly off-topic, but I'm sure many of you have
 experience
 with this issue.  Every shopping cart *does* use a database, after all, and
 I'm
 sure someone else will find this useful, too.  Thanks a lot.

http://www.protx.com/ provide a gateway for oscommerce. Its in the
contributions section. Easy to install and the cheapest gateway we;ve seen.

--
Mike Karthauser
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


--
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] Re: commas

2003-07-17 Thread Chris Mach
Thanks guys!
number_format() works great!!

Chris Mach [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Is there a function that will strip or add commas?

 I'm trying to do calculations with attendance numbers of football games...
 for example:  33,153

 right now I don't have a comma for the numbers in the database. So the
above
 example is 33153 in my database. If I put the comma in, when I try to do
 calculations with php it sees it as 33 instead of 33,153.

 So is there a way to add that comma afterwards? Perhaps a string function
at
 will put the comma in after the first 3 characters?

 Thanks







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



Re: [PHP-DB] PDF Implementation

2003-07-17 Thread Norma Ramirez - TECNOSOFT
Check out this page:http://www.ros.co.nz/pdf/, is a useful class and you can
implement with any kind of database.
Norma Ramirez
Area de Desarrollo Web
[EMAIL PROTECTED]

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, July 17, 2003 9:01 AM
Subject: [PHP-DB] PDF Implementation




 Good Morning All ,

 Has anyone successfully implemented PDF functionality within their PHP /
MySQL
 projects?  My needs are very basic, so I'd like to use something like
ezPDF
 creation to avoid buying a license. But I haven't yet got ezPDF to work
 correctly.  Set up is Win2k, PHP 4.3.2, Apache 1.3.24, MySQL 4.0.13.

 Specifics are much appreciated.

 Thanks,

 David



 --
 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] PDF Implementation

2003-07-17 Thread Pierre-Alain Joye
On Thu, 17 Jul 2003 09:01:53 -0500
[EMAIL PROTECTED] wrote:

 
 
 Good Morning All ,
 
 Has anyone successfully implemented PDF functionality within their PHP
 / MySQL projects?  My needs are very basic, so I'd like to use
 something like ezPDF creation to avoid buying a license. But I haven't
 yet got ezPDF to work correctly.  Set up is Win2k, PHP 4.3.2, Apache
 1.3.24, MySQL 4.0.13.

A very good pure php PDF generator is FPDF. The scripts section has some
samples using a DB as input.

http://www.fpdf.org/

hth

pierre

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



[PHP-DB] Re: PDF Implementation

2003-07-17 Thread \[PHP-DB\] news.php.net
We have generated PDF files with de FPDF library from data stored in a MYSQL
database.
It's a pure PHP class with basic functionality, so it can be installed
easely in a Hosting.

www.fpdf.org

[EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]


 Good Morning All ,

 Has anyone successfully implemented PDF functionality within their PHP /
MySQL
 projects?  My needs are very basic, so I'd like to use something like
ezPDF
 creation to avoid buying a license. But I haven't yet got ezPDF to work
 correctly.  Set up is Win2k, PHP 4.3.2, Apache 1.3.24, MySQL 4.0.13.

 Specifics are much appreciated.

 Thanks,

 David





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



[PHP-DB] Insert/Update help needed

2003-07-17 Thread Mike Baerwolf
Hello all,

I've been able to get the below to work pretty much. The only problem I 
have is when there is an apostrophe in the data of one of the fields 
like (You're the One).  When this occurs nothing gets updated or 
inserted(tried both).  I've done other things from forms 
inserting/updating with data that contained apostrophes and never had a 
problem.  This is my first attempt at inserting/updating from a string 
match.
Any help would be appreciated.

$grab = preg_match_all(/(([\w]+)[^]*)(.*)(\/\\2)/, $file, $matches);

$a_1 = $matches[3][48];
$a_2 = $matches[3][49];
$a_3 = $matches[3][50];
$sql = UPDATE charts SET artist='$a_1' , song='$a_2' , label='$a_3' 
WHERE charts_id=1 or die(mysql_error());
   if ($result = mysql_query($sql)){

Here is my table structure:
charts_id(tinyint(3),NOT NULL)
artist(varchar(150),NULL)
song(varchar(100),NULL)
label(varchar(75),NULL)
Thanks in advance,
Mike


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


RE: [PHP-DB] Insert/Update help needed

2003-07-17 Thread Hutchins, Richard
Mike,

Pretty sure your solution is to addslashes() around whatever data might
contain the apostrophes.

HTH,
Rich

 -Original Message-
 From: Mike Baerwolf [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 17, 2003 11:33 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Insert/Update help needed
 
 
 Hello all,
 
 I've been able to get the below to work pretty much. The only 
 problem I 
 have is when there is an apostrophe in the data of one of the fields 
 like (You're the One).  When this occurs nothing gets updated or 
 inserted(tried both).  I've done other things from forms 
 inserting/updating with data that contained apostrophes and 
 never had a 
 problem.  This is my first attempt at inserting/updating from 
 a string 
 match.
 Any help would be appreciated.
 
 $grab = preg_match_all(/(([\w]+)[^]*)(.*)(\/\\2)/, 
 $file, $matches);
 
 $a_1 = $matches[3][48];
 $a_2 = $matches[3][49];
 $a_3 = $matches[3][50];
 $sql = UPDATE charts SET artist='$a_1' , song='$a_2' , label='$a_3' 
 WHERE charts_id=1 or die(mysql_error());
 if ($result = mysql_query($sql)){
 
 Here is my table structure:
 charts_id(tinyint(3),NOT NULL)
 artist(varchar(150),NULL)
 song(varchar(100),NULL)
 label(varchar(75),NULL)
 
 Thanks in advance,
 Mike
 
 
 
 -- 
 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] Access 95 ODBC Annoyance

2003-07-17 Thread J. Michael Roberts
I'll be the first to admit this is a rather backwards system and prone to be
illogical, but it's what was handed to me and I can't do much about that.

I've got an ancient Access 95 database that I've linked to via another A95
database which is queried via ODBC. It was done this way because I'm not
allowed to touch the first database due to the insane way they replace the
data each week. (i.e.: any of my tables would be gone, so I need to keep
'my' data safe and link to 'their' data)

While under development, I was working with a copy of the database and got
everything to work fine. In order to go live with the current data, I had
to go into 'my' database and update the linked tables.  When this was done,
my interface failed miserably and returned the following message:

Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft
Jet database engine cannot open the file 'T:\TS\Te_rdata.mdb'. It is already
opened exclusively by another user, or you need permission to view its
data., SQL state S1000 in SQLExecDirect in
C:\Apache2\htdocs\projecthours\deptjobs.php on line 44

Now it gets worse: I need to be able to access the data even if someone has
it open. Read-only access isn't a problem...because that's all this
particular interface does...but I just keep getting denied. Any ideas?

Suffering under a backwards system,
--JMR

PS - Access is a hunk of crap...especially Access 95.



Re: [PHP-DB] Access 95 ODBC Annoyance

2003-07-17 Thread Robert Twitty
If the other application opens the database exclusively, then you will not
be able to open it, even for read only.  The only solution to modify the
sharing option used by the other application.  Another problem you may
encounter is that the ODBC driver for Access is not thread safe.

-- bob

On Thu, 17 Jul 2003, J. Michael Roberts wrote:

 I'll be the first to admit this is a rather backwards system and prone to be
 illogical, but it's what was handed to me and I can't do much about that.

 I've got an ancient Access 95 database that I've linked to via another A95
 database which is queried via ODBC. It was done this way because I'm not
 allowed to touch the first database due to the insane way they replace the
 data each week. (i.e.: any of my tables would be gone, so I need to keep
 'my' data safe and link to 'their' data)

 While under development, I was working with a copy of the database and got
 everything to work fine. In order to go live with the current data, I had
 to go into 'my' database and update the linked tables.  When this was done,
 my interface failed miserably and returned the following message:

 Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft
 Jet database engine cannot open the file 'T:\TS\Te_rdata.mdb'. It is already
 opened exclusively by another user, or you need permission to view its
 data., SQL state S1000 in SQLExecDirect in
 C:\Apache2\htdocs\projecthours\deptjobs.php on line 44

 Now it gets worse: I need to be able to access the data even if someone has
 it open. Read-only access isn't a problem...because that's all this
 particular interface does...but I just keep getting denied. Any ideas?

 Suffering under a backwards system,
 --JMR

 PS - Access is a hunk of crap...especially Access 95.




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



RE: [PHP-DB] Access 95 ODBC Annoyance

2003-07-17 Thread Will Howard
JMR,

The problem might be overcome by instructing the other users to make
certain they do not open the database in exclusive. I no longer have a
copy of Access 95 around, but I seem to recall that we had this problem
when the database was opened by another user who had open exclusive
checked in the dialog box where they selected the database to open. If
you go to the Open dialog box, you may see what I am talking about.

Will Howard

-Original Message-
From: J. Michael Roberts [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 17, 2003 12:32 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Access 95 ODBC Annoyance


I'll be the first to admit this is a rather backwards system and prone
to be illogical, but it's what was handed to me and I can't do much
about that.

I've got an ancient Access 95 database that I've linked to via another
A95 database which is queried via ODBC. It was done this way because I'm
not allowed to touch the first database due to the insane way they
replace the data each week. (i.e.: any of my tables would be gone, so I
need to keep 'my' data safe and link to 'their' data)

While under development, I was working with a copy of the database and
got everything to work fine. In order to go live with the current
data, I had to go into 'my' database and update the linked tables.  When
this was done, my interface failed miserably and returned the following
message:

Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The
Microsoft Jet database engine cannot open the file 'T:\TS\Te_rdata.mdb'.
It is already opened exclusively by another user, or you need permission
to view its data., SQL state S1000 in SQLExecDirect in
C:\Apache2\htdocs\projecthours\deptjobs.php on line 44

Now it gets worse: I need to be able to access the data even if someone
has it open. Read-only access isn't a problem...because that's all this
particular interface does...but I just keep getting denied. Any ideas?

Suffering under a backwards system,
--JMR

PS - Access is a hunk of crap...especially Access 95.



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



Re: [PHP-DB] Access 95 ODBC Annoyance

2003-07-17 Thread J. Michael Roberts
I discovered the problem at had was in the network permissions set on 
the file (?) that was denying Apache to access it properly and the error 
code returned was the best thing the system could come up with.

I changed my Apached service to 'run as' and authorized user (me) and it 
happily viewed the data.

--JMR

J. Michael Roberts wrote:

I'll be the first to admit this is a rather backwards system and prone to
be
illogical, but it's what was handed to me and I can't do much about that.

I've got an ancient Access 95 database that I've linked to via another A95
database which is queried via ODBC. It was done this way because I'm not
allowed to touch the first database due to the insane way they replace the
data each week. (i.e.: any of my tables would be gone, so I need to keep
'my' data safe and link to 'their' data)

While under development, I was working with a copy of the database and got
everything to work fine. In order to go live with the current data, I had
to go into 'my' database and update the linked tables.  When this was done,
my interface failed miserably and returned the following message:

Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft
Jet database engine cannot open the file 'T:\TS\Te_rdata.mdb'. It is
already
opened exclusively by another user, or you need permission to view its
data., SQL state S1000 in SQLExecDirect in
C:\Apache2\htdocs\projecthours\deptjobs.php on line 44

Now it gets worse: I need to be able to access the data even if someone has
it open. Read-only access isn't a problem...because that's all this
particular interface does...but I just keep getting denied. Any ideas?

Suffering under a backwards system,
--JMR

PS - Access is a hunk of crap...especially Access 95.


  





Re: [PHP-DB] Access 95 ODBC Annoyance

2003-07-17 Thread otherguy
If you're deleting or modifying or re-creating any linked tables, that 
might require exclusive access.  Access will automagically put you into 
exclusive mode if you do something like this.

Try closing out as soon as you've updated the DB.

-Cameron Wilhelm

On Thursday, July 17, 2003, at 02:21  PM, Will Howard wrote:

JMR,

The problem might be overcome by instructing the other users to make
certain they do not open the database in exclusive. I no longer have 
a
copy of Access 95 around, but I seem to recall that we had this problem
when the database was opened by another user who had open exclusive
checked in the dialog box where they selected the database to open. If
you go to the Open dialog box, you may see what I am talking about.

Will Howard

-Original Message-
From: J. Michael Roberts [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 17, 2003 12:32 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Access 95 ODBC Annoyance
I'll be the first to admit this is a rather backwards system and prone
to be illogical, but it's what was handed to me and I can't do much
about that.
I've got an ancient Access 95 database that I've linked to via another
A95 database which is queried via ODBC. It was done this way because 
I'm
not allowed to touch the first database due to the insane way they
replace the data each week. (i.e.: any of my tables would be gone, so I
need to keep 'my' data safe and link to 'their' data)

While under development, I was working with a copy of the database and
got everything to work fine. In order to go live with the current
data, I had to go into 'my' database and update the linked tables.  
When
this was done, my interface failed miserably and returned the following
message:

Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The
Microsoft Jet database engine cannot open the file 
'T:\TS\Te_rdata.mdb'.
It is already opened exclusively by another user, or you need 
permission
to view its data., SQL state S1000 in SQLExecDirect in
C:\Apache2\htdocs\projecthours\deptjobs.php on line 44

Now it gets worse: I need to be able to access the data even if someone
has it open. Read-only access isn't a problem...because that's all this
particular interface does...but I just keep getting denied. Any ideas?
Suffering under a backwards system,
--JMR
PS - Access is a hunk of crap...especially Access 95.



--
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] Tricky Database Question

2003-07-17 Thread Sam Richardson
I'm developing an application that is going to deal with information about
different animals, and breeds of those animals.

So far it is quite straight forward, I've created four tables,

[Species] (containing a ID and name)
[Breed] (also containing an ID, Name and relative link to the Species)
[Owner] (ID, basic details about the owner such as name etc)
[Animal] (An ID and a relative link to the owner and breed)

People searching for horses/appoloosa's (species and breed) will be
concerned with how tall they are, however someone who is searching for
information about horses/quarterhorses will not be concerned with it's
height but how fast it can run a quarter mile. The quarter mile may or may
not apply to the appoloosa.

Administrators using the application will have to be able to create
attributes for the breeds on the fly, they will be based on a few various
types of data.

e.g. shorttext (for names, this will be stored as a varchar)
longtext (for descriptions, stored as text)
numeric (stored as an int)
bullet lists
check boxes
drop lists
etc

These attributes will need to be given names and be assigned to breeds. The
end users will fill these out when they add new horses to the database.

My question is: How do I store the data from the attributes? Because each
attribute will need to store it in a different way, do I create a table for
each type of attribute? (Varchar, text, int etc), do I create a table for
each individual attribute (Names, Heights etc) or do I somehow store all the
data in one table (text for all the entries, although I may be storing short
numbers, short descriptions, large amounts of text and abstracted radio
buttons).

The development platform is PHP with either MySQL or Postgres as needed.


--
Sam Richardson - Web Developer, Outwide Limited
DDI: +64 4 381-6841 [EMAIL PROTECTED]
Tel: +64 4 381-6820, Fax: +64 4 381-6821 www.outwide.com
Level 6, 61-63 Taranaki Street, Wellington, New Zealand

Warning: Confidential information may be contained in this message
and any associated attachments. If you are not the intended recipient,
you must not copy, send on or retain this message. Please delete it
and notify the sender by reply email, thank you.



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



Re: [PHP-DB] Tricky Database Question

2003-07-17 Thread Peter Beckman
What about a 5th table which stores metadata:

table metadata:
mdidmediumint unsigned not null auto_increment
table   varchar(15) not null
xid mediumint unsigned not null
name   varchar(25) not null
valvarchar(25) not null

The table will have all the metadata you need for any table you create.

If you want to add a Cell Phone # to an Owner:

   insert into metadata (table,xid,name,val) values
   (Owner, 35, Cell Phone #, 212-555-1212)

Now when you want to see all the metadata for a given owner, let's say you
(Sam) are Owner ID 35.   Just show all the data you are sure almost all
owners will have (home phone, address, email, etc), then do a select from
metadata where table=Owner and xid=35.

Do that for Breed or Species and you have an unlimited but space-conscious
way to store that data.

Peter

On Fri, 18 Jul 2003, Sam Richardson wrote:

 I'm developing an application that is going to deal with information about
 different animals, and breeds of those animals.

 So far it is quite straight forward, I've created four tables,

 [Species] (containing a ID and name)
 [Breed] (also containing an ID, Name and relative link to the Species)
 [Owner] (ID, basic details about the owner such as name etc)
 [Animal] (An ID and a relative link to the owner and breed)

 People searching for horses/appoloosa's (species and breed) will be
 concerned with how tall they are, however someone who is searching for
 information about horses/quarterhorses will not be concerned with it's
 height but how fast it can run a quarter mile. The quarter mile may or may
 not apply to the appoloosa.

 Administrators using the application will have to be able to create
 attributes for the breeds on the fly, they will be based on a few various
 types of data.

 e.g. shorttext (for names, this will be stored as a varchar)
 longtext (for descriptions, stored as text)
 numeric (stored as an int)
 bullet lists
 check boxes
 drop lists
 etc

 These attributes will need to be given names and be assigned to breeds. The
 end users will fill these out when they add new horses to the database.

 My question is: How do I store the data from the attributes? Because each
 attribute will need to store it in a different way, do I create a table for
 each type of attribute? (Varchar, text, int etc), do I create a table for
 each individual attribute (Names, Heights etc) or do I somehow store all the
 data in one table (text for all the entries, although I may be storing short
 numbers, short descriptions, large amounts of text and abstracted radio
 buttons).

 The development platform is PHP with either MySQL or Postgres as needed.


 --
 Sam Richardson - Web Developer, Outwide Limited
 DDI: +64 4 381-6841 [EMAIL PROTECTED]
 Tel: +64 4 381-6820, Fax: +64 4 381-6821 www.outwide.com
 Level 6, 61-63 Taranaki Street, Wellington, New Zealand
 
 Warning: Confidential information may be contained in this message
 and any associated attachments. If you are not the intended recipient,
 you must not copy, send on or retain this message. Please delete it
 and notify the sender by reply email, thank you.
 


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


---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---

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



Re: [PHP-DB] editing part of a field

2003-07-17 Thread JeRRy
Hi,

But won't update update the what I input.  I only need
PART of the post to update, only the selected url area
and want the remaining of the message to be unchanged.
 Won't the update change the whole message?  I think
it does, I only need part of the message to be edited
and that is the URL the text needs to be unchanged.

I have over 9,000 posts to update and fix the image
url for it.  I can't afford to muddle up the posts.

Jerry

From: Jason Wong [EMAIL PROTECTED] 
To: [EMAIL PROTECTED] 
Date: Thu, 17 Jul 2003 13:43:17 +0800 
Subject: Re: [PHP-DB] editing part of a fiedl! 

On Thursday 17 July 2003 12:28, JeRRy wrote:

 So something like this:

 Hi bob img
src=domain.com/emotions/board/laugh.gif
 all is well, cya!

 So old posts have the wrong image location but new
 posts show the correct place to the image as it's
 configured to do it but old posts since they are
 already in the database show up wrong.

 Is there a way to edit _part_ of the post.  To fix
the
 image url.  Is there a mysql query I can use to edit
 where board/emotions with /emotions?

Use an UPDATE query.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet
Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
The little pieces of my life I give to you, with love,
to make a quilt
to keep away the cold.
*/




http://mobile.yahoo.com.au - Yahoo! Mobile
- Check  compose your email via SMS on your Telstra or Vodafone mobile.

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