[PHP] novice: char to varchar

2005-05-18 Thread tony yau
Hi all,

I try to do the following:

CREATE TABLE IF NOT EXISTS Invoice(
  PKey INTEGER,
  Received DATETIME,
  Cost DECIMAL(10,2),
  FileName VARCHAR(50),
  RefNum CHAR(10),

  PRIMARY KEY (PKey)
) TYPE=MyISAM COMMENT='Invoice Data';

but it keep generating  RefNum VARCHAR(10)  instead of CHAR(10)

I don't understand, please help (or point me to RTFM page)
Tony Yau

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



[PHP] Re: novice: char to varchar

2005-05-18 Thread tony yau
found the answer sorry about this

"Tony Yau" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all,
>
> I try to do the following:
>
> CREATE TABLE IF NOT EXISTS Invoice(
>   PKey INTEGER,
>   Received DATETIME,
>   Cost DECIMAL(10,2),
>   FileName VARCHAR(50),
>   RefNum CHAR(10),
>
>   PRIMARY KEY (PKey)
> ) TYPE=MyISAM COMMENT='Invoice Data';
>
> but it keep generating  RefNum VARCHAR(10)  instead of CHAR(10)
>
> I don't understand, please help (or point me to RTFM page)
> Tony Yau

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



Re: [PHP] Re: novice: char to varchar

2005-05-19 Thread tony yau
Hi Kim,

I've found the same article that Philip Hallstrom <[EMAIL PROTECTED]>
had posted

Tony

"Kim Madsen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> -Original Message-
> From: tony yau [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 18, 2005 9:03 PM

> found the answer sorry about this

But You don“t wanna share the solution with the rest of the class?

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/Systemdeveloper

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



[PHP] novice: table design FOREIGN key

2005-05-19 Thread tony yau
Hi All

Thanks for all your comments on my previous mail, very much appreciated.
I'm stuck again!
I've created the following lookup table for m <-> m relationship between
a Group and a Contact table.

CREATE TABLE Group_Contact(
  GroupID INT NOT NULL,
  ContactID INT NOT NULL,

  Index (GroupID),
  FOREIGN KEY (GroupID) REFERENCES Group (PKey) ON DELETE CASCADE,
  Index (ContactID),
  FOREIGN KEY (ContactID) REFERENCES Contact (PKey) ON DELETE CASCADE
) TYPE=InnoDB COMMENT='Group to Contact lookup';

what do I need to do to ensure only unique (GroupID,ContactID) pair can be
inserted into the table?

Thanks
Tony Yau

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



[PHP] novice: how to run .sql script from php?

2005-05-27 Thread tony yau
Hi All,

I got this .sql script that setup the whole db schema, I can run
mysql.exe to run on my pc but when it goes to a hosting company's server I
don't have that command!

So I tried to include("setup.sql") into a string and send that as one
long sql query. BUT I need to get rid of all the comment lines first in the
script!!

can someone give me a better idea of doing this.
(there must be an equivalent php function like
mysql_run_script("setup.sql"))


thanks
-- 
Tony Yau

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



Re: [PHP] novice: how to run .sql script from php?

2005-05-29 Thread tony yau

I realised that there is a fundamental problem with using mysql_query( ...)
to run a .sql script to setup a database, and that was the database needs to
be there in the first place for php to connect to! also there was a lot of
comment lines in the script that was causing problem. ... so I gave up
trying to parse the file.

instead I did this
1) create the database with phpmyadmin etc
2) remove (by hand) all comment lines from the .sql file
and then include the file

ob_start();
include 'installation.sql';
$contents = ob_get_contents();
ob_end_clean();
execQuery($contents);

not very good but does the job.
thanks for all the help

tony yau

"Rory Browne" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I'm assuming that the .sql file consists of a list of MySQL queries,
that when performed sequentially will set up your system.

That being the case, the  perfered way ot install the thing is to do a
'mysql [host/username/password parameters] < file.sql'.

I believe you can also run file.sql scripts using phpMyAdmin.

If you were to define a mysql_run_script() function, it would look a
bit like the following:



Come to think of it, you could turn the above pseudo code into valid
php code, by defining the split_sql_into_individual_sql_queries()
function. This would involve splitting by ';', taking into account the
possibility that ';' may occur in the middle of a string.

Check out the code for phpmyadmin, or phpbb(db backup/recover
feature), for a better idea.

