Re: [PHP-DB] novice on table design

2005-05-14 Thread Tony S. Wu
actually, no, Shop, Employee, and Customer are not distinct.
in your instance they are the same type of entry.
don't distinguish them by tables, rather use a column to hold some sort 
of an ID for each type.
of course you'll end up with a table with many columns, and many of 
them will be null depending on which type an entry is.
but with this approach, you can easily associate with an address table.

Tony S. Wu
[EMAIL PROTECTED]

On May 14, 2005, at 4:49 AM, tony yau wrote:
Hi Miguel,
Thanks for the reply.
the non-customer is actually a Shop, so Employee, Customer and 
Shop are
distinct enough to have their own tables. Now they all have an 
Address, and
the problem is how do I allow multiple addresses for each these 
'people'
(without using
a lookup table)

tony.
Miguel Guirao [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
The schema of your table is wrong, is you do bnormalize it you will 
find
out
that you need two tables for this approach.
One table for your people and another one for the n addresses of your
people.
If you keep your current schema, you will have as many rows for one 
person
as many addresses for that person you have, and you will be 
duplicating
many
fields. So you must split your tables, one for your people and 
another for
your people's addresses.

-Original Message-
From: tony yau [mailto:[EMAIL PROTECTED]
Sent: Viernes, 13 de Mayo de 2005 09:27 a.m.
To: php-db@lists.php.net
Subject: [PHP-DB] novice on table design

Hi all,
I have the following tables
EmployeeCustomernon-Customer
Address
=======
pkey pkeypkey
pkey
number type type
...
payrate grantcapital
I need to allow the three types of people to have n addresses, so I've
added
a type to distinguish the 3 types of people and their respective pkey 
onto
address table.

Address
=
pkey
...
type(either Employee, Customer or non-Customer etc)
fkey(the pkey of Employee, Customer or non-Customer etc)
I know this design looks awkward but it does have the advantage of 
having
less tables otherwise.
BUT somehow it doesn't feel right. Can someone points me its pros and
cons.
thanks all.
Tony Yau
--
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] Error: Resource id #3

2005-05-14 Thread Marc Henri
Hello,

I'm starting to learn how to manage databases with
MySQL/PHP. The program is very basic but I have a
strange error: Resource id #3.
I read many things on Internet and understood that
others have this error because they are trying to echo
the pointer of the query and not the result itself.
It's not my case so I don't understand.

Thank you very much for your help.

?
/*This program will log on to a users DB to check if
the user is allowed to log in or not.
The program checks the login and password of the user.
*/
$login=;
if (isset($_POST['login'])) {
   $login=$_POST['login'];
   }
if (isset($_POST['password'])) {
   $password=$_POST['password'];
   }

//log to the server
$db=mysql_connect(localhost,root,);
if ($db) {
//test if the connexion works
 $sel=mysql_select_db(test);
 if ($sel) {
$sql_query=SELECT * FROM mytable WHERE
login='$login';
$result=mysql_query($sql_query);
if ($result) {
   //check if there is a result
   echo $result;
   }
//the query didn't work
else echo mysql_error();
}
else echo mysql_error();
}
?







__
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! 
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/

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



Re: [PHP-DB] Error: Resource id #3

2005-05-14 Thread Firan Corneliu
The message that you receive is not an error, it
is a description of the object $result after the 
query is done.

So, you will not get anywhere just by echo $result,
you have to process that information using one
of the mysql_fetch_array(),mysql_fetch_assoc(),
mysql_result().

In your case try : 

...

if ($result) {  

   //check if there is a result
   //echo $result; 
   $row=mysql_fetch_assoc($result);
   
   var_dump($row); // to see the exact structure

   // and you can you the array like
   echo $row[password]; //or what the column name is

}
...

Hope it helps,
capi


On Sat, 2005-05-14 at 12:16 +0200, Marc Henri wrote:
 Hello,
 
 I'm starting to learn how to manage databases with
 MySQL/PHP. The program is very basic but I have a
 strange error: Resource id #3.
 I read many things on Internet and understood that
 others have this error because they are trying to echo
 the pointer of the query and not the result itself.
 It's not my case so I don't understand.
 
 Thank you very much for your help.
 
 ?
 /*This program will log on to a users DB to check if
 the user is allowed to log in or not.
 The program checks the login and password of the user.
 */
 $login=;
 if (isset($_POST['login'])) {
$login=$_POST['login'];
}
 if (isset($_POST['password'])) {
$password=$_POST['password'];
}
 
 //log to the server
 $db=mysql_connect(localhost,root,);
 if ($db) {
 //test if the connexion works
  $sel=mysql_select_db(test);
  if ($sel) {
   $sql_query=SELECT * FROM mytable WHERE
 login='$login';
   $result=mysql_query($sql_query);
   if ($result) {
  //check if there is a result
  echo $result;
  }
   //the query didn't work
   else echo mysql_error();
   }
 else echo mysql_error();
 }
 ?
 
 
 
   
 
   
   
 __
 Dcouvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos 
 mails ! 
 Crez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
 

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



RE: [PHP-DB] Error: Resource id #3

2005-05-14 Thread Marc Henri
Hello,

Thank you very much to Bastien Koert and Firan
Corneliu. You both solved my problem.

Shame on me!






_ 
Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour vos mails, 
photos et vidéos ! 
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com

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



[PHP-DB] Connecting to MS Access DB in PHP, on Linux, Apache

2005-05-14 Thread rob
Anyone got any good websites or resources on how to connect to an access 
database and perform sql querrys etc, in Linux running apache?

or if anyone has the connection strings required
thanks in advance !!
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Connecting to MS Access DB in PHP, on Linux, Apache

2005-05-14 Thread Luis Morales
Sure!!!

Take a look on:

http://www.weberdev.com
http://odbtp.sourceforge.net/

My personal suggest is to use odbtp whith pear DB interface.

Regards,

Luis Morales





rob wrote:

 Anyone got any good websites or resources on how to connect to an
 access database and perform sql querrys etc, in Linux running apache?

 or if anyone has the connection strings required

 thanks in advance !!


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