Re: [PHP-DB] Read file

2003-11-20 Thread Ng Hwee Hwee
hi neil,

this is indeed a very helpful piece of code and advice.. thank you so much!
if this
took you 30 minutes to write, it would have taken me a day to learn XML, and
start writing! this code looks complicated for a young programmer like me
;p.. i'll need time to read up on XML and get back to you again if i have
queries about the codes..

you really helped cut my learning curve in XML and at the same time solve my
client-server problem.. may you be blessed just like how your codes have
blessed me! :o)

thanx lots,
Hwee Hwee


- Original Message -
From: "Neil Smth" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, November 20, 2003 4:02 AM
Subject: Re: [PHP-DB] Read file


> It's usually easier to show with an example : This took about 30 minutes
to
> write :
>
> Here's an XML file - copy and paste, and save as hotels.xml :
>
> 
> 
>  
>  1
>  Bangkok oriental
>  50 High Street, Kowloon
>  +12 451 708 3282
>  
>  
>  2
>  Hilton Marriott
>  2042 Michael Wood Street
>  +44 238 9125467
>  
>  
>  3
>  Swallow Royal
>  91-97 Royal Fort Crescent
>  +01 1209 432 2345
>  
> 
>
> At 10:21 19/11/2003 +, you wrote:
>
> >Hi Neil,
> >
> >thank you so much for your advice! i have not programmed XML before so it
> >will take me a while to learn it.. your suggestion sounds really
fantastic,
> >expecially the part when i don't even have to ask the users to direct me
to
> >the file that i need..
> >
> >my problem, simply put will be:
> >1) user has to enter details in a form
> >2) when user enters HotelCode in one of the fields in the  form,
> >3) javascript must pass the value to PHP to search for the HotelName,
> >HotelAddress, HotelTel etc..
>
> Forget about PHP if you are doing this client side, you only need it to
> process the updated records :
>
>  >5) javascript place those values in the respective fields
> >6) user continues to complete the form
>
> Here is a processing page which will populate the form using the XML data
:
> Save this in the same directory you placed the hotels.xml file; It will
> work in IE5 as is :
>
> 
> 
>  Demo Hotel Loader
> 
>
> 
> 
> 
> 
>
>  method="http://www.my-server.com/myurl.php"; onsubmit="alert('This would
> send these values to your website');return false;">
>  Phone
:
> 
> 
>  wrap="virtual">
> 
> 
> 
>
> 
> 
>
> You then need to write some PHP to accept the new record (you might give
> the ID number from your database as the primary key). Writing out XML from
> PHP works exactly the same as writing out HTML. You just fill in the
blanks
> with your data by running a query and printing out the values between the
> tags, in a loop.
>
> Hope that helps - study the code and see if you can understand how it
works.
> Cheers - Neil.
>
> --
> 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] character problem with mssql

2003-12-03 Thread Ng Hwee Hwee
hi,

i had the same problem a while ago with japanese characters. are you using a
turkish OS or turkish application to insert your data?

for me, what happened was i was given a file from a colleague who was using
japanese OS and japanese version of excel. when he passed me the data, i
opened it in Win2000 english version and edited the data with Excel2000
english version. when i save the file in a .csv format, i think the japanese
characters got corrupted cos when i uploaded the file to PHPMyAdmin, i get
?? instead of my jap characters. but when my colleague tried on his
machine with all the japanese settings, it worked well and good.. once the
data is inside, any one can read it with the characters .. reading has never
been a prob..

to what i experienced, the OS and the application may solve your prob.

hth
hwee


- Original Message -
From: "Gamze Başaran" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 03, 2003 9:38 PM
Subject: [PHP-DB] character problem with mssql


> Hi;
>
> I use php and mssql. I have got a character problem. I must use turkish
> chracters. When I select datas from database it works true and I can see
> turkish characters but when I want to insert new datas to database it set
> wrong character.
>
> For example "Şİ" characetrs look like "?" How can I solve this problem? My
> data type is char 100.
>
> --
> 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] Addslashes

2003-12-03 Thread Ng Hwee Hwee
hi all,

i'm really buffled by what i got and would appreciate any help possible! although i 
addslashes and stripslashes, i still get a backslash ( \ ) character infront of a 
single inverted comma ( ' ) and also whenever an amberscend ( & ) appears... please 
help! thanx thanx..

for example:

in my form (form.php), i have something like that:

">

upon submitting the form, the verification file (verify.php) will be executed, and it 
has lines like that:

 $value)
   $form[$varname] = addslashes(trim(EscapeShellCmd($value)));
?>

... and then i'll check for the validity of field1. if there is an error, the user 
will be redirected back to form.php with the value that the user entered echoed with a 
stripslash.

if there is no error, the whole script runs well, but if the user has to be brought 
back to form.php, it'll print backslashes infront of characters like "(   )  '  &" 
etc..

also, instead of having a blank text field, i have a text field with contents 
retrieved from the database.. the database data does not have the slashes and when the 
first time they appear on the screen, there is no slashes attached too.. the problem 
is always when the user has an error and needs to be brought back to form.php that the 
slashes appear and the number of slashes doubles everytime the user has to be brought 
back to form.php.

i have my magic_quotes_gpc set to ON in my phpinfo() and my version of php is 4.1.2.

thank you soo soo much!!

look forward to your replies.

hwee



Re: [PHP-DB] character problem with mssql

2003-12-04 Thread Ng Hwee Hwee
opps! i didn't read your question properly! i'm so so sorry.. i have not
used mssql before, so many someone out there would be a better help to you..

by the way, your english is okay! i can understand it.. but i'm afraid i
can't be much of a help to you =(


- Original Message -
From: "Gamze Başaran" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
Sent: Thursday, December 04, 2003 3:17 PM
Subject: RE: [PHP-DB] character problem with mssql


> Hi;
> First of all thanks for your concern. No I'm not use an turkish
application.
> I write a program with php,phplib and my database must be mssql. Our
> webserver is linux. (Debian) When I connect to mssql and insert a data I
> haven't got any turkish chracter problem. I select them in my program and
> they seen normal. But when I want to add a record from my program with an
> insert centence it isn't add do database true. My turkish characetrs go to
> bad like ???. I look my sql centence with echo it likes
>
> INSERT INTO (Banks Bank-name, Used_limit) values ('İŞ BANKASI',123456);
>
> But in the database it add like '?? BANKASI'
>
> I hope I can explain my problem with my bad english :))
>
>
>
> -Original Message-
> From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> Sent: 04 Aralık 2003 Perşembe 03:22
> To: Gamze Başaran; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] character problem with mssql
>
>
> hi,
>
> i had the same problem a while ago with japanese characters. are you using
a
> turkish OS or turkish application to insert your data?
>
> for me, what happened was i was given a file from a colleague who was
using
> japanese OS and japanese version of excel. when he passed me the data, i
> opened it in Win2000 english version and edited the data with Excel2000
> english version. when i save the file in a .csv format, i think the
japanese
> characters got corrupted cos when i uploaded the file to PHPMyAdmin, i get
> ?? instead of my jap characters. but when my colleague tried on his
> machine with all the japanese settings, it worked well and good.. once the
> data is inside, any one can read it with the characters .. reading has
never
> been a prob..
>
> to what i experienced, the OS and the application may solve your prob.
>
> hth
> hwee
>
>
> - Original Message -
> From: "Gamze Başaran" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, December 03, 2003 9:38 PM
> Subject: [PHP-DB] character problem with mssql
>
>
> > Hi;
> >
> > I use php and mssql. I have got a character problem. I must use turkish
> > chracters. When I select datas from database it works true and I can see
> > turkish characters but when I want to insert new datas to database it
set
> > wrong character.
> >
> > For example "Şİ" characetrs look like "?" How can I solve this problem?
My
> > data type is char 100.
> >
> > --
> > 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] Re: Addslashes

2003-12-04 Thread Ng Hwee Hwee
hi,

thanx! my magic_quotes_runtime is set to off.

actually, i managed to do a double stripslashes to my form fields eg.
stripslashes(stripslashes($field1)).. this worked well but still if the
input box is a textbox and i have a value that has a double quote ( " ) as
part of it, anything after the double quote gets cut off.. i looked at the
php.net site and tried things like htmlspecialchars and urlendecode but all
to no avail.

will appreciate advice! thanx thanx..

hwee


- Original Message -
From: "Justin Patrin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 04, 2003 2:26 PM
Subject: [PHP-DB] Re: Addslashes


> It's the magic quotes setting. Try setting magic_quote_gpc to off. Also,
> try turning magic_quotes_runtime off.
>
> Ng Hwee Hwee wrote:
>
> > hi all,
> >
> > i'm really buffled by what i got and would appreciate any help possible!
although i addslashes and stripslashes, i still get a backslash ( \ )
character infront of a single inverted comma ( ' ) and also whenever an
amberscend ( & ) appears... please help! thanx thanx..
> >
> > for example:
> >
> > in my form (form.php), i have something like that:
> >
> > ">
> >
> > upon submitting the form, the verification file (verify.php) will be
executed, and it has lines like that:
> >
> >  >   session_register("form");
> >
> >   foreach($_POST as $varname => $value)
> >$form[$varname] = addslashes(trim(EscapeShellCmd($value)));
> > ?>
> >
> > ... and then i'll check for the validity of field1. if there is an
error, the user will be redirected back to form.php with the value that the
user entered echoed with a stripslash.
> >
> > if there is no error, the whole script runs well, but if the user has to
be brought back to form.php, it'll print backslashes infront of characters
like "(   )  '  &" etc..
> >
> > also, instead of having a blank text field, i have a text field with
contents retrieved from the database.. the database data does not have the
slashes and when the first time they appear on the screen, there is no
slashes attached too.. the problem is always when the user has an error and
needs to be brought back to form.php that the slashes appear and the number
of slashes doubles everytime the user has to be brought back to form.php.
> >
> > i have my magic_quotes_gpc set to ON in my phpinfo() and my version of
php is 4.1.2.
> >
> > thank you soo soo much!!
> >
> > look forward to your replies.
> >
> > hwee
> >
> >
>
> --
> 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] Slashes

2003-12-09 Thread Ng Hwee Hwee
hi all,

i need help on my slashes.. i saw php.net say:

"Do not use addslashes() on strings that have already been escaped with 
magic_quotes_gpc as you'll then do double escaping."

with that, i also did not do a stripslashes when i retrieve my data, since my 
magic_quotes_gpc is on.. but why is it that I still get a backslash before an 
occurrence of a single-quote? 

for example,


where $fieldName is retrieved from the database through:

$query = "select fieldName from table where condition ";

$result = mysql_query($query);
  
$fieldName = mysql_result($result,0);  // which is James' Favourite Pet

also, a more serious problem is when i echo the $fieldName into a textbox.

for example:


if $fieldName contains: it's name is "Bob", 
anything after the double quote (i.e. Bob") gets cut-off! it's disaster!!

dear php developers, can you please enlighten me on what happened? and how can I 
rectify the problem? thanx so much!

regards,
hwee


Re: [PHP-DB] Slashes

2003-12-09 Thread Ng Hwee Hwee
Hi John,

thanx!...

HH > but why is it that I still get a backslash
HH > before an occurrence of a single-quote?
HH > for example,
HH > 
HH > where $fieldName is retrieved from the database through:

JH > Maybe magic_quotes_runtime is enabled? It will add slashes to data from
JH > files and databases. Bottom line, if you actually see the slashes in
JH > your data, in your database, then you're adding the slashes twice,
somehow.

yes, i see the slashes in my database through PHPMyAdmin, but my
magic_quotes_runtime is set to OFF. I did not do anything fancy to my data
except cleaning away spaces infront and at the end of the value and doing a
EscapeShellCmd() to my value through:

$value = trim(EscapeShellCmd($fieldName));

and then i do a $query= "insert into table set name='$value'";
i swear i did not add any slashes twice (at least for what i know!!).. is
there another way that i could have addslashes twice without my knowing??

thanx thanx!!

rgds,
hwee

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



Re: [PHP-DB] Slashes

2003-12-09 Thread Ng Hwee Hwee
my my!! you are so right, John!

thank you so much! i thought I was trying to escape those commands like
 but I wasn't aware they were trying to addslashes for me
too!

you are my saviour... thanx so much..

just a quick question.. does it mean, i don't have to worry that my user may
type any commands in my text field that may hurt my system since
magic_quotes_gpc is on?


- Original Message -
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
Cc: "DBList" <[EMAIL PROTECTED]>
Sent: Wednesday, December 10, 2003 12:05 PM
Subject: Re: [PHP-DB] Slashes


> Ng Hwee Hwee wrote:
>
> > $value = trim(EscapeShellCmd($fieldName));
> >
> > and then i do a $query= "insert into table set name='$value'";
> > i swear i did not add any slashes twice (at least for what i know!!)..
is
> > there another way that i could have addslashes twice without my
knowing??
>
> Heh... look at the output of
>
> echo EscapeShellCmd("it's not okay");
>
> Why do you even use EscapeShellCmd? That's the whole purpose of
> magic_quotes_gpc... to escape quotes that'll cause you trouble.
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com
>
> --
> 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] Slashes

2003-12-11 Thread Ng Hwee Hwee
Hi,

can I know when does the magic_quotes_gpc start adding slashes and stripping slashes?

I removed my EscapeShellCmd and my data is inserted and retrieved from the database 
just as i wanted. The problem now comes when I retrieve that data and immediately 
inserted them into another table.. then I get a MySQL error 1064 whenever my value has 
a single-quote in it.

for example,
$query1 = "select * from table where condition";

if(!($result1 = mysql_query($query1)))
  echo SQLError();

$var = mysql_fetch_array($result1);

$query2 = "insert into table2 set col1='".$var["col1"]."', col2='".$var["col2"]."', 
col3='".$var["col3"]."' etc...";

if(!($result2 = mysql_query($query2)))
  echo SQLError();

$query1 works perfectly fine of course.. but $query2 gives me error:
MySQL error: 1064 : You have an error in your SQL syntax near 's Good!', col2 = 'YES', 
' at line 15 (# 256).

the value retrieved from the database is: It's Good! 

what happened?!

thanx..

- Original Message - 

> Ng Hwee Hwee wrote:
> 
> > just a quick question.. does it mean, i don't have to worry that my user may
> > type any commands in my text field that may hurt my system since
> > magic_quotes_gpc is on?
> 
> Heh...of course not. :) All magic_quotes is going to do for you is 
> escape quotes within your text. This will help with database queries but 
> not much else. You still need to be validating your data...
> 
> -- 
> ---John Holmes...


[PHP-DB] Shift_JIS Character Set

2003-12-11 Thread Ng Hwee Hwee
Hi,

i've read the following comment on PHP.net and found it very troubling because my 
database has Shift_JIS japanese words and my forms allow japanese input as well, so, 
does anyone know how can I stripslashes correctly when it comes to Japanese text? 
thanx thanx!

hash at samurai dot fm
01-Dec-2003 10:34 
Might I warn readers that they should be vary careful with the use of stripslashes on 
Japanese text. The shift_jis character set includes a number of two-byte code 
charcters that contain the hex-value 0x5c (backslash) which will get stripped by this 
function thus garbling those characters.

hh



