Re: [PHP] Mac PHP MySQL

2006-11-02 Thread Wee Keat Chin

Ed,

Ed Lazor wrote:
I'm trying to configure and compile PHP 5.  The configure is failing to 
find the MySQL UNIX socket.  Any ideas?


I can't tell you why because I have not a clue, but why don't you try 
using MAMP (http://www.living-e.de/en/products/The-MAMP/download.php) 
and you can then switch between PHP4 AND 5?




--
Wee Keat Chin

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



Re: [PHP] mambo question..??

2005-10-09 Thread Wee Keat
Bruce,

I'm not sure what exactly you need to know, but I'll try to clarify a
few thing for you at best that I can.

bruce wrote:
 i'm going through the mambo app, trying to figure out where in the code the
 app starts to generate the actual menus for the Admin functions. i've
 tracked the actual code that gets generated mod_fullmenu.php but i can't
 seem to tell exactly how this code in the jscript gets generated... it

The full menu utilizes JSCookmenu class, where the menu items are
hardcoded in the mod_fullmenu.php, from around line: 60 - 320+


 appears that the mod_fullmenu page is somehow included, but i can't find
 out where this happens.

Here's what I don't quite understand what you mean by where this
happens. Did you mean how the mod_fullmenu.php is eval'd?

The way Mambo works is by 'including' the scripts into different
sections by using the mosLoadAdminModule('position_name') function call.
The funcion just regurgitates the PHP code so that it is interpreted.


 and yeah, i've tried to ask/send emails to people on the mambo list with no
 luck. so i figured i'd ask here, if anybody has experience with playing with
 the code of mambo...

I have quite a few years of experience in dealing with Mambo, but I'm
definitely no expert. Hope that helps anyway.



-- 
Wee Keat Chin

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



[PHP] Problem detecting HTTPS connection

2005-08-09 Thread Wee Keat
Hi all,

I've been struggling to detect HTTPS connection for a shopping cart.
I've used $_SERVER['SERVER_PORT'] to check for 443 and it kept on
showing up as 80.

Does anyone have any idea why this is happening? Is it the server
config? I've called the server administrator and he said that it is
running through port 443 for https connections.

Here's an output of $_SERVER['SERVER_PORT'] on the site that I'm working on:

https://www.axentonline.com.au/port_test.php
http://www.axentonline.com.au/port_test.php

Both the above are showing server_port as 80. Please assist.


Thanks.


PHPInfo:
---
Apache-AdvancedExtranetServer/2.0.50
Mandrakelinux/7.2.101mdk
mod_ssl/2.0.50
OpenSSL/0.9.7d
PHP/4.3.8


-- 
Wee Keat Chin

Protocol Networks
p: 1300 131 932
e: [EMAIL PROTECTED]
h: www.pn.com.au

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



Re: [PHP] Problem detecting HTTPS connection

2005-08-09 Thread Wee Keat
Hi Marco,

Thanks for taking the time to answer my questions.

Marco Tabini wrote:
 That's been discussed a few times on the list. For example:
 
 http://beeblex.com/lists/index.php/php.general/190410

Yes. I'm truly aware of that and have tried it but to no avail. I've
added the code provided in the list to the following for your review:

http://www.axentonline.com.au/port_test.php
https://www.axentonline.com.au/port_test.php

I've done a var dump before of $_SERVER and $_ENV and did not find any
HTTPS key in the array.

Is there another way that I can do this?


Thanks again.



-- 
Wee Keat Chin

Protocol Networks
p: 1300 131 932
e: [EMAIL PROTECTED]
h: www.pn.com.au

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



Re: [PHP] Problem detecting HTTPS connection

2005-08-09 Thread Wee Keat

Marco Tabini wrote:
 Unfortunately, I can't seem to be able to connect to your server right now.
 
 What server software are you using? I have never heard of this approach not

Info:
---
Apache-AdvancedExtranetServer/2.0.50
Mandrakelinux/7.2.101mdk
mod_ssl/2.0.50
OpenSSL/0.9.7d
PHP/4.3.8

The server is not handled by me and I'm not sure if
Apache-AdvancedExtranetServer is different from Apache 2. Could this be
the source of the problem?


 working on a properly configured Apache... But maybe you're using something
 else?

Is there a list of common mis-configurations of Apache that may lead to
this problem? It looks like this may not be a problem with PHP at all.

I'll have to talk to the server administrator to see if there's a chance
his server is configured wrongly. If the answer lies there, I'll close
this thread.

Thanks again.




-- 
Wee Keat Chin

Protocol Networks
p: 1300 131 932
e: [EMAIL PROTECTED]
h: www.pn.com.au

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



[PHP] Converting integer type to long

2005-08-02 Thread Wee Keat
Hi All,

I'm facing a little problem here. I'm making a few query using SOAP
protocol (NuSOAP class), that involves sending out an amount (e.g.
0.01), which is accepted in type of [long] in its WSDL, for recording
purpose. Typical call:

[code]
$param = array('rewardSchemeId'= $tnt_rewardSchemeId,
'accountNumber' = $acountNumber,
'amount'= $amountIgnoringDecimalPoint) );