On 5/27/05, tony yau <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I got this .sql script that setup the whole db schema, I can run
> mysql.exe to run on my pc but when it goes to a hosting company's server I
> don't have that command!
>
> So I tried to include("setup.sql") into a string and send that as one
> long sql query. BUT I need to get rid of all the comment lines first in
the
> script!!
>
> can someone give me a better idea of doing this.
> (there must be an equivalent php function like
> mysql_run_script("setup.sql"))
>
>
> thanks
> --
> Tony Yau
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] novice: how to run .sql script from php?

2005-05-30 Thread tony yau
at the depth of execQuery(), an in-house function, it has already selected a
database, (default for the project).
my apologise for saying "problem with using mysql_query( ...)", it was my
misunderstanding of this
in-house function. Now I can run the script with "Create database ..." in
the script.

yes file_get_contents('installation.sql') was much better :)

the problem is that not all the client site will have phpMyAdmin,

now the problem has been reduced to just get rid of all comment/non-sql
fluff and do
execQuery(file_get_contents('installation.sql'))

thanks everyone.


""M. Sokolewicz"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> tony yau wrote:
> > I realised that there is a fundamental problem with using mysql_query(
...)
> > to run a .sql script to setup a database, and that was the database
needs to
> > be there in the first place for php to connect to! also there was a lot
of
> > comment lines in the script that was causing problem. ... so I gave up
> > trying to parse the file.
> >
> > instead I did this
> > 1) create the database with phpmyadmin etc
> > 2) remove (by hand) all comment lines from the .sql file
> > and then include the file
> >
> > ob_start();
> > include 'installation.sql';
> > $contents = ob_get_contents();
> > ob_end_clean();
> this is *very* overTheTop; why not just do:
> $contents = file_get_contents('installation.sql');
> ???
> > execQuery($contents);
> >
> > not very good but does the job.
> > thanks for all the help
> >
> > tony yau
> >
> > "Rory Browne" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > I'm assuming that the .sql file consists of a list of MySQL queries,
> > that when performed sequentially will set up your system.
> >
> > That being the case, the  perfered way ot install the thing is to do a
> > 'mysql [host/username/password parameters] < file.sql'.
> >
> > I believe you can also run file.sql scripts using phpMyAdmin.
> >
> > If you were to define a mysql_run_script() function, it would look a
> > bit like the following:
> >
> >  >
> > function mysql_run_script($file){
> >
> > $sql = file_get_contents($file);
> >
> > $queries = split_sql_into_individual_sql_queries($sql);
> >
> > foreach($queries as $query){
> > mysql_query($query);
> > }
> >
> > }
> >
> > ?>
> >
> > Come to think of it, you could turn the above pseudo code into valid
> > php code, by defining the split_sql_into_individual_sql_queries()
> > function. This would involve splitting by ';', taking into account the
> > possibility that ';' may occur in the middle of a string.
> >
> > Check out the code for phpmyadmin, or phpbb(db backup/recover
> > feature), for a better idea.
> >
> > On 5/27/05, tony yau <[EMAIL PROTECTED]> wrote:
> >
> >>Hi All,
> >>
> >>    I got this .sql script that setup the whole db schema, I can run
> >>mysql.exe to run on my pc but when it goes to a hosting company's server
I
> >>don't have that command!
> >>
> >>So I tried to include("setup.sql") into a string and send that as
one
> >>long sql query. BUT I need to get rid of all the comment lines first in
> >
> > the
> >
> >>script!!
> >>
> >>can someone give me a better idea of doing this.
> >>(there must be an equivalent php function like
> >>mysql_run_script("setup.sql"))
> >>
> >>
> >>thanks
> >>--
> >>Tony Yau
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>

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



[PHP] can't get IIS to run php if the script is not directly under wwwroot

2005-10-17 Thread tony yau
Can someone help please,

in w2k, when i put a test.php directly under wwwroot then it works, when i
try using a virtual directory
it fails/refused to run the script?!

any hint anyone?

-- 
Tony

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



[PHP] Re: can't get IIS to run php if the script is not directly under wwwroot

2005-10-17 Thread tony yau
Hi,

the security for my 'Project' folder (aliases 'phpproject'  where test.php
is under) has

Access Permission:
Read, Script source access, Write, Directory Browsing

Application permission:
Execute(includes scripts)

under window explorer I've allowed Everyone and Internet Guest Account Full
control and both allow inheritable permission from parent. (I'm logged in
with Admin prev)

thanks
Tony

"tony yau" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can someone help please,
>
> in w2k, when i put a test.php directly under wwwroot then it works, when i
> try using a virtual directory
> it fails/refused to run the script?!
>
> any hint anyone?
>
> -- 
> Tony
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP] Re: Re: can't get IIS to run php if the script is not directly under wwwroot