Re: [PHP-DB] Shift_JIS Character Set

2003-12-11 Thread Ng Hwee Hwee
thanks for your reply..

i'm doing a form (form.php)
1) user comes to form.php
2) user enters details and press submit
3) details get passed to form action verify.php
4) verify.php puts all the $_POST into an array $formVars
5) verify.php session_register("formVars")
6) if there is an error, verify.php sends user back to form.php
7) form.php echos all the $formVars (i.e. details that user has previously entered) in 
their respective textfields, together with the error messages

i need to stripslashes at Step7 because as you have mentioned in a previous post on 
this list, magic_quotes_gpc added slashes to all my $_POST. Thus, since I need to echo 
them, I need to stripslashes.. I tried echoing the $formVars without the stripslashes 
and I see all the slashes before the quotes and backslashes etc.. so, by right, with 
English characters, i still need to stripslashes.

please advice. thanx thanx!


- Original Message - 
HH > i've read the following comment on PHP.net and found it very troubling
HH > because my database has Shift_JIS japanese words and my forms allow
HH > japanese input as well, so, does anyone know how can I stripslashes
HH > correctly when it comes to Japanese text? thanx thanx!

JW > Normally you would not need to use stripslashes() anyway. What are you trying 
JW > to do?

HH > hash at samurai dot fm
HH > 01-Dec-2003 10:34
HH > Might I warn readers that they should be vary careful with the use of
HH > stripslashes on Japanese text. The shift_jis character set includes a
HH > number of two-byte code charcters that contain the hex-value 0x5c
HH > (backslash) which will get stripped by this function thus garbling those
HH > characters.


Re: [PHP-DB] Shift_JIS Character Set

2003-12-12 Thread Ng Hwee Hwee
yes, and that's why i'm appealing for help on how to stripslashes when it
comes to the Shift_JIS character set...

will really appreciate advises! thanx lots!


- Original Message -
> OK, if you *know* that the data has been through addslashes() (or
equivalent
> eg magic_quotes_gpc) then doing a strip_slashes() should revert the data
to
> its original form.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *

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



Re: [PHP-DB] Problem with PHP_AUTH_USER

2003-12-15 Thread Ng Hwee Hwee
hi,

i think $PHP_AUTH_USER will only get unset the next time session_start() is
called. try to use a header("location: ...") to direct your logout page to
your index page and then print $PHP_AUTH_USER right after session_start()..
by right, you should not have any value...

i faced the same problem and was puzzled for quite some time, but i think
this works..

hth
hwee

- Original Message -
From: "Constantin Brinzoi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 15, 2003 5:16 PM
Subject: [PHP-DB] Problem with PHP_AUTH_USER


> Hi!
>
> Here is the problem:
>
> How can I unset the $PHP_AUTH_USER when the user clicks "logout"?
>
> The authentication works very well except the log out.
> I tried:
> session_destroy();
> unset($_SERVER['PHP_AUTH_USER'])
>
> and in the next line I did:
>
> print $PHP_AUTH_USER;
>
> and the value is still there.
>
> How can I unregister this variable so that the authentication window
> appears again.
>
> I'm using apache 2.0.40, php 4.2.2 compiled as a module, RedHat Linux
> 9.0. Register globals is On.
>
> TIA
> Constantin Brinzoi.
>
> --
> 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] Search Query

2003-12-17 Thread Ng Hwee Hwee
Dear all,

i need help with my search query statement.. what is wrong with my code?


  $word = split(" ", $keyword);
  $num_words = count($word);
  $word_str = "";
  $criteria = "";

  for ($i=0; $i<$num_words; $i++)
  {
  if ($i)
 $word_str .= "and colName like '%".$word[$i]."%' ";
  else
 $word_str .= "colName like '%".$word[$i]."%' ";
  }

  $word_str .= "and col2 = '$foo' ";

  $criteria .= "$word_str ";
  $table .= "db_table";

  $query = "select * from ".$table." where ".$criteria;


when i try to echo $query, i get ---  select * from where

and so of course MySQL gives me an error 1064 near ' where '

what happened?

thanx thanx!

hwee

Re: [PHP-DB] Search Query

2003-12-18 Thread Ng Hwee Hwee
thanx Mike for your help!!

appreciatively,
hh

- Original Message -
From: "Ford, Mike [LSS]" <[EMAIL PROTECTED]>
To: "'Ng Hwee Hwee'" <[EMAIL PROTECTED]>; "DBList" <[EMAIL PROTECTED]>
Sent: Thursday, December 18, 2003 6:06 PM
Subject: RE: [PHP-DB] Search Query


> On 18 December 2003 05:26, Ng Hwee Hwee wrote:
>
> > Dear all,
> >
> > i need help with my search query statement.. what is wrong
> > with my code?
>
> Nothing obvious that I can see, except a little inefficiency.  Where do
> $keyword and $table come from? -- is this a register_globals issue?
>
>
> > 
> >   $word = split(" ", $keyword);
> >   $num_words = count($word);
> >   $word_str = "";
> >   $criteria = "";
> >
> >   for ($i=0; $i<$num_words; $i++)
> >   {
> >   if ($i)
> >  $word_str .= "and colName like '%".$word[$i]."%' ";
> >  else $word_str .= "colName like '%".$word[$i]."%' ";
> > }
> >   $word_str .= "and col2 = '$foo' ";
> >
> >   $criteria .= "$word_str ";
>
> I'd replace all of the above with:
>
> $criteria = "colName like '%"
>. str_replace(' '
> , "%' and colName like '%"
> , $keyword)
>. "%'"
>. " and col2 = '$foo' "
>
> >   $table .= "db_table";
> >
> >   $query = "select * from ".$table." where ".$criteria; 
> >
> > when i try to echo $query, i get ---  select * from where
> >
> > and so of course MySQL gives me an error 1064 near ' where '
> >
> > what happened?
>
> What's your error_reporting level?  HAve you tried cranking it up to E_ALL
> to see if any relevant warnings are being generated that you're not
> currently seeing?
>
> Cheers!
>
> Mike
>
> -
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
>

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



[PHP-DB] Optimize Table

2004-02-12 Thread Ng Hwee Hwee
Hi all

I read that it is neccessary and good to optimize my DB tables frequently.. I am using 
phpMyAdmin-2.5.4 to maintain my database and the program showed me that my overhead 
for some tables is over 5000. Can i know when would be good for me to optimise my 
tables? For example, once I have an overhead of 1000, I should optimise my tables?

Another of my concern is that, when I optimise tables, I read that my tables will be 
locked. Does it mean that my customers cannot do a select statement on the table? In 
this case, can I schedule phpMyAdmin to optimise the table at a certain time, say 3am 
when there is very little traffic??

Thank you so much!

kind regards,
hwee

[PHP-DB] Update Statement

2004-02-17 Thread Ng Hwee Hwee
hi all,

I would like to do the following:

update Table1, Table2 set Table1.field1 = Table2.field2 where Table1.no = Table2.no

however, i found that multiple updates can only work for MySQL version 4.0.4 but mine 
is 3.23.54... can anyone enlighten me on how I can achieve the same results with this 
older MySQL version? or can PHP 4.2.2 help me in any way?

Thank you so much!

Hwee

Re: [PHP-DB] Update Statement

2004-02-18 Thread Ng Hwee Hwee
hi,

thank you for your reply but I can't do a multiple table update because my
server is using MySQL with version lesser than 4.0... please enlighten me
how I can write the same update statement without using multiple table
update.. is there a way to use JOIN or something??

thanks thanks..

hwee

- Original Message - 
From: "Ricardo Lopes" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
Cc: "PHP DB" <[EMAIL PROTECTED]>
Sent: Wednesday, February 18, 2004 5:41 PM
Subject: Re: [PHP-DB] Update Statement


> you could use:
>
> for ($i=0; $i< max; $i++)
> {
> mysql_query("update Table1, Table2 set Table1.field1 = Table2.field2
> where Table1.no = Table2.no");
> }
>
>
> OR if you use mysqlt daemon (support for transactions, in this case is
best)
>
> mysql_query('BEGIN');
> for ($i=0; $i< max; $i++)
> {
>if (! mysql_query("update Table1, Table2 set Table1.field1 =
> Table2.field2 where Table1.no = Table2.no"))
> {
> mysql_query('ROLLBACK');
> die('ERROR - in query nº: '.$i);
> }
> }
> mysql_query(COMMIT');
>
>
> Execute all or not execute none. I personally use adodb to connect to
> databases and control transactions.
>
> If what you really want is to execute then all in just one function call
to
> the database, i don't know how can you do it with your mysql version.
>
> HTH
>
> - Original Message -
> From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> To: "DBList" <[EMAIL PROTECTED]>
> Sent: Wednesday, February 18, 2004 2:14 AM
> Subject: [PHP-DB] Update Statement
>
>
> hi all,
>
> I would like to do the following:
>
> update Table1, Table2 set Table1.field1 = Table2.field2 where Table1.no =
> Table2.no
>
> however, i found that multiple updates can only work for MySQL version
4.0.4
> but mine is 3.23.54... can anyone enlighten me on how I can achieve the
same
> results with this older MySQL version? or can PHP 4.2.2 help me in any
way?
>
> Thank you so much!
>
> Hwee
>

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



[PHP-DB] MySQL Update and Sort Queries

2004-02-19 Thread Ng Hwee Hwee
hi all,

1) Question on UPDATE

My situation is this: I want to update Table1 with values that can be found in 
Table2.. in short, I would like to do the following:

$query = "update Table1, Table2 set Table1.field1 = Table2.field2 where Table1.no = 
Table2.no";

however, only MySQL 4.0.4 allows multiple updates and mine is 3.23.54... is there a 
way to achieve the same effect in one MySQL statement but WITHOUT using this multiple 
update technique?


2) Question on SORT
-
I would like to retrive my data from the database in the order which I had inserted it 
in.. is there a way to tell MySQL NOT to sort it in a certain way?? apparently, the 
result set i got seem to be sorted according to NAME although I did NOT append my 
query with an "ORDER BY"...  i'm using phpMyAdmin to view my database records and they 
are in the order which I inserted them in.. i would like to see this order too when i 
issue a SELECT on it.. how can I do this?

$query2 = "select * from GUEST where Hotel = 'PPH'";

Thank you so much! I look forward to hearing from you!

Hwee :o)

[PHP-DB] BLOB

2004-03-11 Thread Ng Hwee Hwee
Hi all,

how do i find out if a BLOB field in my table is NULL?

i tried:

SELECT * FROM `MEMBER` WHERE `PASSWD` is NULL

however, although there is one entry in my table that has nothing in my PASSWD field, 
the result set is empty.. how come?

how do i search for entries that has password = [BLOB - 0 bytes] ??

thanx so much!!

huihui

Re: [PHP-DB] BLOB

2004-03-14 Thread Ng Hwee Hwee
hi all..

thank you so much for your help!

i tried out the all the different syntax and the following works perfectly

SELECT * FROM `MEMBER` WHERE `PASSWD` = ""

thanx, amanda!

btw, i was trying to store the encryted password in the database but i do
not want anyone who has the right to see the database (even myself!) to be
able to know the password, so that there is maximum 'security'. That's why i
used the blob field for my password.. hmmm... is this the right way of doing
things?

hwee

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



Re: [PHP-DB] BLOB

2004-03-15 Thread Ng Hwee Hwee
hi all,

I can't use md5 because i want to retrieve it and send emails to my users if
they forgot their password..

md5 is only a one way encryption, thus i have to resort to using
encode('$password', '$salt') where $salt is a value that i have assigned..

because I know the value of $salt, I would be able to decode the password
easily by looking at my database and running decode.

with blob, i can't see the encoded password easily and thus there is
'maximum security'. haha.. but i'm still open to any form of suggestions!

thanx!


- Original Message - 
From: "Marcjon Louwersheimer" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
Sent: Monday, March 15, 2004 4:38 PM
Subject: Re: [PHP-DB] BLOB


> Store the passwords using the md5() function. When inserting the password
> into the database, use md5($password). It will convert the password to a
> encrypted form using one way encryption. When you compare a entered
> password to a password stored in the database, make the password entered
> by the user md5($enteredpassword) and compare it to the raw password from
> the database. Hope that helps!
> -- 
>   Marcjon
>

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



Re: [PHP-DB] BLOB

2004-03-16 Thread Ng Hwee Hwee
hi,

i've read the blob document in MySQL manual and i know it is similar to a
text field and can store large amount of binary data..however, in phpMyAdmin
2.5.4,  i can't see the contents of my blob fields... how do you view it?

sorry for my ignorance..

hwee

- Original Message - 
From: "JeRRy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 16, 2004 1:27 PM
Subject: Re: [PHP-DB] BLOB
>
> Whoa, watch what your saying here because your well
> off the ball here.  For everyone else who is not aware
> BLOB is zilch security.  The details in a BLOB field
> is viewable easy enough.  Please read about BLOB on
> the mysql website that I listed to you, read it very
> carefully, obviously you did not even read a line of
> it.  Because the first few paragraphs tells you what
> it is, similar to a text field if you read it.  Please
> read links people send to you, otherwise why should we
> bother wasting our time replying if you can't take the
> courtesy to read what we type?

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



[PHP-DB] Rounding

2004-04-07 Thread Ng Hwee Hwee
Hi all,

is there a way to do rounding up to the nearest tenth? can't use ROUND() cos i need 
something like this:

6.11 --> 6.2
6.15 --> 6.2
6.19 --> 6.2
6.20 --> 6.2

i know there is a ceil() function but that rounds up to the nearest integer.. i need 
one decimal place still..

I tried adding a 0.05 to all the numbers and then use round() on them but,

round(6.11+0.05) --> 6.2
round(6.15+0.05) --> 6.2
round(6.19+0.05) --> 6.2
round(6.20+0.05) --> 6.3 (WRONG ANSWER!!)

does anyone have any suggestions for me? please help me!

many thanks,
Hwee

Re: [PHP-DB] Rounding

2004-04-07 Thread Ng Hwee Hwee
whoa! thanks so much! you guys are smart! hahaha..

i just love this list and all the helpful souls out there!

:o)

- Original Message - 
From: "Larry E. Ullman" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
Cc: "DBList" <[EMAIL PROTECTED]>
Sent: Thursday, April 08, 2004 10:06 AM
Subject: Re: [PHP-DB] Rounding


> > 6.11 --> 6.2
> > 6.15 --> 6.2
> > 6.19 --> 6.2
> > 6.20 --> 6.2
> >
> > i know there is a ceil() function but that rounds up to the nearest 
> > integer.. i need one decimal place still..
> 
> If my math is right, you could multiply the number by ten, take the 
> CEILING(), then divide that by 10.
> 
> Larry
> 
> -- 
> 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] Edit with notepad

2004-05-12 Thread Ng Hwee Hwee
Hi all

thanx for the suggestions! yah, now i give my customers 2 buttons that will
direct them to 2 functionalities.