$result = $soap-call('recordBooking', $param);
[/code]

The problem is, I have not been able to convert PHP's integer/float type
to long because there is no function that does it. Or is there?

I've tried using settype() and (type) casting, but to no avail. I've
read a user's contribution note in PHP Manual for settype(), and he said:

It's worth noting that one can neither Isettype()/i nor type-cast a
variable as a long.  The workaround for this seems to be to use
Ipack()/i.

I've looked at pack() function and tried it but I don't think I'm
getting it right because the instruction is not clear to me ( I don't
have programming background). I've done the following:

$amount = pack('L', $amount);

Please assist. Thanks.




-- 
Wee Keat Chin

Protocol Networks
p: 1300 131 932
e: [EMAIL PROTECTED]
h: www.pn.com.au

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



[PHP] Breaking up data efficiently

2005-06-27 Thread Wee Keat
Hi All,

I'm working on an aircraft booking system and it has multiple
origin/destination data, concatenated into a single line:


/* BEGIN DATA */

Melbourne, AU, 21-07-2005 14:00:00|Perth, AU, 21-07-2005 18:00:00|Perth,
AU, 25-07-2005 14:00:00|Melbourne, AU, 25-07-2005 18:00:00

/* END DATA */


As you can see, each origin/destination is separated by a pipe '|', and
then, each origin/destination data has its location, country and
datetime of departure/arrival, separated by comma ','.

I'm splitting them up into array of location, country and datetime using
the following:


/* BEGIN CODE */

$itenary = explode('|', $booking-booking_flight_details);

$size = count($itenary);

for($i=0; $i  $size; $i++) {
list($path[$i]['location'],
 $path[$i]['country'],
 $path[$i]['datetime']) = explode(',', $itenary[$i]);
}

/* END CODE */



*Question*: Is the above the code an effective way to do it? Or is there
a better/faster way?

Somehow, it feels like there's lots of things going through the above code.

Please advise. Thanks.


-- 
Wee Keat Chin

Protocol Networks
p: 1300 131 932
e: [EMAIL PROTECTED]
h: www.pn.com.au

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



Re: [PHP] Breaking up data efficiently -- closed

2005-06-27 Thread Wee Keat
Hi all,

Thanks for all the input. Really an eye opener on all the various ways
that could do the same thing! :) Really appreciate it.

Off to work with new ideas!

Tom Rogers wrote:
 function build($data){
   global $path;
   $i = count($path);
   $path[$i]['location'] = $data[1];
   $path[$i]['country'] = $data[2];
   $path[$i]['datetime'] = $data[3];
 }
 $path = array();
 $str = 'Melbourne, AU, 21-07-2005 14:00:00|Perth, AU, 21-07-2005 
 18:00:00|Perth, AU, 25-07-2005 14:00:00|Melbourne, AU, 25-07-2005 18:00:00';
 preg_replace_callback('/(\w+),\s*(\w+),\s([0-9-]+\s[0-9:]+)(?=\|)/s','build',$str);
 print_r($path);


Jasper Bryant-Greene wrote:
 $itinerary = explode('|', $booking-booking_flight_details);
 
 foreach($itinerary as $item) {
   $item = explode(',', $item);
   $path[] = array(
   'location'  = $item[0],
   'country'   = $item[1],
   'datetime'  = $item[2]
   );
 }


