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


Re: [PHP-DB] question on select

2004-05-12 Thread Tony S . Wu
sounds like a job for JavaScript.

Tony S. Wu
[EMAIL PROTECTED]
Look into the right places, you can find some good offerings.
http://homepage.mac.com/tonyswu/stw- The perfect business.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
 
---



On May 12, 2004, at 7:02 AM, hengameh wrote:



Hello,

I am very new to php and mysql so please be patient with me. I don't  
even
know if I am using the right listing, but I hope someone can help me!



I need to create a select and the possible options are from my mysql
database ( so far so good, I was able to find code to do that).
Now I need to use the user selected option to drive the options of me  
next
select.  I need to know how to capture what user selected and how to  
pass
that around? I have used onchange attribute of the select to  
capture the
selected line but now how can I pass that to other php scripts?  ( I  
need to
get the name of the country so that I can show a list of possible
state/province. I setting the value of the newcountry input to the
selected country but when I do echo $newcountry in quicksearch.php,  
its
blank!!)

Please help!!



Thanks so much



Here is what I have so far:



Quicksearch.php file has the following code

br

table class='form'

  tr

thSteps 1-4/th

  /tr



  trtd

form name=fcountry method=post

  ?php  require(country_build.php);?

  input type=text name=newcountry value=



  /form



/td/tr

/table

!-- quicksearch.php   end --



script language=JavaScript

!--

function changeMenu()

  {

  document.fcountry.newcountry.value =
document.fcountry.country.options[document.fcountry.country.selectedInd 
ex].v
alue;

 }

--

/script



Countrty_buil.php has the following



?php

require_once(util.php);



echo SELECT name=\country\ class=\input\   
onchange=\changeMenu()\;

//

// initialize or capture the country variable

$country = !isset($_REQUEST['country'])? Select a country:
$_REQUEST['country'];
$countrySQL = !isset($_REQUEST['country'])? *: $_REQUEST['country'];

echo option value='$countrySQL' SELECTED$country/option;

$query = SELECT country FROM . TABLECOUNTRY .  ORDER BY country  
ASC;

// pconnect, select and query

if ($link_identifier = mysql_pconnect(DBSERVERHOST, DBUSERNAME,  
DBPASSWORD))
{

  if ( mysql_select_db(DBNAME, $link_identifier)) {

// run the query

 $queryResultHandle = mysql_query($query, $link_identifier) or  
die(
mysql_error() );

 $ctrRows = mysql_num_rows($queryResultHandle); // row counter

// if data exists then $rows will be 1 or greater

if( $ctrRows == 0 ) {

  echooption value='*'No data  
found/option/select;

}else{

  // build the select list

  while($row = mysql_fetch_object($queryResultHandle))  
{ //
grab a row

echo option
value=\$row-country\$row-country/option;
  }

  echo /SELECTbrbr;



}

  }else{ // select

echo mysql_error();

  }

}else{ //pconnect

  echo mysql_error();

}

?











[PHP-DB] Using fopen() for internet URL

2003-06-08 Thread Tony S . Wu
I have an auto-update script to gather some information from other web 
pages to update information in my database.
And i use fopen() to open the URL.
as far as i know, the return result contains image, which i don't need.
so is there anyway to disable loading image when using fopen() with URL?
just want to speed things up a bit :P
thanks.

Tony S. Wu
[EMAIL PROTECTED]
The world doesn't give us hope - it gives us chance.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Using fopen() for internet URL

2003-06-08 Thread Tony S . Wu
Thanks, i think i got the description mixed up :D

Tony S. Wu
[EMAIL PROTECTED]
The world doesn't give us hope - it gives us chance.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
On Sunday, June 8, 2003, at 04:29 PM, Tony S. Wu wrote:

I have an auto-update script to gather some information from other web 
pages to update information in my database.
And i use fopen() to open the URL.
as far as i know, the return result contains image, which i don't need.
so is there anyway to disable loading image when using fopen() with 
URL?
just want to speed things up a bit :P
thanks.

Tony S. Wu
[EMAIL PROTECTED]
The world doesn't give us hope - it gives us chance.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
--
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] fopen() question and auto update question