however, I still have a problem!! =(

i'm using 2 headers:
 header("Content-type: application/vnd-ms.word");
 header("Content-Disposition: attachment; filename=agent.doc");

why is it that the core of my .doc file is still in html?? i mean, i pulled
the file agent.doc into Notepad and I see html codes being generated. This
is very bad for me because my file has some graphics in it. If the core of
my file is html, the graphics will be a link instead of being embedded into
my documents. As a result, whoever tries to save that page will not be able
to see the graphics, unless they save the graphics into their computer with
the exact folder directory too! Please help me.

thank you!!

regards,
hwee

- Original Message - 
From: "Neil Smith [MVP, Digital media]" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 12, 2004 1:45 AM
Subject: Re: [PHP-DB] Edit with notepad


> Just offer them a link to the next page. Put &format=word in as the
> query string if they choose the 'view word document' link or no query
> string if they choose the plain text view as html page. Then go for
>
> if ($_GET["format"]=='word') {
>  header("Content-type: application/vnd-ms.word");
> }
>
> Really, offering your customers what they want is what we're all about -
> you have to take some responsibility for implementing snippets of code
like
> this ;-)
>
> Cheers - Neil
>
> At 10:39 11/05/2004 +, you wrote:
> >Message-ID: <[EMAIL PROTECTED]>
> >From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> >To: "DBList" <[EMAIL PROTECTED]>
> >Date: Tue, 11 May 2004 09:25:08 +0800
> >MIME-Version: 1.0
> >Content-Type: text/plain;
> > charset="iso-8859-1"
> >Content-Transfer-Encoding: 7bit
> >Subject: Re: [PHP-DB] Edit with notepad
> >
> >hi,
> >
> >header("Content-type: application/vnd-ms.word"); is not what my customers
> >want. They may or may not want to save it in their harddisk.. but having
the
> >header at the beginning of my page will force them to save it in their
> >harddisk. Some of the customers just want to view it on the web while
others
> >want to view it in Word and possibly edit it and then save it.. how can i
> >achieve such flexibility for them?
> >
> >thank you!!
> >
> >regards,
> >hwee

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



Re: [PHP-DB] Edit with notepad

2004-05-10 Thread Ng Hwee Hwee
hi,

header("Content-type: application/vnd-ms.word"); is not what my customers
want. They may or may not want to save it in their harddisk.. but having the
header at the beginning of my page will force them to save it in their
harddisk. Some of the customers just want to view it on the web while others
want to view it in Word and possibly edit it and then save it.. how can i
achieve such flexibility for them?

thank you!!

regards,
hwee

- Original Message - 
From: "Neil Smith [MVP, Digital media]" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, May 11, 2004 2:25 AM
Subject: [PHP-DB] Re: Subject: Edit with notepad


> Send before any content, an MS-Word header :
>
> header("Content-type: application/vnd-ms.word");
>
> Then output your HTML.
> Cheers - Neil.
>
>
> At 07:41 10/05/2004 +0000, you wrote:
>
> >Message-ID: <[EMAIL PROTECTED]>
> >From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> >To: "DBList" <[EMAIL PROTECTED]>
> >Date: Mon, 10 May 2004 15:40:27 +0800
> >MIME-Version: 1.0
> >Content-Type: multipart/alternative;
> >boundary="=_NextPart_000_00D2_01C436A5.1E3B4100"
> >Subject: Edit with notepad
> >
> >Hi
> >
> >My customers would like to save my php outputs in a word document file
and
> >so I have added a meta tag 
in
> >my php files. However, my File->Edit button in IE6 is greyed out. why? i
> >see that other php files on other websites allow Edit, why is it that my
> >programs don't allow it??
> >
> >thanx for any insights!!
> >
> >regards,
> >Hwee Hwee

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



[PHP-DB] Edit with notepad

2004-05-10 Thread Ng Hwee Hwee
Hi

My customers would like to save my php outputs in a word document file and so I have 
added a meta tag  in my php files. 
However, my File->Edit button in IE6 is greyed out. why? i see that other php files on 
other websites allow Edit, why is it that my programs don't allow it??

thanx for any insights!!

regards,
Hwee Hwee

Re: [PHP-DB] Re: Edit with notepad

2004-05-10 Thread Ng Hwee Hwee
thanx for the suggestion... it did work for a while! that's very
interesting... but, what happened now is that my file is a form that post to
itself... i can do an edit when it is the form, but after the user submits
the form and the information is displayed again without any form fields, the
"Edit" button is greyed out again.. why?? since it's goes to $PHP_SELF, why
does it behave differently although it's the same file??

i have added session_cache_limiter("private") at the very beginning of my
file, before session_start()..

thanx thanx again!!

- Original Message - 
From: "Uzi Klein" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 10, 2004 4:45 PM
Subject: [PHP-DB] Re: Edit with notepad


> Try to set session.cache_limiter to "private"
>
> "Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> My customers would like to save my php outputs in a word document file and
so I have added a meta tag  CONTENT="word.document"> in my php files. However, my File->Edit button in
IE6 is greyed out. why? i see that other php files on
> other websites allow Edit, why is it that my programs don't allow it??
>
> thanx for any insights!!
>
> regards,
> Hwee Hwee
>
> -- 
> 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] Session

2004-04-26 Thread Ng Hwee Hwee
Hi,

I have a problem with my session variables. I set them using for e.g., 
$_SESSION["user"]=$name;

However, because of weak network links, somehow my $_SESSION variables get unset. Is 
there a way to still keep the session variables even though the network is unstable?? 
i.e. as long as my browser is open, is there a way to still store my session 
variables? by the way, i'm not referring to the session ids, I'm referring to the 
variables that i wanted to session_register().

Thank you.

Regards,
Hwee

Re: [PHP-DB] Session

2004-04-27 Thread Ng Hwee Hwee
thanx Wendell for your suggestion.

apparently i tried using cookies, but my cookies also get deleted after my
session is "disconnected". (?!?!)
i did not set an expiry date to my cookies because i need them to be deleted
when the user closes his browser.
what could i have done wrong??

- Original Message - 
From: "Wendell Frohwein" <[EMAIL PROTECTED]>
To: "'Ng Hwee Hwee'" <[EMAIL PROTECTED]>
Sent: Tuesday, April 27, 2004 3:00 PM
Subject: RE: [PHP-DB] Session


> Im sure you can store the session ID in a cookie. Then this will save
> all your variables.
>
>
> I hope this helps.
>
>
> Wendell
>
>
>
> -Original Message-
> From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 26, 2004 11:46 PM
> To: DBList
> Subject: [PHP-DB] Session
>
> Hi,
>
> I have a problem with my session variables. I set them using for e.g.,
> $_SESSION["user"]=$name;
>
> However, because of weak network links, somehow my $_SESSION variables
> get unset. Is there a way to still keep the session variables even
> though the network is unstable?? i.e. as long as my browser is open, is
> there a way to still store my session variables? by the way, i'm not
> referring to the session ids, I'm referring to the variables that i
> wanted to session_register().
>
> Thank you.
>
> Regards,
> Hwee
>
>

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



Re: [PHP-DB] Session

2004-04-27 Thread Ng Hwee Hwee
thanx Mike,

i'm sure i have session_start() on all my pages. Why I'm so confident is
because my session gets unset occassionally and not everytime. i cannot find
a pattern and so it is not a consistent problem.. it's so unpredictable!
what could be the problem??

- Original Message - 
From: "Mikael Grön" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, April 27, 2004 3:54 PM
Subject: Re: [PHP-DB] Session


> Session objects has nothing to do with weak network connections.
> If your sessions gets un-set, it's most probably because you forgot the
>
> session_start();
>
> command in the beginning of some file that is using sessions. Without
> that line, no sessions will be neither stored nor read.
>
> Mike
>
>
> On Apr 27, 2004, at 07:46, Ng Hwee Hwee wrote:
>
> > Hi,
> >
> > I have a problem with my session variables. I set them using for e.g.,
> > $_SESSION["user"]=$name;
> >
> > However, because of weak network links, somehow my $_SESSION variables
> > get unset. Is there a way to still keep the session variables even
> > though the network is unstable?? i.e. as long as my browser is open,
> > is there a way to still store my session variables? by the way, i'm
> > not referring to the session ids, I'm referring to the variables that
> > i wanted to session_register().
> >
> > Thank you.
> >
> > Regards,
> > Hwee
>
> -- 
> 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] Session

2004-04-27 Thread Ng Hwee Hwee
Hi Torsten,

That is a wonderful insight!!! :o) thanxxx!

okie, my 'session.gc_maxlifetime' = 1440 and session.gc_probability = 1.

so, should I change it to something like 43,200 (12hours*60mins*60sec)?? for example, 
one person works a maximun of 12 hours a day. But does it mean that by lengthening 
this value, the session will still be kept even if the user closes his browser?? 

Please advice!

looking forward to solving this!!

many thanks,
Hwee


- Original Message - 
From: "Torsten Roehr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 27, 2004 6:07 PM
Subject: Re: [PHP-DB] Session


> "Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > thanx Mike,
> >
> > i'm sure i have session_start() on all my pages. Why I'm so confident is
> > because my session gets unset occassionally and not everytime. i cannot
> find
> > a pattern and so it is not a consistent problem.. it's so unpredictable!
> > what could be the problem??
> 
> Take alook at this option:
> 
> ini_set('session.gc_maxlifetime', 3600); // 3600 seconds
> 
> If you don't set it the standard value is 1440 seconds, then your session
> data is deleted based on the garbage probablility. Take a look here:
> 
> http://de3.php.net/session
> 
> Look out for "session.gc_maxlifetime" and "session.gc_probability".
> 
> Regards, Torsten
> 
> 
> >
> > - Original Message -
> > From: "Mikael Grön" <[EMAIL PROTECTED]>
> > To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Sent: Tuesday, April 27, 2004 3:54 PM
> > Subject: Re: [PHP-DB] Session
> >
> >
> > > Session objects has nothing to do with weak network connections.
> > > If your sessions gets un-set, it's most probably because you forgot the
> > >
> > > session_start();
> > >
> > > command in the beginning of some file that is using sessions. Without
> > > that line, no sessions will be neither stored nor read.
> > >
> > > Mike
> > >
> > >
> > > On Apr 27, 2004, at 07:46, Ng Hwee Hwee wrote:
> > >
> > > > Hi,
> > > >
> > > > I have a problem with my session variables. I set them using for e.g.,
> > > > $_SESSION["user"]=$name;
> > > >
> > > > However, because of weak network links, somehow my $_SESSION variables
> > > > get unset. Is there a way to still keep the session variables even
> > > > though the network is unstable?? i.e. as long as my browser is open,
> > > > is there a way to still store my session variables? by the way, i'm
> > > > not referring to the session ids, I'm referring to the variables that
> > > > i wanted to session_register().
> > > >
> > > > Thank you.
> > > >
> > > > Regards,
> > > > Hwee


Re: [PHP-DB] Session

2004-04-27 Thread Ng Hwee Hwee
Hi Torsten,

Thank you! Thank you!

just would like to clarify what do you mean by

>The session life time itself is not critical - the life time of the session
> DATA is. Which means you should unset all session data after the desired
> period of time.

does it mean that if I set 'session.gc_maxlifetime' = 43200 and then make
sure my user logoff, where my logoff script unset all the sessions, then I'm
on a safe track? I'm designing an intranet, so I can instruct my staff to
logoff and not just close the browser. Will this be okay? I'm not familar
with PEAR yet, but surely would like to learn more about it in future!!

look forward to your reply!

thanks again,
Hwee

- Original Message - 
From: "Torsten Roehr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 27, 2004 6:48 PM
Subject: Re: [PHP-DB] Session


> Hi Hwee,
>
> of course you could set it to 43200 seonds if you want. The
> session.gc_probability value should stay 1 which means that the session
data
> is deleted with a probability of 1 percent.
>
> The session life time itself is not critical - the life time of the
session
> DATA is. Which means you should unset all session data after the desired
> period of time. Maybe it's easier for you to use a ready-made package like
> PEAR::Auth or PEAR::LiveUser:
>
> http://pear.php.net/package/Auth
> http://pear.php.net/package/LiveUser
>
>
> Hope this helps,
>
> Regards, Torsten
>
>
> >>>
> "Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> Hi Torsten,
>
> That is a wonderful insight!!! :o) thanxxx!
>
> okie, my 'session.gc_maxlifetime' = 1440 and session.gc_probability = 1.
>
> so, should I change it to something like 43,200 (12hours*60mins*60sec)??
for
> example, one person works a maximun of 12 hours a day. But does it mean
that
> by lengthening this value, the session will still be kept even if the user
> closes his browser??
>
> Please advice!
>
> looking forward to solving this!!
>
> many thanks,
> Hwee
>
>
> - Original Message -
> From: "Torsten Roehr" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, April 27, 2004 6:07 PM
> Subject: Re: [PHP-DB] Session
>
>
> > "Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > thanx Mike,
> > >
> > > i'm sure i have session_start() on all my pages. Why I'm so confident
is
> > > because my session gets unset occassionally and not everytime. i
cannot
> > find
> > > a pattern and so it is not a consistent problem.. it's so
unpredictable!
> > > what could be the problem??
> >
> > Take alook at this option:
> >
> > ini_set('session.gc_maxlifetime', 3600); // 3600 seconds
> >
> > If you don't set it the standard value is 1440 seconds, then your
session
> > data is deleted based on the garbage probablility. Take a look here:
> >
> > http://de3.php.net/session
> >
> > Look out for "session.gc_maxlifetime" and "session.gc_probability".
> >
> > Regards, Torsten
> >
> >
> > >
> > > - Original Message -
> > > From: "Mikael Grön" <[EMAIL PROTECTED]>
> > > To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > > Sent: Tuesday, April 27, 2004 3:54 PM
> > > Subject: Re: [PHP-DB] Session
> > >
> > >
> > > > Session objects has nothing to do with weak network connections.
> > > > If your sessions gets un-set, it's most probably because you forgot
> the
> > > >
> > > > session_start();
> > > >
> > > > command in the beginning of some file that is using sessions.
Without
> > > > that line, no sessions will be neither stored nor read.
> > > >
> > > > Mike
> > > >
> > > >
> > > > On Apr 27, 2004, at 07:46, Ng Hwee Hwee wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I have a problem with my session variables. I set them using for
> e.g.,
> > > > > $_SESSION["user"]=$name;
> > > > >
> > > > > However, because of weak network links, somehow my $_SESSION
> variables
> > > > > get unset. Is there a way to still keep the session variables even
> > > > > though the network is unstable?? i.e. as long as my browser is
open,
> > > > > is there a way to still store my session variables? by the way,
i'm
> > > > > not referring to the session ids, I'm referring to the variables
> that
> > > > > i wanted to session_register().
> > > > >
> > > > > Thank you.
> > > > >
> > > > > Regards,
> > > > > Hwee
>
> -- 
> 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] Optimize Tables

2004-05-03 Thread Ng Hwee Hwee
Hi,

Is there a way to create a schedule to optimise my MySQL tables automatically? The 
overhead of some of my tables can reach 355,548 bytes over 3 working days!

Please help me!

Thanks.
Hwee

Re: [PHP-DB] Optimize Tables

2004-05-03 Thread Ng Hwee Hwee
sorry, what do you mean by _cron_  job?

I'm hoping to optimise my tables, for example on, every Monday 9.30am.

by the way, is there a problem if I optimise my tables too frequently? i
mean, i was told not to defragment or format my harddisk too often cos it
will cause wear and tear to the hardware.. does this apply to optimisation
of tables? will this be bad for my server then?