Philip Hallstrom wrote:
 $bits = split([|,], $booking-booking_flight_details);
 $size = count($itenary);
 for ( $i = 0; $i  $size; $i += 3 ) {
 $path[$i]['location'] = $bits[$i];
 $path[$i]['country'] = $bits[$i + 1];
 $path[$i]['datetime']  = $bits[$i + 2];
 }
 




-- 
Wee Keat Chin

Protocol Networks
p: 1300 131 932
e: [EMAIL PROTECTED]
h: www.pn.com.au

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



Re: [PHP] Zend Optimizer not installed

2004-10-01 Thread Wee Keat
Hi Ox,


 Does anyone know of a hosting company that will provide Zend Optimizer
 v2.1.0 or later on a VIRTUAL hosting package. (preferably in the UK)

I'm with Lunarpages ( http://www.lunarpages.com ) on a virtual hosting
server and they have Zend Optimizer installed. However, I do not know what
version they are running on.

Hope that helped.



Yours,

Wee Keat Chin
http://www.visualdensity.com

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



Re: [PHP] Nested Arrays

2002-12-26 Thread Wee Keat [Amorphosium]


 Is there anyway to do a nested array, I have looked at the various array
 functions and can't figure this out (if possible).
 
Try reading up on multidimensional array...

http://www.onlamp.com/pub/a/php/2001/06/07/php_foundations.html
http://www.onlamp.com/pub/a/php/2001/06/21/php_foundations.html

http://www.php.net/manual/en/function.array.php

HTH.


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




Re: [PHP] Nested Arrays

2002-12-26 Thread Wee Keat [Amorphosium]

- Original Message -
From: Beauford.2002 [EMAIL PROTECTED]
To: Wee Keat [Amorphosium] [EMAIL PROTECTED]
Sent: Friday, December 27, 2002 12:13 PM
Subject: Re: [PHP] Nested Arrays


 Quote: I have looked at the various array functions and can't figure this
 out .


Wow... You're welcome!


 
 
   Is there anyway to do a nested array, I have looked at the various
array
   functions and can't figure this out (if possible).
  
  Try reading up on multidimensional array...
 
  http://www.onlamp.com/pub/a/php/2001/06/07/php_foundations.html
  http://www.onlamp.com/pub/a/php/2001/06/21/php_foundations.html
 
  http://www.php.net/manual/en/function.array.php
 
  HTH.
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 






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




Re: [PHP] Tutorials on OOP

2002-12-22 Thread Wee Keat

 Hi Justin,

 Thanks for your quick reply.. Well in this case i needs to build em
 myself, because i am doing a course called Masterclass PHP and i have to
 learn OOP.. So i am looking for some good OOP tutorials/examples on the
 web I am very interested in creating a user login class using
 sessionsDo u know any good sites where i can find tutorials/examples
 about this.?


If that's the case... u can try looking at these tutorials on Zend.com...

http://www.zend.com/zend/tut/tutorial-johnson.php
http://www.zend.com/zend/tut/tutorial-johnson2.php

As well as these ones on DevArticles.com

http://www.devarticles.com/art/1/241
http://www.devarticles.com/art/1/245
http://www.devarticles.com/art/1/262
http://www.devarticles.com/art/1/285

HTH!

Yours,
Wee Keat


Good timber does not grow with ease; the stronger the wind, the stronger
the trees.



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




Re: [PHP] URL path problems

2002-12-19 Thread Wee Keat
 Suppose my web domain is http://abc.com
 There is a administration directory in my wwwroot which is used to store
the
 administrative control pages.

 However, from now on, everyone can access the administrative pages through
 the addictive path to the domain such as:
 http://abc.com/administration/xxx.php

 Is there any solution to block or prevent the addictive path through my
 server?
 Just like only http://abc.com is allowed to browse.
 thx a lot

Why not try reading up on using htaccess?? But u need apache though...

Here's a link to get u started:

http://www.devarticles.com/art/1/15
http://www.devarticles.com/art/1/266




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




Re: [PHP] Verisign Credit Card Processing with PHP