2003-06-08 Thread Tony S . Wu
has any of you have any problem with fopen() that it can't open some 
web page?
i am trying to use it to gather information from other web pages, but i 
am having problem with one particular website, macmall.com.
might anyone know what the problem is?
also, if there is no solution to this, i am going to have to abandon 
the idea by using fopen() to gather information.
can anyone suggest an alternative way, which won't cost me too much 
time to get to it?
there will be around 200 data to be updated each time.
thanks a lot.

Tony S. Wu
[EMAIL PROTECTED]
The world doesn't give us hope - it gives us chance.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Mail() on OS X

2003-06-02 Thread Tony S. Wu
hi all, i am trying to use mail() on Mac OS X 10.2 WITHOUT sendmail.
I have php.ini file in my usr/local/lib directory, with SMTP set to my 
desire smtp server.
But it just doesn't work.
Does anyone here know how to use mail() on OS X?
Thanks a lot.

Tony S. Wu
[EMAIL PROTECTED]
The world doesn't give us hope - it gives us chance.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
Tony S. Wu
[EMAIL PROTECTED]
The world doesn't give us hope - it gives us chance.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] [NB] Mail() question

2003-01-18 Thread Tony S . Wu
I need to send myself an email in one of my PHP page.
So i wrote the following code:

$result = ini_set(SMTP, smtp.earthlink.net);
	
if ($result)
{
	echo ini_get(SMTP);
	$result = mail([EMAIL PROTECTED], test, test123);
	
	if ($result)
		echo mail sent;
}

It always print mail sent, but I never got the email.
So I was wondering if Mail() request any send mail program to work.
Can anyone tell me?
Thanks.

Tony S. Wu
[EMAIL PROTECTED]


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




Re: [PHP-DB] [NB] Mail() question

2003-01-18 Thread Tony S . Wu
EarthLink is my DSL ISP, so its smtp server is not likely to block my 
mail.
Besides, I can send email with my mail program just fine.
I tried the similar thing on a friend's smtp server where I have access 
to the log, weird thing is I didn't even see PHP trying to access the 
smtp server.
I need to figure out why it's not working fast...
Thanks to your help.

Tony S. Wu
[EMAIL PROTECTED]

It takes a smart man to be stupid. ~Tony


On Saturday, January 18, 2003, at 01:47 PM, Micah Stevens wrote:

The mail() function returns true if it functions, i.e. if you have all
the parameters correct, and that sort of thing. If the SMTP server
rejects the email, you'll still get true returned. I ran into this a
while back. Try and do a manual connection to the SMTP server from your
PHP machine and see if it works that way. It may be failing and you
don't know. If you have access to the mail logs, check those out too.

-Micah


On Sat, 2003-01-18 at 12:48, Tony S.Wu wrote:


I need to send myself an email in one of my PHP page.
So i wrote the following code:

$result = ini_set(SMTP, smtp.earthlink.net);
	
if ($result)
{
	echo ini_get(SMTP);
	$result = mail([EMAIL PROTECTED], test, test123);
	
	if ($result)
		echo mail sent;
}

It always print mail sent, but I never got the email.
So I was wondering if Mail() request any send mail program to work.
Can anyone tell me?
Thanks.

Tony S. Wu


[EMAIL PROTECTED]

--
Raincross Technologies
Development and Consulting Services
http://www.raincross-tech.com





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




Re: [PHP-DB] [NB] Mail() question

2003-01-18 Thread Tony S . Wu
EarthLink is my DSL ISP, so its smtp server is not likely to block my 
mail.
Besides, I can send email with my mail program just fine.
I tried the similar thing on a friend's smtp server where I have access 
to the log, weird thing is I didn't even see PHP trying to access the 
smtp server.
I need to figure out why it's not working fast...
Thanks to your help.

Tony S. Wu
[EMAIL PROTECTED]


On Saturday, January 18, 2003, at 01:47 PM, Micah Stevens wrote:

The mail() function returns true if it functions, i.e. if you have all
the parameters correct, and that sort of thing. If the SMTP server
rejects the email, you'll still get true returned. I ran into this a
while back. Try and do a manual connection to the SMTP server from your
PHP machine and see if it works that way. It may be failing and you
don't know. If you have access to the mail logs, check those out too.

-Micah


On Sat, 2003-01-18 at 12:48, Tony S.Wu wrote:


I need to send myself an email in one of my PHP page.
So i wrote the following code:

$result = ini_set(SMTP, smtp.earthlink.net);
	
if ($result)
{
	echo ini_get(SMTP);
	$result = mail([EMAIL PROTECTED], test, test123);
	
	if ($result)
		echo mail sent;
}

It always print mail sent, but I never got the email.
So I was wondering if Mail() request any send mail program to work.
Can anyone tell me?
Thanks.

Tony S. Wu


[EMAIL PROTECTED]

--
Raincross Technologies
Development and Consulting Services
http://www.raincross-tech.com





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




Re: [PHP-DB] [NB] Mail() question

2003-01-18 Thread Tony S . Wu
Ah, that must be it.
I am running a Mac OS X server, which is Darwin based.
Guess I should go with sendmail.
Thanks a lot.

Tony S. Wu
[EMAIL PROTECTED]


On Saturday, January 18, 2003, at 02:27 PM, Jason Wong wrote:


On Sunday 19 January 2003 04:48, Tony S. Wu wrote:

I need to send myself an email in one of my PHP page.
So i wrote the following code:

$result = ini_set(SMTP, smtp.earthlink.net);

if ($result)
{
	echo ini_get(SMTP);
	$result = mail([EMAIL PROTECTED], test, test123);

	if ($result)
		echo mail sent;
}

It always print mail sent, but I never got the email.
So I was wondering if Mail() request any send mail program to work.


Is it a windows server that you're using? SMTP only works for windows.
Anything else uses sendmail or equivalent.

--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
transient bus protocol violation
*/


--
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] Infinite Loop?

2002-11-02 Thread Tony S. Wu
I've seen no way to get out of the while loop.

Tony S. Wu
[EMAIL PROTECTED]

Nope, this world ain't perfect. But at least I know it's not because of
me.


Graeme McLaren at [EMAIL PROTECTED] wrote:

 Greetings list members.  I've written the code below as part of an
 automatic email script.  The problem with this is it seems to run in to
 an infinite loop.  The for loop seems to get completely ignored by
 emails get sent constantly.  I deleted the script after receiving 2500
 emails ! :'( 
 
 Can anyone point out what the problem with this is?
 
 while($tmp = $NowUnix)
 {
 
 for($i=0; $i=2; $i++)
 {
 $sendto = [EMAIL PROTECTED];
 $subject = Test Automatic Email;
 $message = If you get this then age3.php works
 $message = If you get this then age3.php works
 $message = If you get this then age3.php works;
 
 mail($sendto, $subject, $message);
 }
 }
 
 Cheers,
 
 Graeme :)




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




[PHP-DB] Free shopping cart

2002-10-20 Thread Tony S. Wu
I need to write a shopping cart for my friend's website.
I thought modifying a free one for my need would be easier.
Sorry for asking question like this.
But I've done the search on google and all I could find weren't free.
Can anyone provide me some links?
Thanks a lot.

Tony S. Wu
[EMAIL PROTECTED]

Nope, this world ain't perfect. But at least I know it's not because of
me.


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




Re: [PHP-DB] Free shopping cart

2002-10-20 Thread Tony S. Wu
Thanks a lot :D

Tony S. Wu
[EMAIL PROTECTED]

Nope, this world ain't perfect. But at least I know it's not because of
me.


Jason Wong at [EMAIL PROTECTED] wrote:

 On Sunday 20 October 2002 23:17, Tony S. Wu wrote:
 I need to write a shopping cart for my friend's website.
 I thought modifying a free one for my need would be easier.
 Sorry for asking question like this.
 But I've done the search on google and all I could find weren't free.
 Can anyone provide me some links?
 
 Try:
 
 www.zend.com
 freshmeat.net
 sourceforge.net
 
 and even:
 
 www.hotscripts.com




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