thank you so much.

- Original Message - 
From: "Dynamix" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>; "DBList" <[EMAIL PROTECTED]>
Sent: Monday, May 03, 2004 4:29 PM
Subject: Re: [PHP-DB] Optimize Tables


> yep, check http://www.phpclasses.org/browse/package/1527.html
>
> And you can run this using a cron job, so it just fit with your needs.
>
> Regards,
> Hatem
>
> - Original Message - 
> From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> To: "DBList" <[EMAIL PROTECTED]>
> Sent: Monday, May 03, 2004 11:19 AM
> Subject: [PHP-DB] Optimize Tables
>
>
> Hi,
>
> Is there a way to create a schedule to optimise my MySQL tables
> automatically? The overhead of some of my tables can reach 355,548 bytes
> over 3 working days!
>
> Please help me!
>
> Thanks.
> Hwee
>
> -- 
> 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] Optimize Tables

2004-05-03 Thread Ng Hwee Hwee
Thanx for this enlightening insight about cron jobs...

just a question.. when i run Optimize.php, i realise that you will echo some
statements. where will these statements be shown? since you put  " >
/dev/null "  instead of  " > /dev/null 2>&1 ", does it mean that your echo
statements will be reflected in an email to me?

thanx.. i'm totally new to cron jobs, but thanx to sebastian's link on
crontab, i'm a little bit more knowledgable now! haha.. would appreciate
more insights! thanx!


- Original Message ----- 
From: "Uzi Klein" <[EMAIL PROTECTED]>
To: "'Ng Hwee Hwee'" <[EMAIL PROTECTED]>; "'DBList'" <[EMAIL PROTECTED]>
Sent: Monday, May 03, 2004 6:32 PM
Subject: RE: [PHP-DB] Optimize Tables


> Use a cron job
>
> Like:
>
> 0   0   *   *   *   php Optimize.php > /dev/null
>
>
> This is an example for optimizing every table in all databases on your
mysql
> server.
>
> Optimize.php :
>
>  $db = mysql_connect("host", "user", "pass");
> $sql = "SHOW DATABASES";
> $dbs_result = mysql_query($sql, $db);
> if(mysql_num_rows($dbs_result))
> {
> while($dbs_row=mysql_fetch_assoc($dbs_result))
> {
> $database =  $dbs_row["Database"];
> echo "\n\nOptimizing database $database : \n";
> mysql_select_db($database, $db);
> $sql = "SHOW TABLE STATUS";
> $tbls_result = mysql_query($sql, $db);
> if(mysql_num_rows($tbls_result))
> {
> while($tbls_row=mysql_fetch_assoc($tbls_result))
> {
> $TableName = "`".$tbls_row["Name"]."`";
> $sql = "REPAIR TABLE ".$TableName;
> echo "\n".$sql;
> mysql_query($sql, $db);
> $sql = "OPTIMIZE TABLE ".$TableName;
> echo "\n".$sql;
> mysql_query($sql, $db);
> }
> }
> }
> }
> echo "\n\n";
> mysql_close($db);
> ?>
>
>
> -Original Message-
> From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 03, 2004 11:19
> To: DBList
> Subject: [PHP-DB] Optimize Tables
>
> Hi,
>
> Is there a way to create a schedule to optimise my MySQL tables
> automatically? The overhead of some of my tables can reach 355,548 bytes
> over 3 working days!
>
> Please help me!
>
> Thanks.
> Hwee
>
>

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



[PHP-DB] Version Upgrade

2004-05-20 Thread Ng Hwee Hwee
Hi all,

I'm running on PHP 4.2.2 and MySQL 3.23.54

I would like to do an upgrade... What would be the highest version number that I can 
upgrade to without causing any possible conflict?

I'm thinking of upgrading to PHP 4.2.3 and MySQL 4.0.4 because they have some features 
that I need.

But I will like to be more adventurous so will PHP 4.2.3 and MySQL 4.1 be advisable?

Many thanks,
Hwee Hwee

Re: [PHP-DB] Version Upgrade

2004-05-20 Thread Ng Hwee Hwee
hi all,

Sorry, I meant to say PHP 4.3. Will it be very different from PHP4.2.2 that
my programs may perform strangely if I upgrade to PHP4.3?

many thanks,
Hwee

- Original Message - 
From: "Gary Every" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
Sent: Thursday, May 20, 2004 9:23 PM
Subject: RE: [PHP-DB] Version Upgrade


> MySQL 4.0.19 is the latest stable release, and PHP 4.2.3 will work well
> for you. MySQL 4.1 is still in beta.
>
>
> Gary Every
> Sr. UNIX Administrator
> Ingram Entertainment Inc.
> 2 Ingram Blvd, La Vergne, TN 37089
> "Pay It Forward!"
>
> -Original Message-
> From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 20, 2004 5:15 AM
> To: DBList
> Subject: [PHP-DB] Version Upgrade
>
> Hi all,
>
> I'm running on PHP 4.2.2 and MySQL 3.23.54
>
> I would like to do an upgrade... What would be the highest version
> number that I can upgrade to without causing any possible conflict?
>
> I'm thinking of upgrading to PHP 4.2.3 and MySQL 4.0.4 because they have
> some features that I need.
>
> But I will like to be more adventurous so will PHP 4.2.3 and MySQL 4.1
> be advisable?
>
> Many thanks,
> Hwee Hwee

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



[PHP-DB] $_Session vs $_Cookie

2004-05-31 Thread Ng Hwee Hwee
Hi all,

I have a problem:  my $_SESSION variables and $_COOKIE variables get
destroyed very often, even though my clients are actively browsing the site
(that means, the variables should not be garbage collected).

Our guess is that the network connections are weak. My server is in
Singapore but my clients are connecting to it from Japan, Thailand,
Australia (some on dial-up) etc... Apparently, their connections get dropped
pretty frequently. Thus, their $_SESSION variables and $_COOKIE variables
get destroyed everytime their connections are dropped.

Has anyone experienced such phenomenon before? is our guess accurate? if it
is, does it mean that the best solution would be to change all our $_SESSION
variables to $_COOKIE and set an expiry date to the cookies to 12 hours
later or something..

fyi, i'm using PHP4.2.2 and my session.gc_maxlifetime = 1440 and
session.gc_probability = 1. I will be upgrading to 4.3.6 in the near future.

thanks in advance!

hwee

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



Re: [PHP-DB] Re: Multi search function (help)

2004-05-31 Thread Ng Hwee Hwee
hi.. your should just use if (empty($foo)) statements.. i did my search
scripts like that too and they were wonderful!

PS: besides $query, all the $variables are being posted from a form...

$query = "select * from myTable where ";

$query .= (!empty($typeS))   ? "Column1  ='$typeS'
and " : "";
$query .= (!empty($salesmnS))  ? "Column2  ='$salesmnS'
and " : "";
$query .= (!empty($agtCdS))? "Column3  like '$agtCdS%'
and " : "";
$query .= (!empty($tourNmS))  ? "Column4  like '%$tourNmS%'  and " :
"";
$query .= (!empty($dtFromS))   ? "Column5 >=  '$dtFromS' and
" : "";
$query .= (!empty($dtToS))   ? "Column6 <=  '$dtToS'
and " : "";

$query .= " T01Br = '$branch' ";

$query .= " group by T01RefNo order by T01InDt desc";

a few things to note: you should be careful with the "and".. a trick is to
place a compulsory search field at the end of the query. you should also be
careful to give _spaces_ " " ... hth

 Original message -
> > > >> Nabil wrote:
> > > >>
> > > >> >  hi all
> > > >> >
> > > >> > Is there a way to condition your search:
> > > >> >
> > > >> > -I have a form for four text boxes for search my Mysql...
> > > >> > -I don't want to write 4 conditions and for SQL statements
> > > >> > incase he decided not to search with all keywords (fields)
> > > >> > - I have by example : name, lastname , nickname and phone
> > > >> >form...  I need a way to select my records even one or more field
were
> > > >> > null (searching only on of the above)
> > > >> >
> > > >> > because the following SQL will generate null result
> > > >> >
> > > >> >
> > > >> > $name=$_POST['naame'];
> > > >> > $lastname=$_POST['lastname'];
> > > >> > $nickname=$_POST['nickname'];
> > > >> > $m_date=$_POST['m_dateY'];
> > > >> > echo $name.$lastname.$nickname.$m_date;
> > > >> >
> > > >> > "SELECT id, name , lastname , m_date from users
> > > >> > where
> > > >> > name like binary '%$name%' and lastname like binary
> '%$lastname%' and
> > > >> > nickname like binary  '%$nickname%' and m_date= YEAR('$m_date')
> > > >> > order by id ASC ") or die(mysql_error());
> > > >> >
> > > >> > Thanks in advanced

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



Re: [PHP-DB] Re: $_Session vs $_Cookie

2004-05-31 Thread Ng Hwee Hwee
hi..

the situation is like this: my clients' $_SESSION gets destroyed even after
only a few seconds of inactivity! so, with my current setting for
gc_maxlifetime (1440), it should be more than enough to have their sessions
registered for the few minutes, right? thus, i deduce that the solution may
not lie in my gc_maxlifetime value?? please correct me if I'm wrong!

thanx thanx!

- Original Message - 
From: "Torsten Roehr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 31, 2004 5:33 PM
Subject: [PHP-DB] Re: $_Session vs $_Cookie


> "Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi all,
> > fyi, i'm using PHP4.2.2 and my session.gc_maxlifetime = 1440 and
> > session.gc_probability = 1. I will be upgrading to 4.3.6 in the near
> future.
>
> Your gc_maxlifetime setting is set to 1440 seconds which means 24 minutes.
> So every 24 minutes the garbage collection is checked if it should be
> deleted (based on gc_probability). Try increasing your gc_maxlifetime to a
> higher value, e.g. 43200 for 12 hours.
>
> Regards, Torsten

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



Re: [PHP-DB] Re: $_Session vs $_Cookie

2004-05-31 Thread Ng Hwee Hwee
i do not really experience this problem.. i can click through the links
easily.. hmm.. your question sets me thinking.. do you think it has to do
with some VPN thing? my system is an intranet system and the users log on to
it through a VPN.. do you think it will cut my sessions?!

by the way, I saw this note on php.net under the gc_maxlifetime section:

Note: If you are using the default file-based session handler, your
filesystem must keep track of access times (atime). Windows FAT does not so
you will have to come up with another way to handle garbage collecting your
session if you are stuck with a FAT filesystem or any other fs where atime
tracking is not available. Since PHP 4.2.3 it has used mtime (modified date)
instead of atime. So, you won't have problems with filesystems where atime
tracking is not available.

do you think by upgrading it will solve all my problems?!

thanx a million!!

- Original Message - 
From: "Torsten Roehr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 31, 2004 6:19 PM
Subject: Re: [PHP-DB] Re: $_Session vs $_Cookie


> "Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > hi..
> >
> > the situation is like this: my clients' $_SESSION gets destroyed even
> after
> > only a few seconds of inactivity! so, with my current setting for
> > gc_maxlifetime (1440), it should be more than enough to have their
> sessions
> > registered for the few minutes, right? thus, i deduce that the solution
> may
> > not lie in my gc_maxlifetime value?? please correct me if I'm wrong!
>
> You're right, the session should at least be active for the specified
> gc_maxlifetime - no matter if the users click a link or not. So even if
the
> user clicks only once to start the session and then clicks again after 20
> minutes the session should still be valid. If it's not I guess there is
> something wrong on your server because the session should be alive even if
> the user is not requesting any pages. Do all users have this problem and
do
> you have it yourself?
>
> Torsten

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



Re: [PHP-DB] Re: $_Session vs $_Cookie

2004-05-31 Thread Ng Hwee Hwee
Hi Sukanto,

I'm glad I'm not alone. :o) I'm working on an intranet, thus i can ask my
staff to enable their cookies.. but this is really not the best way.

Right now, I am trying to convert all my sessions to cookies because this is
a faster solution to solve my urgent problem. But I think as recommended by
Torsten and the others, maybe we should use the database to save our
sessions.. I do not have time to explore the PEAR packages but they look
like a good long-term solution.

By the way, do you use VPN?

Hwee

- Original Message - 
From: "Sukanto Kho" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
Sent: Tuesday, June 01, 2004 9:31 AM
Subject: Re: [PHP-DB] Re: $_Session vs $_Cookie


> Hi Hwee,
>
> I experience such problem too.. I'm hosting my web at spore.
>
> Sometimes not all the time ...my session just deleted from web server...
>
> I also guest that its a weak network that cause such problem.
>
> Otherwise I dont get any ideas.
>
> So whats ur solution then?? u change all session to cookie (I prefer not
to
> use cookie)
>
> >From Flame Xie xi Chuan
>
> - Original Message -
> From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> To: "DBList" <[EMAIL PROTECTED]>
> Sent: Monday, May 31, 2004 5:10 PM
> Subject: Re: [PHP-DB] Re: $_Session vs $_Cookie
>
>
> > hi..
> >
> > the situation is like this: my clients' $_SESSION gets destroyed even
> after
> > only a few seconds of inactivity! so, with my current setting for
> > gc_maxlifetime (1440), it should be more than enough to have their
> sessions
> > registered for the few minutes, right? thus, i deduce that the solution
> may
> > not lie in my gc_maxlifetime value?? please correct me if I'm wrong!
> >
> > thanx thanx!

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



Re: [PHP-DB] Dropdown menus from DB query

2004-06-17 Thread Ng Hwee Hwee
hmm... what about something like this??

echo ";

$query = "select code, name from table";

$result = mysql_query($query);

while($array = mysql_fetch_array($result))
{
echo "".$array["name"]."";
}

echo "";

hth

- Original Message - 
From: "Cole Ashcraft" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 18, 2004 7:50 AM
Subject: [PHP-DB] Dropdown menus from DB query


> How would you create a drop down menu from a database query? I have
> figured how to do it with one field, but how could it be done with a
> system where the value is different than the displayed value (ie.
> numerical code as the value, name displayed)?
>
> Thanks,
> Cole

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



Re: [PHP-DB] Dropdown menus from DB query

2004-06-17 Thread Ng Hwee Hwee
sorry, these codes are not tested... yes, i missed a quotation mark on the
first echo statement.

it should read:

echo "";

but i guess you can figure it out from these.. good luck! :o)

- Original Message - 
From: "Cole Ashcraft" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 18, 2004 9:23 AM
Subject: Re: [PHP-DB] Dropdown menus from DB query


> Thanks. I think I can work from this. Just to let you know, it generates
> a parse error ( I think its because of the quotes).
>
> Cole
>
> On Thu, 2004-06-17 at 18:09, Ng Hwee Hwee wrote:
> > hmm... what about something like this??
> >
> > echo ";
> >
> > $query = "select code, name from table";
> >
> > $result = mysql_query($query);
> >
> > while($array = mysql_fetch_array($result))
> > {
> > echo "".$array["name"]."";
> > }
> >
> > echo "";
> >
> > hth
> >
> > - Original Message - 
> > From: "Cole Ashcraft" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, June 18, 2004 7:50 AM
> > Subject: [PHP-DB] Dropdown menus from DB query
> >
> >
> > > How would you create a drop down menu from a database query? I have
> > > figured how to do it with one field, but how could it be done with a
> > > system where the value is different than the displayed value (ie.
> > > numerical code as the value, name displayed)?
> > >
> > > Thanks,
> > > Cole
> >
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is believed to be clean.
>
> -- 
> 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] Regular Expression