2002-12-17 Thread Wee Keat
I just came across an article on Zend regarding this.

It provides some examples and guidelines on how to use PHP with Verisign's
PayFlow Pro...

Hope this benefits.


The link is at: http://www.zend.com/zend/tut/tutorial-staub.php



- Original Message -
From: Max Clark [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 18 December, 2002 9:46 AM
Subject: [PHP] Verisign Credit Card Processing with PHP


 Hi-

 I was wondering anyone out there is using the verisign payflo product with
 php and could share their experiances with me.

 Are there good alternate choices that I should be looking at?

 Thanks in advance,
 Max





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





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




[PHP] How to loop diplays of 4 column of items, every row?

2002-12-06 Thread Wee Keat [Amorphosium]



Hi all... 

I've tried to figure this one out but I'm really 
having a headache now. So, I really need your help.

Situation:

I have a database of images and its own thumbnails 
created using GD. It worked wonderfully.

Problem:

I want to display ONLY thumbnails in table form, 
incrementing in rows of 4 columns. By this I mean that I want to write a script 
which loops in a way that it displays 4 pictures withdrawn from the database 
into a row, and then for the next 4 images, displays them into the next 
row.

If you don't understand see the gif below... a 
script that displays 4 pictures across first ( arrow 1) , then goes to the next 
row and displays the next 4 ( arrow 2).

I can't work out how can i structure my loop to do 
this.

Question:

Can all the gurus out there please give me a 
pointer? I really can't work out the logic or systematic flow of scripting this 
one.


Thank you so much in advance!


Yours,

Wee Keat Chin

--"Two 
things are infinite: the universe and human stupidity; and I'm not sure about 
the the universe." - Albert Einstein 
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP Javascript compatibilty

2002-11-29 Thread Wee Keat [Amorphosium]
Hi all,

I'm developing a WYSIWYG editor using PHP and Javascript (for COM). However, I start 
having problems when I try to display the page using the .php extension. The 
Javascript is not working. 

However, when I save it to HTML, it worked fine. 

Can anyone please help me? Why is this so? What can I do to get Javascript working 
with PHP with ease? Any articles on this?

Thanks a lot... again. :)



Yours,

Wee Keat Chin

--
If you cannot win, make the one ahead of you break the record. 



[PHP] How good is PHP to ASP?

2002-11-10 Thread Wee Keat [Amorphosium]
Hi all,

I'm not too sure if this is the right place to get my answers but I really need to 
know this:

How can I convince my clients that PHP is really good? I mean not a lot of 
non-programmers have heard of PHP language. Most of them only heard of things like 
C/C++, ASP and the like. So, how can I prove to them that PHP is a much better 
language to use? 

Can anyone point me to the right resources for me to show and prove to my clients?

Thanks a lot and sorry if this is the wrong place to ask this question.


Yours,

Wee Keat Chin

---
Don't find a fault; find a remedy 



[PHP] More Detailed Gettext() article?

2002-10-05 Thread Wee Keat [Amorphosium]

Hi everyone..

Sorry for bothering u guys for such trivial matter...

But where can I get a good article on how to use the gettext() function in PHP? I 
am building a website that supports multilingual capability and I've tried searching 
for it (Google, Yahoo, etc) the best that I could find is from O' Reilly but it 
was too brief to let me start on anything...

Please help.

Thanks a million... as usual!


Yours,

Wee Keat Chin

--
If you cannot win, make the one ahead of you break the record. 



[PHP] Stoopid Question - PHP.ini path?

2002-08-11 Thread Wee Keat

Hi..

Sorry to ask such a stoopid question here... but I really could not find anything on 
this...

How do I change the path of the php.ini file on Windows XP pro? I'm using IIS...

I just installed PHP on my web server and the path of the php.ini is c:\winnt but my 
is on c:\WINDOWS . So, how do I do this?

I tried searching over the web most of them talk about configuration.. I can't 
seemed to find anything on changing the path of the PHP.ini file.


THank you so much in advance.



Yours,
Wee Keat



Re: [PHP] fullname

2002-07-30 Thread Wee Keat

Is this easier for you?

$fullname = $session[f_name]. .$session[l_name];  