2005-10-17 Thread tony yau

Executable : C:\Apache\Apache2\php501\php5isapi.dll
Extension .php
Verb All
checked Script engine

I've have tried php.exe here but with no joy!
Tony

"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> [snip]
> the security for my 'Project' folder (aliases 'phpproject'  where test.php
> is under) has
>
> Access Permission:
> Read, Script source access, Write, Directory Browsing
>
> Application permission:
> Execute(includes scripts)
>
> under window explorer I've allowed Everyone and Internet Guest Account
Full
> control and both allow inheritable permission from parent. (I'm logged in
> with Admin prev)
> [/snip]
>
> Using Internet Information Services right click on the folder and then
click
> Properties. To the right of the Execute Permissions box click the
> Configuration button. Click on the App Mapping tab and look for the PHP
> extension. If it is not there you did not set up the Virtual Directory
> properly.
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP] Re: Re: Re: can't get IIS to run php if the script is not directly under wwwroot

2005-10-17 Thread tony yau
Hi Jay

thanks for your time.
i installed it as ISAPI

can i ask if you have had IIS5 on win2k professional running php scripts
that is not under the \wwwroot ?
some how i getting to think it can't (?!) be done although it does work for
II6 win2003 server!

Tony

"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> [snip]
> Executable : C:\Apache\Apache2\php501\php5isapi.dll
> Extension .php
> Verb All
> checked Script engine
>
> I've have tried php.exe here but with no joy!
> [/snip]
>
> Did you install PHP as a CGI or ISAPI?
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP] Re: Re: Re: Re: can't get IIS to run php if the script is not directly under wwwroot

2005-10-17 Thread tony yau
THANKS JAY, YOU ARE A SAINT :)

I commented out the doc_root and restart and it came alive :)

Thank you all
Tony

"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> [snip]
> thanks for your time.
> i installed it as ISAPI
>
> can i ask if you have had IIS5 on win2k professional running php scripts
> that is not under the \wwwroot ?
> some how i getting to think it can't (?!) be done although it does work
for
> II6 win2003 server!
> [/snip]
>
> I have IIS5 installed on W2K Pro running PHP scripts in virtual
directories.
> Try commenting the doc_root line in your php.ini and then restarting IIS.
> This has been known to cause some problems with virtuals. Make sure that
> php.ini can be read by everyone.
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP] Re: Re: can't get IIS to run php if the script is not directly under wwwroot

2005-10-18 Thread tony yau
it was the doc_root that was casuing the problem

thanks anyway

"Richard Lynch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Mon, October 17, 2005 6:24 am, tony yau wrote:
> > the security for my 'Project' folder (aliases 'phpproject'  where
> > test.php
> > is under) has
>
> Are there any security settings on the alias itself 'phpproject'?
>
> Is an alias folder the same as a "shortcut" like you make in Windows
> desktop explorer thingie?
>
> Cuz those damn things are useless to anything but Windows Explorer
> itself, as far as I could ever tell...
>
> -- 
> Like Music?
> http://l-i-e.com/artists.htm
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP] sending/notifying a server process

2005-11-11 Thread tony yau
Hi All,

I have a server process that sends fax,print, etc (both in C# and in Java).
Currently it polls says the fax table in the database for any fax jobs.

How can I get my PHP script to call or notify these services directly so not
having to wait for the next poll.
I can't open a socket to the server vai the PHP so what mechanism do I use?

Any hints will be grateful

-- 
Tony Yau

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



[PHP] Re: sending/notifying a server process

2005-11-14 Thread tony yau
Thanks Richard,

the server app was in another box from the database and we thought there may
be security issues behind the router etc.
we have now put the server app in the same box as the database and will use
php UDP to notify the app.

thanks for your help

Tony

"Richard Lynch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Fri, November 11, 2005 4:57 am, tony yau wrote:
> > I have a server process that sends fax,print, etc (both in C# and in
> > Java).
> > Currently it polls says the fax table in the database for any fax
> > jobs.
> >
> > How can I get my PHP script to call or notify these services directly
> > so not
> > having to wait for the next poll.
> > I can't open a socket to the server vai the PHP so what mechanism do I
> > use?
>
> Why can't you open a socket to the server?
> http://php.net/fsockopen
>
> If you really can't do that, then just make it poll more often, I
> guess, so the wait time is insignificant.
>
> -- 
> Like Music?
> http://l-i-e.com/artists.htm
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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