2004-08-04 Thread Ng Hwee Hwee
Hi all,

I somehow just couldn't get my regular expression syntax correct. Will you please help 
me?

some examples of my valid string is:
sinx0401-001-45
hkgx0403-020-12
jktx0402-000-01
bkkx0407-013-44

the definition is:
1st 4 characters   - can only be "sinx" or "hkgx" or "bkkx" or "jktx"
next 4 characters - numbers 0 to 9
next 1 character   - a dash "-"
next 3 characters - numbers 0 to 9
next 1 character   - a dash "-"
last 2 characters  - numbers 0 to 9

my problem is how can i make sure the first 4 characters are either "sinx" or "hkgx" 
or "bkkx" or "jktx"?
I've tried:

eregi("[(sinx)|(hkgx)|(bkkx)|(jktx)][0-9]{4}\-[0-9]{3}\-[0-9]{2}$", $string)

but this condition returns a TRUE if the 4th character in the string is "x"!
that means, if my $string = "0408-001-54", this condition returns me with TRUE!

i also tried the following but they didn't give me the correct results:

eregi("^[(sinx)|(hkgx)|(bkkx)|(jktx)]{4}[0-9]{4}\-[0-9]{3}\-[0-9]{2}$", $string)

eregi("[(sinx)|(hkgx)|(bkkx)|(jktx)]{4}[0-9]{4}\-[0-9]{3}\-[0-9]{2}$", $string)

eregi("(sinx)|(hkgx)|(bkkx)|(jktx)[0-9]{4}\-[0-9]{3}\-[0-9]{2}$", $string)

eregi("^(sinx)|(hkgx)|(bkkx)|(jktx)[0-9]{4}\-[0-9]{3}\-[0-9]{2}$", $string)

does anyone have any suggestions?

Thank you!

Hwee

Re: [PHP-DB] Regular Expression

2004-08-04 Thread Ng Hwee Hwee
thanx!!! it worked like a charm! =)

just a question, i've tried adding a ^ to the front of your expressions and
a $ to the end of your expression and it still worked.. but is it
recommended? why didn't you use them?

^(sin|hkg|bkk|jkt)x[0-9]{4}-[0-9]{3}-[0-9]{2}$

hwee

- Original Message - 
From: "John Holmes" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
Cc: "PHP DB List" <[EMAIL PROTECTED]>
Sent: Thursday, August 05, 2004 10:22 AM
Subject: Re: [PHP-DB] Regular Expression


> Ng Hwee Hwee wrote:
>
> > Hi all,
> >
> > I somehow just couldn't get my regular expression syntax correct. Will
you please help me?
> >
> > some examples of my valid string is:
> > sinx0401-001-45
> > hkgx0403-020-12
> > jktx0402-000-01
> > bkkx0407-013-44
> >
> > the definition is:
> > 1st 4 characters   - can only be "sinx" or "hkgx" or "bkkx" or "jktx"
> > next 4 characters - numbers 0 to 9
> > next 1 character   - a dash "-"
> > next 3 characters - numbers 0 to 9
> > next 1 character   - a dash "-"
> > last 2 characters  - numbers 0 to 9
>
> (sin|hkg|bkk|jkt)x[0-9]{4}-[0-9]{3}-[0-9]{2}
>
> -- 
>
> John Holmes

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



Re: [PHP-DB] Regular Expression

2004-08-04 Thread Ng Hwee Hwee
thanx a million!! you really saved my day!! :o)

hwee

- Original Message - 
From: "John Holmes" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
Cc: "PHP DB List" <[EMAIL PROTECTED]>
Sent: Thursday, August 05, 2004 11:05 AM
Subject: Re: [PHP-DB] Regular Expression


> Ng Hwee Hwee wrote:
>  >>(sin|hkg|bkk|jkt)x[0-9]{4}-[0-9]{3}-[0-9]{2}
>  >
> > thanx!!! it worked like a charm! =)
> >
> > just a question, i've tried adding a ^ to the front of your expressions
and
> > a $ to the end of your expression and it still worked.. but is it
> > recommended? why didn't you use them?
> >
> > ^(sin|hkg|bkk|jkt)x[0-9]{4}-[0-9]{3}-[0-9]{2}$
>
> Yeah, you should use them to ensure that the text is _only_ that code
> and not just contains it. Otherwise "asdf sinx1234-123-12 asdf" will
> pass. I just forgot. :)
>
> -- 
>
> John Holmes
>
> php|architect - The magazine for PHP professionals -
http://www.phparch.com
>

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



Re: [PHP-DB] Php if statement in a form

2004-08-05 Thread Ng Hwee Hwee
what about this?

if(empty($row["timeout"]))


- Original Message - 
From: "Doug Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 06, 2004 10:18 AM
Subject: Re: [PHP-DB] Php if statement in a form


> if (is_null($row["timeout"]).)
> 
> [EMAIL PROTECTED] wrote:
> > Still no joy. The parse error actually refers to the --  if
> > ($row["timeout"] IS NULL); --- line.
> > 
> > 
> > -Original Message-
> > From: Eric Schwartz [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, 6 August 2004 11:32 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] Php if statement in a form
> > 
> > 
> > Sorry.  Forgot to remove the word echo from that line.
> > 
> > On Thu, 5 Aug 2004 21:29:01 -0400, Eric Schwartz
> > <[EMAIL PROTECTED]> wrote:
> > 
> >>On Fri, 6 Aug 2004 10:21:19 +1000, [EMAIL PROTECTED]
> >><[EMAIL PROTECTED]> wrote:
> >>
> >>>Thanks Eric,
> >>>
> >>>I have changed it somewhat but am just getting a parse error,
> >>>unexpected T_STRING on that line.
> >>>
> >>>My revised code is below:
> >>>
> >>>
> >>>print "Current Staff Working Alone";
> >>>print "";
> >>>print "\n";
> >>>print "\n";
> >>>print
> >>>
> > 
> > "NameLocationTime
> > 
> >>>inTime Out/tr>";
> >>>while ($row = mysql_fetch_array($result, MYSQL_BOTH))
> >>>{
> >>>print "";
> >>>print "";
> >>>print "";
> >>>print $row["name"];
> >>>print "";
> >>>print $row["location"];
> >>>print "";
> >>>print $row["timein"];
> >>>print "";
> >>>if ($row["timeout"] IS NULL);
> >>>{
> >>>print ;
> > 
> >>>} else {
> >>>print $row["timeout"];
> >>>}
> >>>print "\n";
> >>>}
> >>>print "\n";
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>-Original Message-
> >>>From: Eric Schwartz [mailto:[EMAIL PROTECTED]
> >>>Sent: Friday, 6 August 2004 9:31 AM
> >>>To: [EMAIL PROTECTED]
> >>>Subject: Re: [PHP-DB] Php if statement in a form
> >>>
> >>>On Fri, 6 Aug 2004 08:53:53 +1000, [EMAIL PROTECTED]
> >>><[EMAIL PROTECTED]> wrote:
> >>>
> Hello, I wonder if someone could point me in the right direction
> > 
> > here.
> > 
> I have a table that is displayed that is also a form, and allowed
> > 
> > a
> > 
> person to select a record to update using a radio button. With one
> > 
> > of
> > 
> the fields of the form/table however, I would like it to display
> > 
> > the
> > 
> value in the db (if there is one). If there is no value then I
> > 
> > want
> > 
> >>>the
> >>>
> field to display the current time and then submit it to the db as
> > 
> > a
> > 
> variable.
> 
> I can get it to display the current time and submit it to the db,
> > 
> > but
> > 
> >>>I
> >>>
> don't know how to do the IF bit of the form/table.
> 
> Anyway, the code is below.
> Thanks
> 
>  $dbcnx = @mysql_connect( "localhost", "user", "password");
> mysql_select_db("movements");
> $result = mysql_query("SELECT id, name, location, timein, timeout
> > 
> > FROM
> > 
> workalone WHERE date=CURRENT_DATE()") or die (mysql_error());
> // Display the results of the query in a table
> print "Current Staff Working Alone";
> //below is the table/form with the id, name, location, timein and
> timeout taken from the db
> print " > 
> > cellspacing=\"0\">\n";
> > 
> print
> 
> > 
> > "NameLocationTime
> > 
> inTime Out/tr>";
> while ($row = mysql_fetch_array($result, MYSQL_BOTH))
> {
> print "";
> print "";
> print "";
> print $row["name"];
> print "";
> print $row["location"];
> print "";
> print $row["timein"];
> print "";
> //below is the IF thing I am having problems with
> ?>"> print "\n";
> }
> print "\n";
> 
> ?>
> if ($submit2)
> {
> $dbcnx = @mysql_connect( "localhost", "user", "password");
> mysql_select_db("movements");
> $result = mysql_query("UPDATE workalone SET timeout='$timeout'
> > 
> > WHERE
> > 
> id='$id'") or die (mysql_error());
> echo "Thank you, your Time Out has been recorded.";
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> >>>
> >>>You seem to have your php tags not around your if statement and you
> >>>are checking to see if $timeout rather than $row["timeout"] has a
> >>>value.  I also think the proper way to check for NULL is to say IS
> >>>NULL or NOT NULL, not $foo = NULL.  Could be wrong about that one.
> >>>
> >>> >>>if ($row["timeout"] IS NULL) {
> >>> echo date('H:i');
> >>>} else {
> >>>print $row["timeout"];
> >>>}
> >>>?>
> >>>
> >>>--
> >>>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
> >>>
> >>>
> >>
> >>Try a

Re: [PHP-DB] Php if statement in a form

2004-08-05 Thread Ng Hwee Hwee
try this??

if($row['timeout']=="")
{
echo "";
}else{
print $row["timeout"];
}

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 06, 2004 10:50 AM
Subject: RE: [PHP-DB] Php if statement in a form


> Well, this works: so you were all on the right track
> 
> if($row['timeout']=="")
> {
> print "";
> }else{
> print $row["timeout"];
> }
> 
> But now I get a parse error on the  line
> 
> 
> -Original Message-
> From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED] 
> Sent: Friday, 6 August 2004 12:30 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Php if statement in a form
> 
> 
> what about this?
> 
> if(empty($row["timeout"]))
> 
> 
> - Original Message - 
> From: "Doug Thompson" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Friday, August 06, 2004 10:18 AM
> Subject: Re: [PHP-DB] Php if statement in a form
> 
> 
> > if (is_null($row["timeout"]).)
> > 
> > [EMAIL PROTECTED] wrote:
> > > Still no joy. The parse error actually refers to the --  if
> > > ($row["timeout"] IS NULL); --- line.
> > > 
> > >
> 
> -- 
> 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] Deleting older records

2004-08-12 Thread Ng Hwee Hwee
what was the error??

- Original Message - 
From: "Dylan Barber" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 13, 2004 1:08 PM
Subject: [PHP-DB] Deleting older records


> I have a tracking database but I only need things in it for about an hour
>
> I tried this
>
> DELETE * FROM `tblDownloadTrack` WHERE `timestamp` < TIME_TO_SEC( NOW( ) )
>
>
>
> but it gives me an error anybody help me out on this?
>
> MySQL 4.0.16
>
>
> Dylan Barber
>
>
>
 gnatures/www.codegalaxy.com> www.codegalaxy.com - A webservices company
>
> DotNetNuke Portal  Specialists
>
> Simple Affordable & Reliable - Web Design, and Programming
>
>
>

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



Re: [PHP-DB] Deleting older records

2004-08-12 Thread Ng Hwee Hwee
try

DELETE FROM `tblDownloadTrack` WHERE `timestamp` <  TIME_TO_SEC( NOW( ) )

- Original Message - 
From: "Dylan Barber" <[EMAIL PROTECTED]>
To: "'Ng Hwee Hwee'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, August 13, 2004 1:17 PM
Subject: RE: [PHP-DB] Deleting older records


> 1064 - You have an error in your SQL syntax.  Check the manual that
> corresponds to your MySQL server version for the right syntax to use near
'*
> FROM  `tblDownloadTrack`  WHERE  `timestamp`  < TIME_TO_SEC(
>
>
> Dylan Barber
>
> www.codegalaxy.com - A webservices company
>
> DotNetNuke Portal  Specialists
>
> Simple Affordable & Reliable - Web Design, and Programming
>
>
>
> > -Original Message-
> > From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> > Sent: Friday, August 13, 2004 12:15 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] Deleting older records
> >
> > what was the error??
> >
> > - Original Message -
> > From: "Dylan Barber" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, August 13, 2004 1:08 PM
> > Subject: [PHP-DB] Deleting older records
> >
> >
> > > I have a tracking database but I only need things in it for
> > about an hour
> > >
> > > I tried this
> > >
> > > DELETE * FROM `tblDownloadTrack` WHERE `timestamp` <
> > TIME_TO_SEC( NOW( ) )
> > >
> > >
> > >
> > > but it gives me an error anybody help me out on this?
> > >
> > > MySQL 4.0.16
> > >
> > >
> > > Dylan Barber
> > >
> > >
> > >
> >  > a/Microsoft/Si
> > > gnatures/www.codegalaxy.com> www.codegalaxy.com - A
> > webservices company
> > >
> > > DotNetNuke Portal  Specialists
> > >
> > > Simple Affordable & Reliable - Web Design, and Programming
> > >
> > >
> > >
> >
> > -- 
> > 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



Re: [PHP-DB] Deleting older records

2004-08-12 Thread Ng Hwee Hwee
wat about using php mktime() (codes below not tested)??

$time = date("YmdHis", mktime(date("H")-1, date("i"), date("s"), date("m"),
date("d"), date("Y")));

$query = "DELETE FROM `tblDownloadTrack` WHERE `timestamp` < '$time'";

mysql_query($query);


- Original Message - 
From: "Dylan Barber" <[EMAIL PROTECTED]>
To: "'Ng Hwee Hwee'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, August 13, 2004 1:32 PM
Subject: RE: [PHP-DB] Deleting older records


> Okay closer but the query doesn't seem to return anything
>
> Query
>
> DELETE FROM `tblDownloadTrack` WHERE TIME_TO_SEC(`timestamp`) <
> TIME_TO_SEC( NOW( ) )-60
>
> Is this even the right track for something like this?
>
> Dylan Barber
>
> www.codegalaxy.com - A webservices company
>
> DotNetNuke Portal  Specialists
>
> Simple Affordable & Reliable - Web Design, and Programming
>
>
>
> > -Original Message-
> > From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> > Sent: Friday, August 13, 2004 12:23 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] Deleting older records
> >
> > try
> >
> > DELETE FROM `tblDownloadTrack` WHERE `timestamp` <
> > TIME_TO_SEC( NOW( ) )
> >
> > - Original Message -
> > From: "Dylan Barber" <[EMAIL PROTECTED]>
> > To: "'Ng Hwee Hwee'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Sent: Friday, August 13, 2004 1:17 PM
> > Subject: RE: [PHP-DB] Deleting older records
> >
> >
> > > 1064 - You have an error in your SQL syntax.  Check the manual that
> > > corresponds to your MySQL server version for the right
> > syntax to use near
> > '*
> > > FROM  `tblDownloadTrack`  WHERE  `timestamp`  < TIME_TO_SEC(
> > >
> > >
> > > Dylan Barber
> > >
> > > www.codegalaxy.com - A webservices company
> > >
> > > DotNetNuke Portal  Specialists
> > >
> > > Simple Affordable & Reliable - Web Design, and Programming
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> > > > Sent: Friday, August 13, 2004 12:15 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: [PHP-DB] Deleting older records
> > > >
> > > > what was the error??
> > > >
> > > > - Original Message -
> > > > From: "Dylan Barber" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Friday, August 13, 2004 1:08 PM
> > > > Subject: [PHP-DB] Deleting older records
> > > >
> > > >
> > > > > I have a tracking database but I only need things in it for
> > > > about an hour
> > > > >
> > > > > I tried this
> > > > >
> > > > > DELETE * FROM `tblDownloadTrack` WHERE `timestamp` <
> > > > TIME_TO_SEC( NOW( ) )
> > > > >
> > > > >
> > > > >
> > > > > but it gives me an error anybody help me out on this?
> > > > >
> > > > > MySQL 4.0.16
> > > > >
> > > > >
> > > > > Dylan Barber
> > > > >
> > > > >
> > > > >
> > > >  > > > a/Microsoft/Si
> > > > > gnatures/www.codegalaxy.com> www.codegalaxy.com - A
> > > > webservices company
> > > > >
> > > > > DotNetNuke Portal  Specialists
> > > > >
> > > > > Simple Affordable & Reliable - Web Design, and Programming
> > > > >
> > > > >
> > > > >
> > > >
> > > > -- 
> > > > 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 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] Date Conversion

2004-08-18 Thread Ng Hwee Hwee
Hi all,

can someone kindly point me to a resource that converts all kinds of possible date 
inputs into MySQL format of -MM-DD?

example of formats to be converted includes:

d/m/yy
d/m/
d/mm/yy
d/mm/yyy
dd/mm/yy
dd/mm/yyy
d/mmm/yy
d/mmm/
dd/mmm/yy
dd/mmm/

yy   - 2 digit representation of year
   - ful numeric representation of year
m   - numeric representation of month, without leading zero
mm- numeric representation of month, with leading zero
mmm - short textual representation of month   
d   - day of month without leading zero
dd - day of month with leadin zero

thanx!

hwee

Re: [PHP-DB] Webpage response to selection & $_POST

2004-08-30 Thread Ng Hwee Hwee
hi...

to what i know, the $_POST variables get passed to apage.php only... if you
have a redirect to another page inside apage.php, the $_POST variables will
not be passed to the next page. you may need to register your $_POST as
session variables inside apage.php first or you append your $_POST variables
to your redirect string...

e.g. header('location: nextpage.php?var='$_POST) or something like that...

- Original Message - 
> On Mon, 2004-08-30 at 11:02 -0500, Philip Thompson wrote:
> > Ok, quick question. Does the $_POST variable transfer the information
> > to all the pages? or just the page called in that  > action="apage.php">? Because in my code I call a certain page, but then
> > that page merely redirects to another page, depending what selection
> > was made.


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



Re: [PHP-DB] Clicking on the Picture

2004-08-30 Thread Ng Hwee Hwee
what about this??


   


- Original Message - 
From: "Feroz" <[EMAIL PROTECTED]>
To: "Php-Db" <[EMAIL PROTECTED]>
Sent: Tuesday, August 31, 2004 11:07 AM
Subject: [PHP-DB] Clicking on the Picture


> Hi,
> 
> I have a Diagram that I need to upload to web page.
> The diagram contains 3 pictures but as one diagram.
> 
> Now is it possible to code the pictures in the diagram so its clickable,
> that is when picture one is clicked then it opens a new page.
> 
> Regards,
> Feroz
> -
> IT Developer / Systems
> Maxumise (Fiji) Limited
> Level 4, FNPF Place
> Suva,
> Fiji Islands.
> Tel : (679) 330 3137
> Mobile : (679) 995 4250
> 
> ~~
> This communication contains information which is confidential
> and may also be privileged. It is for the exclusive use of the intended
> recipient(s). If you are not the intended recipient(s), please note
> that any distribution, copying or use of this communication or the
> information in it is strictly prohibited. If you have received this
> communication in error, please notify the sender immediately
> and then destroy any copies of it.
> ~

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



[PHP-DB] Print

2004-09-09 Thread Ng Hwee Hwee
Hi,

I have a pressing problem with regards to printing.

My situation is as follows:
1) I have a form in a table format with the following headers:
| No. | Date | Contents | Remarks |
2) the fields under "Contents" and "Remarks" are textareas to allow users to type as 
much as they want.
3) after submitting the form, user will click on a button that will activate 
window.print() to print the form
4) however, sometimes user types too much and the information spills over to two or 
more pages.
5) user thus wish to also have the headers of  the table repeated on the subsequent 
pages.