- Original Message - 
From: Mantas Kriauciunas [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 30 July, 2002 7:11 PM
Subject: [PHP] fullname


 Hey php-general,
 
   is there some other easyer way to do in one line than this?:
 
  $fullname .=  ;
 $fullname .= 
 
 P.S the thing is to add line in the middle of the first and last names
 :)
 
 Thanks
 -- 
 Best regards,
  Mantas  
 
 Contacts:
 [EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


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




[PHP] How to become a good PHP coder?

2002-07-30 Thread Wee Keat

Hi all...

I want to know how do you guys learn so much about PHP?

I have just started PHP about a month and a half ago and pior to that, I have 
ABSOLUTELY NO knowledge in programming.

I bought 2 books, which is Begining PHP4 (Wrox Press) and Core PHP programming 
(Prentice Hall). And that's all I can afford now... (I don't have a lot of money.. i 
learn using my friend's computer). However, I am determined to specialize in PHP. 

Can anyone point me towards a direction on how to do this properly?

Can anyone guide me through by letting me do a small part (more importantly not 
critical) of your projects as an excercise so that I can start a journey of discovery?

Thanks to all of you. And most of all thanks to all of your generosity.


Yours,
Wee Keat


Good timber does not grow with ease; the stronger the wind, the stronger the trees.




Re: [PHP] How to become a good PHP coder?

2002-07-30 Thread Wee Keat

Hi Cesar...

Thank you s much for your advice... and WOW! That's a great achievement!
I don't think I'll be able to achieve like you do! :)

I'll be following your advice and that of Justin as well as some others who
replied to me personally (thanks all again!) ... which has all be very very
useful for me. I have all of these advices printed out and stuck on my wall
at home as source of guidance and inspiration!

I would  also like to take this opportunity to thank all of you who are
contributing actively in this mailing list.. I might be new, but I deeply
appreciate the generosity that all of you have given us (those who have
problems). The passion that all of you guys have has really been a great
source of inspiration to me, as well as a great source of advise, answers
and guidances. It's truly admirable.

Thanks again to all who contributed generously to this mailing list.


Yours,
Wee Keat


Good timber does not grow with ease; the stronger the wind, the stronger
the trees.