So, my problem is, how can I know when the information will be more than a page? is 
there a way in PHP to calculate the number of lines output and then I can force a 
page-break?

please help me. thank you soo soo much!

regards,
hwee hwee

[PHP-DB] Session Cache Limiter

2004-09-16 Thread Ng Hwee Hwee
Hi,

has anyone used session_cache_limiter('must-revalidate') before to solve the problem 
on "Warning: Page Expire.."? i saw it on some websites, tried it and it worked for 
me.. but i never come across this word officially in any books or sites..

Can someone kindly direct me to something that provides me with more information on 
this?

thank you so much!!

hwee

PS: i'm not sure if this is appropriate for this list.. sorry, if it is not!!! =(

[PHP-DB] Form action

2004-10-10 Thread Ng Hwee Hwee
Hi all,

i'm designing a lot of forms and would like to know the standard practice. which of 
the following will be advisable?

1) form action is $PHP_SELF
i.e. 
i.e the script to check if the values submitted is valid and the scripts to
 insert the data into the database are all in the same php file with the form.
2) form action is another verification php file
i.e. 
i.e the script to check if the values submitted is valid and the scripts to
 insert the data into the database are in a different php file with the form.

which of them is best?? i read before that the second option is preferred because if 
users click "back" on their browser, they will not resubmit the form again etc.. does 
anyone has a suggestion for me?

thank you so much!

regards,
hwee


Re: [PHP-DB] Form action

2004-10-12 Thread Ng Hwee Hwee
hi,

i can use Method (1) and include the validation file instead of prepending
it to the whole form. then it would centralise my form submission and also
does not make my debugging process too messy, right?

- Original Message - 
From: "Shahmat Dahlan" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
Cc: "PHP DB List" <[EMAIL PROTECTED]>
Sent: Monday, October 11, 2004 11:47 AM
Subject: Re: [PHP-DB] Form action


> When I first started out with PHP, I asked the same myself the same
> questions as you just did. But over the years I have concluded:
>
> Method (1) centralizes all your form submission processes for addition,
> deletion, updating purposes, which means when you want to start
> debugging, you would end up having to debug A (one) particular file
> only. But makes your debugging process just a little bit tiresome, in
> the case where your form is a little bit complicated.
>
> Method (2) decentralizes all your form submission processes, but in a
> way you'd simplify your coding practice as you segregate your forms from
> your submission processes, which simplifies debugging, and you would not
> need to go through all your line of codes, as in method (1)
>
> There are pros and cons to these two methods, I would prefer to use
> method (1), and as soon as the form gets submitted, I'd end up utilizing
> either Javascript or the header function to redirect the page. So that
> when users won't be able to click on the "back" button.
>
> Well, that's just my honest opinion, other may have other ideas.
>
>
> Ng Hwee Hwee wrote:
>
> >Hi all,
> >
> >i'm designing a lot of forms and would like to know the standard
practice. which of the following will be advisable?
> >
> >1) form action is $PHP_SELF
> >i.e. 
> >i.e the script to check if the values submitted is valid and the
scripts to
> > insert the data into the database are all in the same php file
with the form.
> >2) form action is another verification php file
> >i.e. 
> >i.e the script to check if the values submitted is valid and the
scripts to
> > insert the data into the database are in a different php file
with the form.
> >
> >which of them is best?? i read before that the second option is preferred
because if users click "back" on their browser, they will not resubmit the
form again etc.. does anyone has a suggestion for me?
> >
> >thank you so much!

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



[PHP-DB] PHP & Crystal Report

2004-12-12 Thread Ng Hwee Hwee
Hi all,

can someone kindly direct me to resources on generating reports using Crystal 
Report 10 through PHP 4.3.4 and MySQL 4.0.22 database?

thank you.

best regards,
hwee

[PHP-DB] Form Variables

2003-10-22 Thread Ng Hwee Hwee
Hi all,

got an urgent problem.. it's regarding forms.

my system works like this..
1) user on page1 fills up form
2) upon clicking submit button, it will go to verify.php to verify if the
entries are correct
3) if there is any errors, verify.php brings user back to page1 with all the
errors listed beside the incorrect field entries

my problem is: how do i make the user's browser remember the data they
filled up at page1? i tried header("Cache-control: private"); but to no
avail..

by the way, my page is a https:// page..

will appreciate all help!

thank you in advance...

hwee

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



Re: [PHP-DB] Form Variables

2003-10-22 Thread Ng Hwee Hwee
hi jason.

thank you for your reply.

i am using sessions already. in fact, header("Cache-control: private");
worked in my other applications but not this one.. is it true that because
page1.php is a https:// page so it can't cache my entries?

thank you!

rgds,
hwee


- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 22, 2003 4:03 PM
Subject: Re: [PHP-DB] Form Variables


> On Wednesday 22 October 2003 15:06, Ng Hwee Hwee wrote:
>
> > got an urgent problem.. it's regarding forms.
> >
> > my system works like this..
> > 1) user on page1 fills up form
> > 2) upon clicking submit button, it will go to verify.php to verify if
the
> > entries are correct
> > 3) if there is any errors, verify.php brings user back to page1 with all
> > the errors listed beside the incorrect field entries
> >
> > my problem is: how do i make the user's browser remember the data they
> > filled up at page1? i tried header("Cache-control: private"); but to no
> > avail..
>
> You don't. Your application has to remember the filled in values and when
> presenting page1.php again it pre-populates the form with the 'remembered'
> values. The easiest way to remember the values is to use sessions.
>
> Or alternatively you can one of the dozens of form validation classes that
are
> available (www.phpclasses.org et al) to do the donkey work for you.
>
> --
> 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
> --
> /*
> Famous quotations:
> " "
> -- Charlie Chaplin
>
> " "
> -- Harpo Marx
>
> " "
> -- Marcel Marceau
> */
>
> --
> 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] mail function

2003-10-30 Thread Ng Hwee Hwee
hi all,

i need to use a mail() function to send a job application to my inbox when
an applicant goes online and complete the application form. However, when
the contents of a certain field is very long, the message i get in my inbox
is truncated! can anyone help me please?

i've tried word wrap, chunk_split and chop but none worked..

the field in the form is something like .

thank you in advance for your help!

kind regards,
hwee hwee

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



[PHP-DB] mail function

2003-10-30 Thread Ng Hwee Hwee
hi all,

i need to use a mail() function to send a job application to my inbox when
an applicant goes online and complete the application form. However, when
the contents of a certain field is very long, the message i get in my inbox
is truncated! can anyone help me please?

i've tried word wrap, chunk_split and chop but none worked..

the field in the form is something like .

thank you in advance for your help!

kind regards,
hwee hwee


[PHP-DB] Read file

2003-11-17 Thread Ng Hwee Hwee
hi all,

can anyone enlighten me on how i can use PHP to read the contents of a file from the 
client's machine?? for eg, the client has a CSV file in his MyDocuments directory, how 
can I read the contents and publish them on the web?

thank you lots!

Hwee Hwee

Re: [PHP-DB] Read file

2003-11-17 Thread Ng Hwee Hwee
the reason i don't want to read from the server is because i don't want to
use up too much space and processing time on the server.. the file has
50,000 records of information..

is there another way other than uploading on the server side??

thanx!
hwee


- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 18, 2003 9:54 AM
Subject: Re: [PHP-DB] Read file


> On Tuesday 18 November 2003 09:29, Ng Hwee Hwee wrote:
>
> > can anyone enlighten me on how i can use PHP to read the contents of a
file
> > from the client's machine?? for eg, the client has a CSV file in his
> > MyDocuments directory, how can I read the contents and publish them on
the
> > web?
>
> You have to ask them to upload it to the server:
>
>   manual > Handling file uploads
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *

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



Re: [PHP-DB] Read file

2003-11-17 Thread Ng Hwee Hwee
what about using cookies?

my problem is this: i have about 10,000 hotels records and each of them has
information about its location, its hotel code, its hotel tel, its country
code etc... i would like to load this into the clients computer so that when
they enter a hotel code, all the information will be reflected in the form
using onChange()... if 50 employees were to query the database always for
these 10,000 records, i'm afraid the server can't take the traffic and die..
so i was thinking of uploading a CSV file into my client's computer and then
have my scripts find the file and read the file for Javascript to process...
since the information in the file changes ususally only once a year, i don't
have to worry that they will have back-dated information..

i'm desperate for enlightenment! thanx!! :o)

blessings,
hwee


- Original Message -
From: "Michael Scappa" <[EMAIL PROTECTED]>
To: "'Ng Hwee Hwee'" <[EMAIL PROTECTED]>
Sent: Tuesday, November 18, 2003 10:01 AM
Subject: RE: [PHP-DB] Read file


> If you are publishing it on the web, it has to get to the server
> eventually, so your answer is "no". There is really no way around it. If
> the file is often used, pump it into a DB and search it that way, it'll
> be much quicker.
>
> -Original Message-
> From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 17, 2003 8:58 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Read file
>
> the reason i don't want to read from the server is because i don't want
> to
> use up too much space and processing time on the server.. the file has
> 50,000 records of information..
>
> is there another way other than uploading on the server side??
>
> thanx!
> hwee
>
>
> - Original Message -
> From: "Jason Wong" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, November 18, 2003 9:54 AM
> Subject: Re: [PHP-DB] Read file
>
>
> > On Tuesday 18 November 2003 09:29, Ng Hwee Hwee wrote:
> >
> > > can anyone enlighten me on how i can use PHP to read the contents of
> a
> file
> > > from the client's machine?? for eg, the client has a CSV file in his
> > > MyDocuments directory, how can I read the contents and publish them
> on
> the
> > > web?
> >
> > You have to ask them to upload it to the server:
> >
> >   manual > Handling file uploads
> >
> > --
> > Jason Wong -> Gremlins Associates -> www.gremlins.biz
> > Open Source Software Systems Integrators
> > * Web Design & Hosting * Internet & Intranet Applications Development
> *
>
> --
> 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: Re: [PHP-DB] Read file

2003-11-18 Thread Ng Hwee Hwee
Hi Neil,

thank you so much for your advice! i have not programmed XML before so it
will take me a while to learn it.. your suggestion sounds really fantastic,
expecially the part when i don't even have to ask the users to direct me to
the file that i need..

my problem, simply put will be:
1) user has to enter details in a form
2) when user enters HotelCode in one of the fields in the  form,
3) javascript must pass the value to PHP to search for the HotelName,
HotelAddress, HotelTel etc..
4) and then PHP pass the fetched variables back to javascript
5) javascript place those values in the respective fields
6) user continues to complete the form

through many of the help from people on this list and on the web, i think
maybe i can:
1) create a frame and write my PHP query statements in it
2) set a cookie when the user enters the HotelCode
3) reload the frame with the PHP code and get the variable with $_COOKIE
4) on the same frame, echo the fetched variables into javascript fields

have not try this out yet.. but if anyone has any thoughts, would love to
hear it!

thanks much,
hwee


- Original Message -
From: "Neil Smth" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, November 19, 2003 6:28 AM
Subject: Re: Re: [PHP-DB] Read file


> You would benefit from using XML for these data structures. XSLT can be
> used to quickly filter records stored on the clients computer locally. The
> client can then make changes to desired records and upload the XML file
> fragment to the server. The server then has a much lower load as it only
> has to process the changed records.
>
> I would (and have) get the user to download a ZIP file containing the XML
> file, a web page which processes it and some javascript support files.
When
> the ZIP is unpacked, the page can then load the XML file from the current
> directory (containing the web page), you would not need to know anything
> about the user's directory structure, and they would not have to browse
for
> the file when they use your application.
>
> Another optimisation might be to have the client browser start, and then
> query a URL provided by you. The URL would offer a 'last-updated' date as
> another XML file. Comparing this with a value which you store inside your
> provided XML file would allow the browser to alert the user that a new
file
> was available, and to visit your website to download a new ZIP file.
>
> Both IE and Mozilla support loading and scripting of XML / XSL
transformations
>
> In IE you might want to read up on the xmlhttp.load and xmlhttp.send
> function to read remote XML files. (This will require MSXML2.6 or above)
>
> Hope that helps, I'm not really too sure what you are trying to do, even
> with your description below - maybe a diagram would help us to understand
> your problem ?
>
> Cheers - Neil
>
> At 15:00 18/11/2003 +, Ng Hwee Hwee
>
> >From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> >To: "Michael Scappa" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
> >Date: Tue, 18 Nov 2003 10:27:26 +0800
> >MIME-Version: 1.0
> >Content-Type: text/plain;
> > charset="iso-8859-1"
> >Content-Transfer-Encoding: 7bit
> >Subject: Re: [PHP-DB] Read file
> >
> >what about using cookies?
> >
> >my problem is this: i have about 10,000 hotels records and each of them
has
> >information about its location, its hotel code, its hotel tel, its
country
> >code etc... i would like to load this into the clients computer so that
when
> >they enter a hotel code, all the information will be reflected in the
form
> >using onChange()... if 50 employees were to query the database always for
> >these 10,000 records, i'm afraid the server can't take the traffic and
die..
> >so i was thinking of uploading a CSV file into my client's computer and
then
> >have my scripts find the file and read the file for Javascript to
process...
> >since the information in the file changes ususally only once a year, i
don't
> >have to worry that they will have back-dated information..
> >
> >i'm desperate for enlightenment! thanx!! :o)
> >
> >blessings,
> >hwee
>
> --
> 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] Statistic Graph Tool

2005-03-29 Thread Ng Hwee Hwee
Hi all,

i'm looking for a php tool that allows me to retrieve data from mySQL,
calculate some statistics and then generate a graph (preferably 3D and
beautifully generated).

i read about JpGraph. are there other recommendations or advice?

thank you so much!

hwee

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



[PHP-DB] Web Printing

2005-03-31 Thread Ng Hwee Hwee
Hi all,

i am very perplexed now and i hope you guys can help me.

i am reading 50,000 records from mySQL database and i need to print them out in 
a report format. However, i also need to print a page number through PHP on all 
the pages (for example, "Page 1 of 200") and display a header and a footer.

i know i can print out a header and footer using HTML  and . 
However, the  doesn't always stay at the bottom of the page. For 
example, if the the last page only have 2 records, the  will appear 
pretty high on the page.

i am wondering how can i use PHP to fix the position of my header and footer 
and also display my page numbers and total number of pages to be printed.

all help is very much appreciated 

thank you,
hwee :o)

[PHP-DB] Re: Subject: Web Printing

2005-03-31 Thread Ng Hwee Hwee
hi all,

thanx for all your suggestions. however, the css below doesn't seem to help
me solve my  problem. if my  is pretty short, the  will
still NOT appear at the bottom of my page but it appears where my 
ends (which sometimes ends in the middle of my page). what else can i do??

by the way, i cannot use PDFs to generate my reports as suggested by many of
you kind souls. This is because my clients just want to click on the "Print
Monthly Report" button and i am suppose to fetch the relevant data from
MySQL DB and print out the report.. they don't need to save them in Excel or
PDF. It is restricted to printing off the IE browser.

The problem that gives me the most headache is how can I know the total
number of pages and the current page number, by using PHP?? I really need
this because a report can be hundreds of pages so page number is very
important to my clients.

Please kindly help me! thank you s much!

Hwee

- Original Message - 
From: "Neil Smith [MVP, Digital media]" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, March 31, 2005 9:15 PM
Subject: Subject: Web Printing


> At 10:27 31/03/2005 +, you wrote:
> >Message-ID: <[EMAIL PROTECTED]>
> >From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> >To: "PHP DB List" 
> >Date: Thu, 31 Mar 2005 18:24:41 +0800
> >Subject: Web Printing
> >
> >Hi all,
> >
> >i know i can print out a header and footer using HTML  and
.
> >However, the  doesn't always stay at the bottom of the page. For
> >example, if the the last page only have 2 records, the  will
appear
> >pretty high on the page.
> >
> >i am wondering how can i use PHP to fix the position of my header and
footer
>
> PHP cannot help you here, it's the wrong tool for the job (it's a "hammer"
> not a "screwdriver" so to speak).
> You need to (*must* !!!) use CSS to position and specify the height and
> dimensions of the thead and tfoot thus :
>
>
> thead {
>  display: table-header-group;
>  position: absolute;
>  top: 0;
>  height: 36pt;
>  width: 100%;
> }
>
> tfoot {
>  display: table-footer-group;
>  position: absolute;
>  bottom: 0;
>  height: 36pt;
>  width: 100%;
> }
>
> These should apply *reasonably* well to position your thead and tfoot row
> groups in the same place on each printed page (adjust as desired). You
> *cannot* use PHP to "guess" the height of the page areas reliably unless
> you are using a fixed pitch font such as a dot matrix line printer. And
> even then it's somewhat guesswork (I've done both).
>
> But if we're assuming that you're users have laser printers you *must* use
> CSS to do the print layout, PHP "line height guessing" will not work for
you.
>
> Cheers - Neil

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



Re: [PHP-DB] Re: Subject: Web Printing

2005-03-31 Thread Ng Hwee Hwee
hi!

thanks for the suggestion.. actually i have tried PDF generation before and
because my clients are japanese companies, the japanese characters don't get
generated correctly.. i am still working on that but it doesn't seem that
easy for me.

furthermore, i really still can't see how PDF allows me to get my page
number and total number of pages intermingled with my main contents. =(

please advise.. thanks s much!

hwee

- Original Message - 
From: "Mark Cain" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>; "PHP DB List" 
Sent: Friday, April 01, 2005 12:07 PM
Subject: Re: [PHP-DB] Re: Subject: Web Printing


> Let me encourage you to be open minded about the use of dynamic PDF
> generation.  Don't think PDF as in storage and downloading -- think PDF in
> the realm of format control.
>
> google class.ezpdf.php
>
> or just use this link:
>
> http://www.google.com/search?hl=en&q=class.ezpdf.php&spell=1
>
> Mark Cain

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



Re: [PHP-DB] Subject: Web Printing

2005-04-01 Thread Ng Hwee Hwee
hi Neil,

thanx for your reply.. as mentioned earlier, the following method don't seem
to work for me.. my  still moves up the page if my  has only a
few lines of content. =(

hwee

- Original Message - 
From: "Neil Smith [MVP, Digital media]" <[EMAIL PROTECTED]>
To: 
Sent: Friday, April 01, 2005 4:52 PM
Subject: [PHP-DB] Subject: Web Printing


> At 10:27 31/03/2005 +, you wrote:
> >Message-ID: <[EMAIL PROTECTED]>
> >From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> >To: "PHP DB List" 
> >Date: Thu, 31 Mar 2005 18:24:41 +0800
> >MIME-Version: 1.0
> >Content-Type: multipart/alternative;
> > boundary="=_NextPart_000_00CD_01C5361E.E80297D0"
> >Subject: Web Printing
> >
> >Hi all,
> >
> >i know i can print out a header and footer using HTML  and
.
> >However, the  doesn't always stay at the bottom of the page. For
> >example, if the the last page only have 2 records, the  will
appear
> >pretty high on the page.
> >
> >i am wondering how can i use PHP to fix the position of my header and
footer
>
> PHP cannot help you here, it's the wrong tool for the job (it's a "hammer"
> not a "screwdriver" so to speak).
> You need to (*must* !!!) use CSS to position and specify the height and
> dimensions of the thead and tfoot thus :
>
>
> thead {
>  display: table-header-group;
>  position: absolute;
>  top: 0;
>  height: 36pt;
>  width: 100%;
> }
>
> tfoot {
>  display: table-footer-group;
>  position: absolute;
>  bottom: 0;
>  height: 36pt;
>  width: 100%;
> }
>
> These should apply *reasonably* well to position your thead and tfoot row
> groups in the same place on each printed page (adjust as desired). You
> *cannot* use PHP to "guess" the height of the page areas reliably unless
> you are using a fixed pitch font such as a dot matrix line printer. And
> even then it's somewhat guesswork (I've done both).
>
> But if we're assuming that you're users have laser printers you *must* use
> CSS to do the print layout, PHP "line height guessing" will not work for
you.
>
> Cheers - Neil

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



[PHP-DB] Counting HTML Lines

2005-04-15 Thread Ng Hwee Hwee
Hi all,

is there a way to count how many lines of screen output has HTML render?
below is a sample of what i'm trying to do.. i'm trying to generate a table
with the Remarks column containing data type TEXT which may have a few
lines. therefore, i cannot just count how many rows of records i have. can
someone please help me??

basically, i need to insert a page break at every 20 lines of screen output
for printing purposes. can someone enlighten me on how i can read HTML
rendered output?? thank you really really s much!!!





  
Company Name
Remarks
  
 
   
   






=

best regards,
Hwee

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



Re: [PHP-DB] Counting HTML Lines

2005-04-15 Thread Ng Hwee Hwee
hi!

thanx for your reply. i cannot count the number of "\n" because sometimes
the inputted text is very long without any "\n", but because it is inside a
cell that has a linited width, HTML will automatically push it to the next
line, right? in this case, there won't be a count for "\n".

hwee

- Original Message - 
From: "Petar Nedyalkov" <[EMAIL PROTECTED]>
To: 
Sent: Friday, April 15, 2005 5:06 PM
Subject: Re: [PHP-DB] Counting HTML Lines

Count the "\n" characters in the output.

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



Re: [PHP-DB] Counting HTML Lines

2005-04-15 Thread Ng Hwee Hwee
Hi! thank you so much for your help!!

do you mean to do ob_get_contents() before i do a ob_end_flush()?

but even if i'm successful in counting the number of "\n"s, HTML tags like
,,

[PHP-DB] R6025 Error

2005-05-09 Thread Ng Hwee Hwee
Hi all,

I'm having a problem with a R6025 error. What happened is that I have a
table generated using MySQL and PHP that displays all the registered
customers. On the table header, i allow them to click on some links that can
sort the table according to their preference. Sometimes, when users click on
these sorting links, they get an error:

=
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: C:\Program Files\Internet Explorer\IEXPLORE.EXE
R6025
- pure virtual function call
=

when this error appears, the user will have to click "OK" which closes the
browser!! Can someone advice me what i can do??

the links look like that:
De
sc
Asc

why should this cause an error??!!! thank you!

best regards,
hwee hwee

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



Re: [PHP-DB] R6025 Error

2005-05-09 Thread Ng Hwee Hwee
hi,

thanks for your reply... an example of the generated HTML code is as
follows:

DESC
ASC

i tried googling for this error but they keep telling me about some
Microsoft coding errors that i don't understand. I do not code in C or C++
so why should it cause a problem in my codes?

thank you for your help!!

best regards,
hwee

- Original Message - 
From: "Juffermans, Jos" <[EMAIL PROTECTED]>
To: "PHP DB List" 
Sent: Monday, May 09, 2005 6:01 PM
Subject: RE: [PHP-DB] R6025 Error


> Can you also send us the output generated by PHP? Ie the output HTML...
>
> Jos
>
> -Original Message-
> From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> Sent: 09 May 2005 10:48
> To: PHP DB List
> Subject: [PHP-DB] R6025 Error
>
>
> Hi all,
>
> I'm having a problem with a R6025 error. What happened is that I have a
> table generated using MySQL and PHP that displays all the registered
> customers. On the table header, i allow them to click on some links that
can
> sort the table according to their preference. Sometimes, when users click
on
> these sorting links, they get an error:
>
> =
> Microsoft Visual C++ Runtime Library
> Runtime Error!
> Program: C:\Program Files\Internet Explorer\IEXPLORE.EXE
> R6025
> - pure virtual function call
> =
>
> when this error appears, the user will have to click "OK" which closes the
> browser!! Can someone advice me what i can do??
>
> the links look like that:
> 
href="?sort=desc&sortBy=&argmt1=">De
> sc
>  >Asc
>
> why should this cause an error??!!! thank you!
>
> best regards,
> hwee hwee
>
> -- 
> 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



Re: [PHP-DB] R6025 Error

2005-05-10 Thread Ng Hwee Hwee
hi all,

this R6025 error is driving me nuts!!! anyone who can help me?
thanx a million!!

warmest wishes,
hwee

- Original Message - 
From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
To: "PHP DB List" 
Sent: Tuesday, May 10, 2005 11:15 AM
Subject: Re: [PHP-DB] R6025 Error


> hi,
>
> thanks for your reply... an example of the generated HTML code is as
> follows:
>
> DESC
> ASC
>
> i tried googling for this error but they keep telling me about some
> Microsoft coding errors that i don't understand. I do not code in C or C++
> so why should it cause a problem in my codes?
>
> thank you for your help!!
>
> best regards,
> hwee
>
> - Original Message - 
> From: "Juffermans, Jos" <[EMAIL PROTECTED]>
> To: "PHP DB List" 
> Sent: Monday, May 09, 2005 6:01 PM
> Subject: RE: [PHP-DB] R6025 Error
>
>
> > Can you also send us the output generated by PHP? Ie the output HTML...
> >
> > Jos
> >
> > -Original Message-
> > From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> > Sent: 09 May 2005 10:48
> > To: PHP DB List
> > Subject: [PHP-DB] R6025 Error
> >
> >
> > Hi all,
> >
> > I'm having a problem with a R6025 error. What happened is that I have a
> > table generated using MySQL and PHP that displays all the registered
> > customers. On the table header, i allow them to click on some links that
> can
> > sort the table according to their preference. Sometimes, when users
click
> on
> > these sorting links, they get an error:
> >
> > =
> > Microsoft Visual C++ Runtime Library
> > Runtime Error!
> > Program: C:\Program Files\Internet Explorer\IEXPLORE.EXE
> > R6025
> > - pure virtual function call
> > =
> >
> > when this error appears, the user will have to click "OK" which closes
the
> > browser!! Can someone advice me what i can do??
> >
> > the links look like that:
> >  >
>
href="?sort=desc&sortBy=&argmt1=">De
> > sc
> >  href="?sort=asc&sortBy=&argmt1="
> > >Asc
> >
> > why should this cause an error??!!! thank you!
> >
> > best regards,
> > hwee hwee
> >
> > -- 
> > 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] PHP & XML