- Original Message -
From: César Aracena [EMAIL PROTECTED]
To: 'Wee Keat' [EMAIL PROTECTED]; 'PHP General List'
[EMAIL PROTECTED]
Sent: 31 July, 2002 10:59 AM
Subject: RE: [PHP] How to become a good PHP coder?


 Hi Wee. I also started with PHP about 3 months ago and also without
 having any prior programming experience. Right now, I have a portfolio
 of 2 network PHP software and working on 2 Internet projects. I think
 the best advise I or anyone else would give you, is to keep up with this
 list and others also from php.net (that's what I do... read all of them
 mails? Of course I do ;)

 As I write this, the response from Justin just came in... and he's
 right. Try to make your own self-developed project, even if it's never
 going to be more than a site in your computer (or your friend's).
 Another good advise, would be to make searches in the web for sites that
 will share you code snippets (most of them are free because you know...
 PHP is open source ;) and store them in your favorite's folder... that
 way you will be able to know how others solved their problems and
 probably help you save time.

 I also read a couple of books while practicing at home and having fun
 but one of them is meant to teach you MySQL Data Base usage and
 administration through PHP... You should also look for the mailing list
 in www.mysql.com and stick to them... at least the main one (unless of
 course, you already have made another choice regarding data bases).

  -Original Message-
  From: Wee Keat [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, July 30, 2002 8:39 PM
  To: PHP General List
  Subject: [PHP] How to become a good PHP coder?
 
  Hi all...
 
  I want to know how do you guys learn so much about PHP?
 
  I have just started PHP about a month and a half ago and pior to that,
 I
  have ABSOLUTELY NO knowledge in programming.
 
  I bought 2 books, which is Begining PHP4 (Wrox Press) and Core PHP
  programming (Prentice Hall). And that's all I can afford now... (I
 don't
  have a lot of money.. i learn using my friend's computer). However, I
 am
  determined to specialize in PHP.
 
  Can anyone point me towards a direction on how to do this properly?
 
  Can anyone guide me through by letting me do a small part (more
  importantly not critical) of your projects as an excercise so that I
 can
  start a journey of discovery?
 
  Thanks to all of you. And most of all thanks to all of your
 generosity.
 
 
  Yours,
  Wee Keat
 
  
  Good timber does not grow with ease; the stronger the wind, the
 stronger
  the trees.



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


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




Re: [PHP] How to become a good PHP coder?

2002-07-30 Thread Wee Keat

Hi peter...

Wow!! That's a heck lot of info for me to digest! Thank you so much for all
that trouble!

Very useful stuffs... can't thank you enuff...


Yours,
Wee Keat


Good timber does not grow with ease; the stronger the wind, the stronger
the trees.



- Original Message -
From: Peter J. Schoenster [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 31 July, 2002 2:40 PM
Subject: RE: [PHP] How to become a good PHP coder?


 On 31 Jul 2002 at 11:38, Martin Towell wrote:

  The best way to become proficient in programming (or anything, come to
  that) is with _lots_ of practice.

 ...snip

  Personally, I don't bog myself down in code from the start. I think in
  sorta pseudo-code, then once I have a solution, I then implement in
  language-specific code.

 I whole-heartedly agree with the above.

 It's all to easy to just start spinning out code and weaving things
together and before you know it you've got something. But then come the
 inevitable changes, how will your code handle it?

 I would suggest reading some Steve McConnell.


http://www.amazon.com/exec/obidos/ASIN/1556154844/ref=ase_stevemcconnelconA/
103-2560652-4298245

 That's the author's affiliate id, doesn't hurt to help them make more
money. It links to Code Complete. As one reviewer says:

  Code Complete showed me that it's a lot more than that, beginning by
  designing your program, not just starting to write code right away, up
  to topics like naming conventions for variables, how to determine what
  code to put into a routine or how to make your program easier to debug.

 I cannot emphsize enough to follow some sort of standard. At least to read
through the standard once.

 http://pear.php.net/manual/en/standards.php

 Pragmatic Programmer is also quite good:


http://www.amazon.com/o/ASIN/020161622X/ref=cm_custrec_gl_acc/103-2560652-42
98245

 Anyone with 3/4 a brain can throw together some code to do something.
You've got thousands of examples and you might stumble across
 some of mine. It is another thing entirely to write code that will form a
basis for evolution. The web is all about evolution. We always have to get
 the latest project done yesterday and then before we've even tested it
we've got changes coming in ... thinking about what you are going to do
 and how you are going to grow it and test it are very important.

 Peter



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


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




[PHP] PHP + Form + Session Problem. Please help

2002-07-28 Thread Wee Keat



Hi all,

I have been working on an online shopping thingy for quite a while and I have 
encounter a strange problem which could not be solved. Deeply needed your help. 

Problem:

Its very hard to explain this. So, if you do not quite understand it, please tell me, 
I will send some screenshots to you personally... I tried send it here but it was 
rejected.

Okay.. here goes... I have a product list, where customers can select which products 
to buy and enter the quantity they want...

Upon clicking on Order button, the customer is brought to his shopping cartwhere 
there is the product, with price in Per Unit, Qty, and Total Price . In this 
area, value for Qty column is obtained from the $qty that is passed on from the 
previous page, where it is also a registered in session_register(qty). (The same 
goes to the Product, where prod_id is obtained from $prod_id, also a session 
registered variable.)

It worked out fine so far... it could get the product, unit price, qty and the total 
price.

But then, when I continued shopping second time, doing the same thing, first select 
the product, then enter the quantity and then dump it in the shopping cart, something 
starts going wrong... the Qty column do not show any value at all..  

However, products are still working... which means that the $prod_id session is 
recorded. How come?


Here is the snippet of the script:
(took out the HTML font tags to make it more readable)

The code I used to create the table in the product list 
-

?php
session_start();
session_register(qty);
?


 all other normal thingy..


while($query_data = mysql_fetch_array($result)) {

$price = $query_data[price_lq] * $rrp * $gst;
$RowColor = useColor();

echo TR BGCOLOR=\$RowColor\;
echo TD.$query_data[prod_brand]./TD;
echo TD.$query_data[prod_code]./TD;
echo TD.$query_data[prod_desc]./TD;
echo TD$,number_format($price, 2, '.', ''),/TD;
echo TDinput name=\qty[.$query_data[prod_id].]\ type=\text\ 
size=\1\/TD\n;
echo TDinput type=\checkbox\ name=\choice[, $query_data[prod_id], ]\ 
value=\, $query_data[prod_id],\/TD\n;

  }

all other html stuffs.

---



This is the code I used for the shopping cart 
---


?php
session_start();
session_register(qty);
?


 all other normal thingy..


while (list($key,$prod_id) = each($cart)) {
   $result = mysql_query(SELECT * FROM products WHERE prod_id = '$prod_id' ORDER BY 
prod_brand ASC, $link_id);
   $query_data = mysql_fetch_array($result);
   $RowColor = useColor();
   $index = $query_data[prod_id];
   $quantity = $qty[$index];
   $price_perunit = $query_data[price_lq] * $rrp * $gst;
   $total_price = $query_data[price_lq] * $rrp * $gst * $quantity;
   $grandtotal = $grandtotal + $total_price;

   echo TR BGCOLOR=\$RowColor\;
   echo TD.$query_data[prod_brand]./TD;
   echo TD.$query_data[prod_desc]./TD;
   echo TD$.number_format($price_perunit, 2, '.', '')./TD;
   echo TD.$quantity./TD;
   echo TD$.number_format($total_price, 2, '.', 
'')./strongBR/FONTnbsp;nbsp;/TD\n;
   echo \tTDa href=\delete.php?delete=.$query_data[prod_id].\ 
Onclick=\return confirm('Are you sure?');\;
   echo [Delete]/a/TD/TR;

  }

other html stuffs.

--



[PHP] Please help with Array..

2002-07-19 Thread Wee Keat

Hi all how are yas?

I have one question for which I could not find the answer:

How do I remove an element of an array with a specific key or index?

To be clearer:

Lets say I have an array $shoppingCart[] (quite a lot of them)
I want to delete $shoppingCart[345] (which is not the last or the first)
How do I do it?


I have checked the PHP manual... it has array_pop, array_shift which are for the last 
element and the first element. But what about specific elements in between the first 
and the last?

Please help out... I'm really in a rush to finish my project... :(

Thanks s much in advance for your time.


Yours,
Wee Keat Chin

---

Man is only truly great when he acts from his passions. 



[PHP] Please Help with LOOP!!

2002-07-18 Thread Wee Keat

Hi all...

I'm a complete beginner in programming. Just started a few months ago. 

So, I'm sorry if this is a stupid question to ask. But I'm at a dead end here and do 
not know where else to go.

I'm trying to automate a checkbox name to have the name choice1 to have incremental 
effect on the number such as the following:

input type=checkbox name=choice1 value=x
input type=checkbox name=choice2 value=x
input type=checkbox name=choice3 value=x
...

And I used the following script (please don't laugh) :)

Maximise this email to full screen so that you can see the script better.

for($count=1; $count=$rows; $count++) {
   while($query_data = mysql_fetch_array($result)) {
$price = $query_data[price_lq];
$RowColor = useColor();
echo TR BGCOLOR=\$RowColor\\n;
echo TD width=\10%\ valign=\top\font size=\2\ face=\Arial, Helvetica, 
sans-serif\,$query_data[prod_brand],BR/FONT/TD;
echo TD width=\60%\ valign=\top\font size=\2\ face=\Arial, Helvetica, 
sans-serif\,$query_data[prod_desc],BR/FONT/TD;
echo TD width=\15%\ valign=\top\font size=\2\ face=\Arial, Helvetica, 
sans-serif\,$,$price,BR/FONT/TD;
echo TD width=\15%\ valign=\top\input type=\checkbox\ 
name=\choice,$count,\ value=\, $query_data[prod_id],\/TD\n/TR;
   }
}

The result was irritating... it came up with the same name, which is choice1 all the 
way like:

input type=checkbox name=choice1 value=x
input type=checkbox name=choice1 value=x
input type=checkbox name=choice1 value=x
...

Am I doing it the wrong way? If so, how should I do it? 

Please pleas help... thanks



Yours,
Wee Keat


Good timber does not grow with ease; the stronger the wind, the stronger the trees.



Re: [PHP] Please Help with LOOP!! - Questions Answered!!!

2002-07-18 Thread Wee Keat

THANK YOU S MUCH FOR ALL YOUR HELP!!

God... in just five minutes you guys have helped me solved a problem I've
tried to figure out in an hour!!!

I finally decided to take off the loop and used only the while loop it
WORKED beautifully!

Thank you s much Lejanson, Asmodean, Martin and Dave. and all who
helped.

Really really appreciate it.

KISS TO ALL OF YAS!!!



- Original Message -
From: Martin Towell [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Friday, July 19, 2002 10:46 AM
Subject: RE: [PHP] Please Help with LOOP!!


 Asmodean - using comma is another way of using echo...

 Wee - try this instead - you're putting two loops together when you don't
 need to

 for($count=1; $count=$rows; $count++)
 {
   $query_data = mysql_fetch_array($result);
   $price = $query_data[price_lq];
   $RowColor = useColor();
   // current echo statements here
 }

 or

 $count=1;
 while($query_data = mysql_fetch_array($result))
 {
   $price = $query_data[price_lq];
   $RowColor = useColor();
   // current echo statements here
 }
 $count++;

 -Original Message-
 From: Asmodean [mailto:[EMAIL PROTECTED]]
 Sent: Friday, July 19, 2002 10:48 AM
 To: PHP General
 Subject: Re: [PHP] Please Help with LOOP!!


 Hello Wee,

 Friday, July 19, 2002, 2:36:40 AM, you wrote:

 WK Hi all...

 WK I'm a complete beginner in programming. Just started a few months ago.

 WK So, I'm sorry if this is a stupid question to ask. But I'm at a dead
end
 here and do not know where else to go.

 WK I'm trying to automate a checkbox name to have the name choice1 to
 have incremental effect on the number such as the following:

 WK input type=checkbox name=choice1 value=x
 WK input type=checkbox name=choice2 value=x
 WK input type=checkbox name=choice3 value=x
 WK ...

 WK And I used the following script (please don't laugh) :)

 WK Maximise this email to full screen so that you can see the script
 better.

 WK for($count=1; $count=$rows; $count++) {
 WKwhile($query_data = mysql_fetch_array($result)) {
 WK $price = $query_data[price_lq];
 WK $RowColor = useColor();
 WK echo TR BGCOLOR=\$RowColor\\n;
 WK echo TD width=\10%\ valign=\top\font size=\2\
 face=\Arial, Helvetica,
 sans-serif\,$query_data[prod_brand],BR/FONT/TD;
 WK echo TD width=\60%\ valign=\top\font size=\2\
 face=\Arial, Helvetica,
 sans-serif\,$query_data[prod_desc],BR/FONT/TD;
 WK echo TD width=\15%\ valign=\top\font size=\2\
face=\Arial,
 Helvetica, sans-serif\,$,$price,BR/FONT/TD;
 WK echo TD width=\15%\ valign=\top\input type=\checkbox\
 name=\choice,$count,\ value=\,
 $query_data[prod_id],\/TD\n/TR;
 WK}
 WK }

 WK The result was irritating... it came up with the same name, which is
 choice1 all the way like:

 WK input type=checkbox name=choice1 value=x
 WK input type=checkbox name=choice1 value=x
 WK input type=checkbox name=choice1 value=x
 WK ...

 WK Am I doing it the wrong way? If so, how should I do it?

 WK Please pleas help... thanks

 WK Yours,
 WK Wee Keat

 WK 
 WK Good timber does not grow with ease; the stronger the wind, the
 stronger the trees.

 echo TD width=\15%\ valign=\top\input type=\checkbox\
 name=\choice,$count,\ value=\,
 $query_data[prod_id],\/TD\n/TR;

 Your problem is with this line. Look closely at the following part:

 name=\choice,$count,\

 You should do this:

 name=\choice . $count . \

 ... and it will generate names like 'choice1', 'choice2', and so on.

 --
 Best regards,
  Asmodeanmailto:[EMAIL PROTECTED]


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

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


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