2005-07-29 Thread Ng Hwee Hwee
Hi all,

My customer gave me an .xsd file and I need to generate an HTML form for him. 
He will then fill in the values of the elements and then post it into my 
database. I'm using PHP4.3 and MySQL3.23.

Can someone point me to resources where i can accomplish this?

Thank you!! Look forward to hearing from you!

Best regards,
hwee

[PHP-DB] PHP, MySQL, XML books recommendation

2005-07-29 Thread Ng Hwee Hwee
hi guys,

any recommendation on good books or resources for me? I'm totally clueless 
about XML but would love to pick it up now. Any one can give me titles of good 
books?

thanks!!

look forward to hear from you,
hwee

[PHP-DB] Subquery

2005-09-18 Thread Ng Hwee Hwee
hi,

can some one enlighten me on what is wrong with my query?

I want to set the fax number of all the employees of a particular company to
the company's fax number. This is because the employees do not have personal
fax machines, thus instead of just leaving T020FaxNo blank, I want to update
it with the company's fax number. However, the following doesn't work?! i'm
hoping i don't have to write a PHP while loop to do this simple task! =(

UPDATE T020Employee SET T020FaxNo = (  SELECT T010FaxNo FROM T010Company
WHERE  T010CoCd =  'XXX'  ) WHERE T020CoCd =  'XXX'

MySQL version: 3.23.58. PHP version: 4.3.4.
My database structure is:
T010Company
===
T010CoCd (primary key)
T010CoName
T010Address
T010TelNo
T010FaxNo

T020Employee
===
T020CoCd (primary key, linking to T010CoCd)
T020EmpCd (primary key)
T020JobTitle
T020TelNo
T020FaxNo

Thanks so much!
Hwee

Re: [PHP-DB] Subquery

2005-09-18 Thread Ng Hwee Hwee
thanks but it doesn't work =(
is it because i'm on MySQL version 3.23?
i have an error 1064 when running it...

hwee

- Original Message - 
From: "Nandar" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>; "PHP DB List" 
Sent: Monday, September 19, 2005 11:02 AM
Subject: Re: [PHP-DB] Subquery


> i hope it's helping
>
> sql code:
>
> UPDATE T020Employee SET T020FaxNo = T010FaxNo
> FROM T020Employee a JOIN T010Company b ON a.T020CoCd =b.T010CoCd
>
> - Original Message - 
> From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> To: "PHP DB List" 
> Sent: Monday, September 19, 2005 9:14 AM
> Subject: [PHP-DB] Subquery
>
>
> hi,
>
> can some one enlighten me on what is wrong with my query?
>
> I want to set the fax number of all the employees of a particular
> company to
> the company's fax number. This is because the employees do not have
> personal
> fax machines, thus instead of just leaving T020FaxNo blank, I want to
> update
> it with the company's fax number. However, the following doesn't work?!
> i'm
> hoping i don't have to write a PHP while loop to do this simple task! =(
>
> UPDATE T020Employee SET T020FaxNo = (  SELECT T010FaxNo FROM T010Company
> WHERE  T010CoCd =  'XXX'  ) WHERE T020CoCd =  'XXX'
>
> MySQL version: 3.23.58. PHP version: 4.3.4.
> My database structure is:
> T010Company
> ===
> T010CoCd (primary key)
> T010CoName
> T010Address
> T010TelNo
> T010FaxNo
>
> T020Employee
> ===
> T020CoCd (primary key, linking to T010CoCd)
> T020EmpCd (primary key)
> T020JobTitle
> T020TelNo
> T020FaxNo
>
> Thanks so much!
> Hwee
>
> -- 
> 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] Subquery

2005-09-18 Thread Ng Hwee Hwee
hi all,

i found the solution! it's so easy actually.. i think my brain is not
functioning well on a Monday morning!! ;p

UPDATE  T020Employee, T010Company
SET T020FaxNo = T010FaxNo
WHERE T020CoCd =  T010CoCd

thanks bastien and nandar for your help! =)

hwee

- Original Message - 
From: "Bastien Koert" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; 
Sent: Monday, September 19, 2005 11:30 AM
Subject: RE: [PHP-DB] Subquery


> only versions  4.1 and above support subqueries...
>
> bastien
>
> >From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> >To: "PHP DB List" 
> >Subject: [PHP-DB] Subquery
> >Date: Mon, 19 Sep 2005 10:14:34 +0800
> >
> >hi,
> >
> >can some one enlighten me on what is wrong with my query?
> >
> >I want to set the fax number of all the employees of a particular company
> >to
> >the company's fax number. This is because the employees do not have
> >personal
> >fax machines, thus instead of just leaving T020FaxNo blank, I want to
> >update
> >it with the company's fax number. However, the following doesn't work?!
i'm
> >hoping i don't have to write a PHP while loop to do this simple task! =(
> >
> >UPDATE T020Employee SET T020FaxNo = (  SELECT T010FaxNo FROM T010Company
> >WHERE  T010CoCd =  'XXX'  ) WHERE T020CoCd =  'XXX'
> >
> >MySQL version: 3.23.58. PHP version: 4.3.4.
> >My database structure is:
> >T010Company
> >===
> >T010CoCd (primary key)
> >T010CoName
> >T010Address
> >T010TelNo
> >T010FaxNo
> >
> >T020Employee
> >===
> >T020CoCd (primary key, linking to T010CoCd)
> >T020EmpCd (primary key)
> >T020JobTitle
> >T020TelNo
> >T020FaxNo
> >
> >Thanks so much!
> >Hwee
>
> -- 
> 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] Programming Design

2005-09-20 Thread Ng Hwee Hwee
Hi all,

my company is trying to generate a programming standardization document and
i'll like to consult you guys on some basic terminologies.

please advise me if the following is true
--
jobs  |
 |
programs | |
-  | |
modules | | |
-  | | |
functions  |  | | |

basically, what i need to know is when designing a system, is it true that
we will have:
1) many JOBS e.g. user maintenance page, customer maintenance page and these
JOBS comprise of
2) many PROGRAMS e.g. user enquiry, user entry, user printout and these
PROGRAMS comprise of
3) many MODULES e.g. a user entry program will need to display a list of
users, the form to enter or edit a user's info and another to validate the
entries and insert into the database and these MODULES comprise of
4) many FUNCTIONS e.g. calculateAge($dateOfBirth)

is this true? what about the meaning of TASKS, OBJECTS and where do they
fit?

many thanks,
Hwee

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



[PHP-DB] Convert String to Array

2005-09-29 Thread Ng Hwee Hwee
Hi guys,

this looks like a very simple problem but i really have no idea how to do
it.. please help me! thanks!

my MySQL database has a table of which 2 fields are as follow

T100FieldNmT100Value
==   =
vehMdlCd[0] MER
vehMdlCd[1] LEX
vehMdlCd[2] TOY

and I need to echo out the value for $vehMdlCd[0]...[2]. but when I retrieve
T100FieldNm from the database, PHP recognises it only as a string. Thus, in
order to get the value of $vehMdlCd[0], I need to do the following.

for($i=0; $i<$numOfRows; $i++)
{
   $tmpVehMdlCd = "vehMdlCd[$i]";
   $vehMdlCd[$i] = $$tmpVehMdlCd;
}

where $numOfRows has been calculated by doing a count of  all T100FieldNm
like "vehMdlCd%".

Can someone enlighten me with a simpler way?! Potentially I can have a 100
over different T100FieldNm! =(

I tried using settype and type-casting but still don't get the respective
T100Value! *sob*

Thanks sooo much!

Best regards,
Hwee Hwee

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



[PHP-DB] Defined Constants

2005-10-12 Thread Ng Hwee Hwee
Hi all,

just a very simple question. my form has the following define statements and 
select box:

define("JOVIAL", "likes to joke alot");
define("CHEERFUL", "always wears a smile on his face");
define("ADVENTUROUS", "likes sports and plays well too");
define("MYSTERIOUS", "there's always something to discover everyday");


  
  
  
  


after i post my form, the value $myType will be one of my define statements. 
For example, user chooses "CHEERFUL" thus when i echo $myType, I will get 
"CHEERFUL" but actually, what i really want to get is "always wears a smile on 
his face".

can someone advise me how i can achieve this?? sounds simple but i really don't 
know how!! =(

thanks in advance!!
hwee

Re: [PHP-DB] Defined Constants

2005-10-13 Thread Ng Hwee Hwee
this works like a charm!!! thanks alot!!! :o)

- Original Message - 
From: "Matthias Willerich" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>; "PHP DB List" 
Sent: Thursday, October 13, 2005 2:28 PM
Subject: RE: [PHP-DB] Defined Constants


> 2 possibilities:
> either you put the defined value instead of the definition down in the
> option value (but i'm sure you thought of this one)
> or you use "echo constant($_POST['myType']);". Or GET, depending on how
you
> send your form.
>
> Hey, this time I learned something, too! I found it in the php helpfile,
> making my way from define to a chapter about constants, to this function.
> Here, if you're looking for functionality things, I think it's better than
> the online documentation:
> http://www.php.net/download-docs.php
>
>
> -Original Message-
> From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> Sent: 13 October 2005 07:13
> To: PHP DB List
> Subject: [PHP-DB] Defined Constants
>
>
> Hi all,
>
> just a very simple question. my form has the following define statements
and
> select box:
>
> define("JOVIAL", "likes to joke alot");
> define("CHEERFUL", "always wears a smile on his face");
> define("ADVENTUROUS", "likes sports and plays well too");
> define("MYSTERIOUS", "there's always something to discover everyday");
>
> 
>   
>   
>   
>   
> 
>
> after i post my form, the value $myType will be one of my define
statements.
> For example, user chooses "CHEERFUL" thus when i echo $myType, I will get
> "CHEERFUL" but actually, what i really want to get is "always wears a
smile
> on his face".
>
> can someone advise me how i can achieve this?? sounds simple but i really
> don't know how!! =(
>
> thanks in advance!!
> hwee
>
> -- 
> 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] Urgent! Installing PHP 4 on 64-bit machines

2007-03-06 Thread Ng Hwee Hwee
Hi,

I need urgent help. Have anyone successfully installed PHP 4 & MySQL 4.0 on 
64-bit Windows?

Is there any issues that I need to look out for?

Thank you. Please help me!!

Best regards,
Hwee Hwee



Re: [PHP-DB] Urgent! Installing PHP 4 on 64-bit machines

2007-03-06 Thread Ng Hwee Hwee

Hi Niel,

The problem is my customer bought the hardware and the OS and we are 
supposed to install PHP4 and MySQL4.0 on the IIS that came with their 
Windows Server 2003...


So I can't influence the decision on whether it should be a 32-bit or 64-bit 
machine. Given a choice, of course I won't use 64-bit!!! ;p


Please kindly help and advice me!!! :o)

Thanks so much, guys!

Best regards,
Hwee Hwee

- Original Message - 
From: "Niel Archer" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, March 07, 2007 6:17 AM
Subject: Re: [PHP-DB] Urgent! Installing PHP 4 on 64-bit machines



Hi

I need urgent help. Have anyone successfully installed PHP 4 & MySQL 4.0 
on 64-bit Windows?


Frankly, why would you want to?  Neither are written for 64 bit.  The
only versions I could find for 64 bit were the 5.x versions in both.
Which is what I run on my personal computer.

Niel

--
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] Urgent! Installing PHP 4 on 64-bit machines

2007-03-06 Thread Ng Hwee Hwee

Hi Chris,

Have you tried installing them? Are you getting an error? Nobody's going 
to be able to help without that information.


They will run in 32bit mode, but they should work fine (32 bit binaries 
work on a 64 bit processor, they don't work the other way around).


The situation is such that my colleague is now in my customer's place in 
another country and he is trying to do the installation but he called to say 
he keeps failing... he didn't give me any information on the error but ask 
me to check if there's any things he needs to look out for when installing 
PHP 4.3.4 on a 64-bit Windows Server machine.


I understand that it's not very easy to help me when I can't give you the 
exact error. I'm sorry because I myself can't get that information. His 
native language is not English and thus he can't google effectively to find 
the information he needs.


I googled for this issue and found that maybe I can type the following in my 
command prompt to enable my 32 bit extensions:
cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET 
W3SVC/AppPools/Enable32bitAppOnWin64 1


But, nope, that didn't solve the problem too.

If there's anything that may help, please kindly share with me! Thank you so 
much in advance! :o)


Best regards,
Hwee Hwee 


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



Re: [PHP-DB] Urgent! Installing PHP 4 on 64-bit machines

2007-03-08 Thread Ng Hwee Hwee

Hi all,

Just to close this thread in case someone encounters the same problem as me.

The issue is solved by doing the following:
1) uninstall IIS
2) type the following in the command prompt to enable 32 bit extensions:
   cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET 
W3SVC/AppPools/Enable32bitAppOnWin64 1

3) reinstall IIS

So sorry, this isn't even a PHP problem. My apologise for posting to the 
wrong mailing list!


Thank you to all who helped! :o)

Best regards,
Hwee Hwee

- Original Message - 
From: "Chris" <[EMAIL PROTECTED]>

To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
Cc: 
Sent: Wednesday, March 07, 2007 10:13 AM
Subject: Re: [PHP-DB] Urgent! Installing PHP 4 on 64-bit machines



Ng Hwee Hwee wrote:

Hi Chris,

Have you tried installing them? Are you getting an error? Nobody's going 
to be able to help without that information.


They will run in 32bit mode, but they should work fine (32 bit binaries 
work on a 64 bit processor, they don't work the other way around).


The situation is such that my colleague is now in my customer's place in 
another country and he is trying to do the installation but he called to 
say he keeps failing... he didn't give me any information on the error 
but ask me to check if there's any things he needs to look out for when 
installing PHP 4.3.4 on a 64-bit Windows Server machine.


I understand that it's not very easy to help me when I can't give you the 
exact error. I'm sorry because I myself can't get that information. His 
native language is not English and thus he can't google effectively to 
find the information he needs.


I googled for this issue and found that maybe I can type the following in 
my command prompt to enable my 32 bit extensions:
cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET 
W3SVC/AppPools/Enable32bitAppOnWin64 1


But, nope, that didn't solve the problem too.

If there's anything that may help, please kindly share with me! Thank you 
so much in advance! :o)


The -installs or -internals list would be able to help better I think.

--
Postgresql & php tutorials
http://www.designmagick.com/




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