[PHP] Apache Error After Running Config PEAR-Package Application

2003-09-07 Thread Nilaab Y.
Hello Everyone,

Here goes: I recently started looking into PHP's PEAR project and I set
everything up correctly. The database abstraction package works wonders, I
love it. So I know that PEAR is working. However, when I try to include()
the Config package into my application it gives me Apache's 500 Internal
Server Error. I looked in the error log and this is what it said:

[Sun Sep 07 03:36:14 2003] [error] [client 127.0.0.1] Premature end of
script headers: c:/php/php.exe

Has anyone experienced anything like that while using a PEAR package? This
problem seems to be specific only to the Config package, because most of the
other packages that I've tested are fine, including the DB package.

There's also another thing I noticed, too. I wanted to check to see if the
file had been included or not. So I tested if the file_exists(), and it
does. Then I tested it with both the include() and include_once() functions.
The include() one didn't work. The include_once() worked because it didn't
throw an Apache-like error, but as soon as I started to spawn a new object
from that Config Class, it threw the PHP error:

Fatal error: Cannot instantiate non-existent class: config in
e:\localhost\xenonsol\xenon_0.3.1\Config.php on line 9

Any help would be greatly appreciated. I thank anyone in advance for helping
me out with this. I love PEAR so far, it's almost like the idea Microsoft
has, but I hope it will be far better than ASP.NET in the near future. In
fact I KNOW it will because it's so public and out-in-the-open. Anyone can
improve on these packages at any time. So, there's my two cents worth...

Thanks,
Nilaab

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



[PHP] Merging Multi-Dimensional Arrays Into Another Array

2003-08-21 Thread Nilaab Y.
Ok, here goes...

I have an multi-dimensional array extracted from the database ($units) that
is listed at the bottom of this e-mail. What I want to do is take this
multi-dimensional array $units and maybe merge or extract it to a different
array called $options. I want to group similar units into a category.

For example, I want to be able to group lbs. and oz. as units of weight. I
want to group cm, m, in, ft as units of width, height or depth. I will be
using this information to group these units into a drop-down menu on a form,
specific to the category (caption_name).

I've tried almost everything I could think of from the PHP Array manual to
try to get this to group the way I want it, but all attempts have failed
thus far. I even tried to combine these functions for a more complex answer,
but I kept getting lost in it. Can anyone suggest of a simple and easy way
to take the $units array and group it to something similar to the $options
array? Both arrays are listed below, with $options being a pseudo-array that
I'm trying to create from $units. Any help would be greatly appreciated...

$options Array
---
First dimension info:
[0] = weight group
[1] = width, height, or depth group
[2] = volume group
etc...
---
Array
(
[0] = Array
  (
  [0] = Array
(
[unit_id] = 1
  [unit_option] = lbs.
)
  [1] = Array
(
[unit_id] = 2
  [unit_option] = oz.
)
)
[1] = Array
  (
  [0] = Array
(
[unit_id] = 4
  [unit_option] = cm.
)
  [1] = Array
(
[unit_id] = 7
  [unit_option] = m.
)
  [3] = Array
(
[unit_id] = 5
  [unit_option] = cm.
)
  [4] = Array
(
[unit_id] = 6
  [unit_option] = m.
)
)
[2]...
[3]...
)

$units Array
---
Array
(
[0] = Array
(
[0] = 1
[caption_id] = 1
[1] = weight
[caption_name] = weight
[2] = 1
[unit_id] = 1
[3] = lbs.
[unit_option] = lbs.
)

[1] = Array
(
[0] = 1
[caption_id] = 1
[1] = weight
[caption_name] = weight
[2] = 2
[unit_id] = 2
[3] = oz.
[unit_option] = oz.
)

[2] = Array
(
[0] = 2
[caption_id] = 2
[1] = volume
[caption_name] = volume
[2] = 3
[unit_id] = 3
[3] = fl. oz.
[unit_option] = fl. oz.
)

[3] = Array
(
[0] = 2
[caption_id] = 2
[1] = volume
[caption_name] = volume
[2] = 11
[unit_id] = 11
[3] = L
[unit_option] = L
)

[4] = Array
(
[0] = 2
[caption_id] = 2
[1] = volume
[caption_name] = volume
[2] = 12
[unit_id] = 12
[3] = mL
[unit_option] = mL
)

[5] = Array
(
[0] = 2
[caption_id] = 2
[1] = volume
[caption_name] = volume
[2] = 13
[unit_id] = 13
[3] = cm#179;
[unit_option] = cm#179;
)

[6] = Array
(
[0] = 3
[caption_id] = 3
[1] = width
[caption_name] = width
[2] = 5
[unit_id] = 5
[3] = in.
[unit_option] = in.
)

[7] = Array
(
[0] = 3
[caption_id] = 3
[1] = width
[caption_name] = width
[2] = 4
[unit_id] = 4
[3] = cm.
[unit_option] = cm.
)

[8] = Array
(
[0] = 3
[caption_id] = 3
[1] = width
[caption_name] = width
[2] = 7
[unit_id] = 7
[3] = m.
[unit_option] = m.
)

[9] = Array
(
[0] = 3
[caption_id] = 3
[1] = width
[caption_name] = width
[2] = 6
[unit_id] = 6
[3] = ft.
[unit_option] = ft.
)

[10] = Array
(
[0] = 4
[caption_id] = 4
[1] = height
[caption_name] = height
[2] = 5
[unit_id] = 5
   

[PHP] Best Merchant Account For PHP Users

2003-06-25 Thread Nilaab Y.
Hello everyone,

I want to start learning about e-commerce, shopping carts, SSL encryption
methods, etc. I have built a catalog system for my clients and I want to
built a fully integrated store on top of it.

I need a merchant provider that can allow me to integrate the credit card
proccessing within my own designs. I want to just be able to send their
servers the credit card info, for authentication, processing, and banking,
then I want them to send me a confirmation message, saying the credit card
has been authorized successfully and the customer has been billed for such
amount of money, etc. I don't want to use any merchant provider's design. In
other words, no Motiva-like merchant providers.

Sorry about the long explaination. Here's the question:

Has anyone worked with a merchant account that can do what I need? Does
anyone have any suggestions of who their favorite merchant providers are?
Are there merchant providers who work better with applications coded in PHP,
or does it really not matter at all which application it's written in? Also,
does anyone know of a website (for dummies) that can teach me how to start
enabling my website into an e-commerce website?

Thanks in advance guys!  :)


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



[PHP] Image Border Help

2003-06-19 Thread Nilaab Y.
Hey guys,

I want to know how I can add different border styles around an image.
Here's what I do to create an image:

function output_new_img () {

$new = $this-calc_new_size ($this-max_w, $this-max_h);
$new_w = $new[0];
$new_h = $new[1];

$src_img = ImageCreateFromJPEG ($this-temp_img);
$dst_img = ImageCreateTrueColor ($new_w, $new_h);
ImageCopyResampled ($dst_img, $src_img, 0, 0, 0, 0, $new_w, $new_h,
ImageSX($src_img), ImageSY($src_img));

if (ImageJPEG($dst_img, $this-dst_path . $this-img_name, 95)) {
return true;
}
}

Now, what I want to do is draw a border style around that certain image. The
border can be different widths. It can either be created outside the borders
of the image, or on the inside of the borders of the image, I need to have
it both ways. Since this is a .jpg file being created, I want to do this
while I'm creating this image before it saves it to file. The reason for
this is that a *.jpg image compresses itself each time it is saved, which
results in poor quality the more you change it and save it.

Now to the question. Which combinations of image functions do I need to
achieve this goal? And how will each of these functions help me. For
example, will a certain function overlap a border style on top of the image
itself? Or does a certain function just draw lines around the image. Just
need an explaination of why I must use a certain function that any of you
would recommend. I think maybe Jason Wong would be a good candidate to
answer this one for me. He's good at pointing out references. I just need a
starting point and some suggestions on the different ways to achieve my
goal.

Thanks guys...


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



RE: [PHP] WYSIWIG CMS Part1

2003-02-10 Thread @ Nilaab
I really really like the idea of using XML/XSLT for creating future CMS
Apps. XML is simply a good way to manage and share content between different
companies, etc. Those that are not too familiar with XML, should try and
read a little bit on the advantages of it. It is the next generation markup
language that many major players support. It's more flexable than HTML/XHTML
and less difficult than SGML.

 -Original Message-
 From: Kevin Waterson [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 10, 2003 6:27 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] WYSIWIG CMS Part1


 This one time, at band camp,
 Hardik Doshi [EMAIL PROTECTED] wrote:


  THe stuff which you are doing with XSLT and XML is
  pretty same like Smarty template engine? What is the
  advantage of using XML, XSLT than Smarty template
  engine?

 Well basically, Smarty is gay.
 Smarty supposedly will seperate code from content.
 but you have still need to markup to able to handle loops,
 conditions etc which puts code right back into the content.
 But it is Smarty code and not PHP code, where is the value in that?
 The pre-supposition is of course that html designers are idiots when
 what is really needed is to teach them some basics about PHP rather
 than introducing an entire new (Smarty) concept.
 Of course when you build an application with Smarty you get to
 use buzzwords like multi-tiered, but this slows you down.

 The extensive use of regex within the application cannot be a
 good thing. The use of tags such as {foobar} could easily be replaced
 by ?=$foobar;? or ?php echo $foobar; ? and most every thing else
 is easily handled with file_get_contents() include() or eval()
 I am not saying Smarty is a worthless piece of dog shit, quite, I just
 feel it create unneccessary overhead without delivering true seperation
 of code and content.

 The XML way I am implementing also does not achieve this, and
 does not make any claim to
 it mearly makes the information available to many applications which
 can format or do with whatever the programmer wants. Example...
 If I have a news
 script with the output
 root
  news
nid24/nid
news_headlineSmarty is dead/news_headline
news_storyPeople finally wake up/news_story
  /news
 /root

 Now other applications can snarf this information readily. So you
 can do something
 like a news headlines block on the side of your page ala
 freshmeat. just take the
 rootnewsnews_headline in a xsl:foreach and you have it.
 This can be done
 application using xml.

 So anyhow, just my $0.02
 Try Smarty, try other template solutions, roll your own, or find
 the solution that
 best fits your needs. There is no ultimate Template Engine or
 application. It really
 is horses for courses.

 enjoy
 Kevin

 --
  __
 (_ \
  _) )           
 |  /  / _  ) / _  | / ___) / _  )
 | |  ( (/ / ( ( | |( (___ ( (/ /
 |_|   \) \_||_| \) \)
 Kevin Waterson
 Port Macquarie, Australia

 --
 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] WYSIWYG Content Management system?

2003-02-06 Thread @ Nilaab
Why don't you two gather up a few more developers, decide on what is needed
and what the goals are, then assign parts to build for the new CMS. Once
finished, you can maybe present it to PHP.net and see if they will allow it
to be developed and documented in the future by other developers. A CMS is a
very important and popular prog, so it might get the same attention as basic
templates get, like SMARTY. Who knows, maybe it can even be integrated with
SMARTY too, and/or other PHP programs still out there. This might yield one
of the best CMS out there in the PHP world, which can constantly be
developed. There's my two cents, good luck...



 -Original Message-
 From: Sascha Braun [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 05, 2003 7:01 PM
 To: PHP General list; Hardik Doshi
 Subject: Re: [PHP] WYSIWYG Content Management system?


 I am working on such a CMS right yet.

 I want to implement infinitly Language Support and an Wordpad
 like HTML Editor which allows you to chose basic design tem-
 plates and lets you upload some images.

 I want to build an extraordinary Usermanagement, where you can
 write parts of an Text while somebody else is writing on another
 Part of the same text maybe in different language at the same Time.

 When you wrote a text you can chose between your mates for
 let them make the translation based on userprofiles every web-
 content admin has to fill out.

 And a lota more things, but right now i dont have very much time,
 I have to build a small shop inbetween. But the Multilanguage sup-
 port ist basically finished.

 But I may say some more, have you ever read about the execCommand
 in IE (Internet Explorer)? You can build an fully working wysiwyg HTML
 Editor with these commands. I'm going to send you a nice example after-
 wards Hardik.

 Maybe somebody wants to help me with the CMS System. I dont really
 like the Design of PHPNuke and I want to build an even more professional
 Article Management than it is developed in phpnuke.

 See Ya

 Sascha

 - Original Message -
 From: Hardik Doshi [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, February 05, 2003 3:32 PM
 Subject: Re: [PHP] WYSIWYG Content Management system?


 
  Hey Jason,
  I am looking for the same. Do you have or any one in this list has any
 idea? Please let me know.
  thanks
  Hardik
   Jason Wong [EMAIL PROTECTED] wrote:On Wednesday 05
 February 2003
 09:43, J J wrote:
   I've seen CMS systems like phpnuke but it's kind of
   overkill for what I need and almost more news like.
   I'm looking for something that would allow the user to
   change content, change/upload images, all in a wysiwyg
   style so it's easy to see and use.
  
   It'd be cool to be able to login to the admin area,
   select a page to edit, and it would allow you to
   preview the page just like it looks. Then you click
   on a text area or image you want to update.
  
   Is there a CMS that allows for WYSIWYG like editing
   but will work within specified headers/footers, style
   sheets, etc? Then the site content would all be
   generated on the fly from php/mysql.
 
  All the major/popular ones would/should have been registered at
 freshmeat
 and
  soureforge so check them out.
 
  --
  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-general
  --
  /*
  You're already carrying the sphere!
  */
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
  -
  Do you Yahoo!?
  Yahoo! Mail Plus - Powerful. Affordable. Sign up now


 --
 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] In Need of a PHP freelancer...

2003-02-05 Thread @ Nilaab
You can also try the following site. It is loaded with freelance developers
who are sitting there waiting for requests like yours.

http://webhostingtalk.com/forumdisplay.php?s=deff1e6ceaa5f13e400bfefc1702a2f
cforumid=33

 -Original Message-
 From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 04, 2003 3:14 PM
 To: Shane; [EMAIL PROTECTED]
 Subject: Re: [PHP] In Need of a PHP freelancer...


 -Original Message-
 Greetings... I am in need of a freelancer to write an additional
 function to our company's extranet. Before I go and post a
 request to this list, I would like to know if there is
 a more appropriate place to post such a request, and still
 get quality folks who know their stuff.

 This is probably the best place, assuming you need a PHP function.. :)

 I'd be interested, also, if you want to send more details offlist.

 ---John Holmes...



 --
 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] MySQL/PHP Associative Array Insert

2003-02-01 Thread @ Nilaab
Yes Chris,

When you add the item to the database, make sure to leave out the single
quotes inside the brackets of the associative array. For example:

Instead Of:
$item['itemID']

Do This:
$item[itemID]

Example Query:
$query = SELECT * FROM items WHERE '$item[itemID]';

Hope that helps.

 -Original Message-
 From: CDitty [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, February 01, 2003 10:26 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] MySQL/PHP Associative Array Insert


 A co-worker is teaching me to move to the next level in php. I have
 started using associative arrays for my scripts, but I am having a problem
 using them to do an insert into MySQL. Can someone give me an example of
 how to do an insert to the database using these arrays? My array is
 this...$item['itemID']

 Thanks
 Chris



 --
 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] MySQL/PHP Associative Array Insert

2003-02-01 Thread @ Nilaab
Oops, I forgot the double quotes at the end of the example query from the
last email.
This is how it should be:

Example Query:
$query = SELECT * FROM items WHERE '$item[itemID]';





 -Original Message-
 From: @ Nilaab [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, February 01, 2003 1:00 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] MySQL/PHP Associative Array Insert


 Yes Chris,

 When you add the item to the database, make sure to leave out the single
 quotes inside the brackets of the associative array. For example:

 Instead Of:
 $item['itemID']

 Do This:
 $item[itemID]

 Example Query:
 $query = SELECT * FROM items WHERE '$item[itemID]';

 Hope that helps.

  -Original Message-
  From: CDitty [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, February 01, 2003 10:26 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] MySQL/PHP Associative Array Insert
 
 
  A co-worker is teaching me to move to the next level in php. I have
  started using associative arrays for my scripts, but I am
 having a problem
  using them to do an insert into MySQL. Can someone give me an example of
  how to do an insert to the database using these arrays? My array is
  this...$item['itemID']
 
  Thanks
  Chris
 
 
 
  --
  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




[PHP] Good way to organize code using classes???

2003-01-27 Thread @ Nilaab
Hello everyone,

I want to be able to use objects to create my future pages. My goal is to
use methods of classes to make the original front-line script easier to
read, while all the processing is done with a simple call to the different
classes from a single class. Please read futher, as I'll get to a point and
to my question...

I have many classes that do different tasks, like formValidator.class,
stringManipulator.class, db.class, fileManipulation.class, template.class,
etc (these are self-explanitory as their names suggest). Then, I might have
a class called category.class that adds, deletes, edits, moves, and renames
categories within the filesystem and database. But I would have a front-line
script called category.php that would call the necessary methods of
category.class at certain points, depending on the task being done on a
specific step.

In other words I want category.class to call the other classes and do
something with them, then in turn I want category.php to call objects in
category.class for a specific task, such as:

?php

// category.php

include (category.class);
$cat = new category ();
$cat-addCategory($new_cat_name);
// or
$cat-editCategory($cat_name);
// or
$cat-deleteCategory($cat_name);
// or
$cat-moveCategory($cat_name);
// or
$cat-renameCategory($cat_name);

?


My question is:

How can I call a class within another class and do something with it? Right
now I'm doing it the most convenient way I know, which is including other
classes using the include() function within the methods of the
category.class. There is no multiple-inheritance allowed in PHP, so I can
only use inheritance on one class.

I am also extremely skeptical about creating too many classes at a time in
one script. Do the above examples degrade performance speed of the script
when I call too many classes? Also, isn't there a way to use sessions to
save created classes and then use them again for other scripts without the
need to make a new instance of the same class again and again?

I am really looking for a better way to organize my code while still being
able to use these classes whenever I need them and at the same time keeping
the category.php file clean and easy to read. Is there a tutorial on how to
organize code? I'm not looking for html template tutorials. Just how to get
around inheritance limits while still keeping performance and clean-code in
mind.

Here's an example of what category.class might look like:

?php

// category.class
include (base_db.class);
class category extends base_db {

   function addCategory {
include (fileManipulation.class);
include (formValidator.class);
include (stringManipulator.class);

// Manipulate Inputted Category String
$strMan = new stringManipulator();
$strMan-formatCat($new_cat_name);

// Validate Form Values
$formVal = new formValidator();
$formVal-addCatVal($new_cat_name);

// Add A Folder To Hold Category Files
$file = new fileManipulator();
$file-createFolder($cat_path.$cat_dir);

// And so on...
   }
}





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




[PHP] Predefined Variables In Classes

2003-01-26 Thread @ Nilaab
Hello Everyone,

I am a little confused. Why do predefined variables like $PHP_SELF or
$DOCUMENT_ROOT not process within a class, in the methods secifically. For
example:

?php
class someClass {

   function someFunction () {
$root = $DOCUMENT_ROOT;
return $root;
   }

   function someFunction2 () {
$path = $this-someFunction() . $PHP_SELF;
return $path;
   }
}
?

I just threw this together to give you an example of how I might be using
these two predefined variables in a class. The problem is that
$DOCUMENT_ROOT or $PHP_SELF won't parse or something. It just returns blank.

It is included in another page when needed, say somePage.php. Shouldn't
$PHP_SELF recognize the somePage.php as the current running script file, as
opposed to the class file where these two functions are called? If it
doesn't work that way then how do I do this without sending predefined
variable parameters to these functions?

Please note that register globals is on. I could not find any documentation
on this on php.net. Maybe someone can give me a hint of point it out for me
on the documentation. Thanks.


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




RE: [PHP] Predefined Variables In Classes

2003-01-26 Thread @ Nilaab
Well, I don't think this has anything to do with predefined variables being
global or not because I only have use for them within the specific methods.
The methods will capture their values and assign them to a variable inside
the function, which will return that variable at the end. The processing of
$PHP_SELF and $DOCUMENT_ROOT only happens in one place. I might be wrong,
not sure. But right now all I know is that I am confused and the link you
sent me didn't help explain what I need to know because it states no mention
of predefined variables. Can you perhaps give me an example of what you are
trying to tell me?

I read about variable scope and it says nothing about predefined variables.
So how will using the $_SERVER associate array help me with this? Remember
that globals is on, so I don't need to use $_SERVER, $_POST, $_GET, etc. to
get my values. But, in the meantime I'll go ahead and try using the
associate autoglobal arrays anyway, like $_SERVER, just to test it and to
see if it works for me. And if it does, it'll bug me until I find out why it
works. Thanks your input Philip. If anyone else has any thoughts or
explainations for me to understad this then that would be great.


Read:
  http://www.php.net/variables.scope

Also note that $_SERVER is an autoglobal.

Regards,
Philip

 -Original Message-
 From: @ Nilaab [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, January 26, 2003 1:46 PM
 To: Php-General
 Subject: [PHP] Predefined Variables In Classes


 Hello Everyone,

 I am a little confused. Why do predefined variables like $PHP_SELF or
 $DOCUMENT_ROOT not process within a class, in the methods secifically. For
 example:

 ?php
 class someClass {

function someFunction () {
   $root = $DOCUMENT_ROOT;
   return $root;
}

function someFunction2 () {
   $path = $this-someFunction() . $PHP_SELF;
   return $path;
}
 }
 ?

 I just threw this together to give you an example of how I might be using
 these two predefined variables in a class. The problem is that
 $DOCUMENT_ROOT or $PHP_SELF won't parse or something. It just
 returns blank.

 It is included in another page when needed, say somePage.php. Shouldn't
 $PHP_SELF recognize the somePage.php as the current running
 script file, as
 opposed to the class file where these two functions are called? If it
 doesn't work that way then how do I do this without sending predefined
 variable parameters to these functions?

 Please note that register globals is on. I could not find any
 documentation
 on this on php.net. Maybe someone can give me a hint of point it
 out for me
 on the documentation. Thanks.


 --
 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] Predefined Variables In Classes

2003-01-26 Thread @ Nilaab
John,

YES! That's what I was looking for. Thanks for the explaination. It helps a
great deal. I had $_SERVER['DOCUMENT_ROOT'] work for me. But I'm still
struggling with $_SERVER['PHP_SELF'], because it's not returning anything.

So here's the second part to my question stated earlier. Let's say, for
example, I had a class included in someFile.php. The included class looks
like the class below:

?php
class someClass {

   function someFunction () {
$root = $_SERVER['DOCUMENT_ROOT'];
return $root;
   }

   function someFunction2 () {
$path = $this-someFunction() . $_SERVER['PHP_SELF'];
return $path;
   }
}
?

Shouldn't the value of $_SERVER['PHP_SELF'] contain the path of someFile.php
and not the path of the class file which was included in someFile.php? Or
what should this value be? I want the $_SERVER['PHP_SELF'] value to be
/path/someFile.php, or the value of whatever page included this class file
and called the methods of the class. How would I do that? Because right now
it returns a blank string.



 -Original Message-
 From: John W. Holmes [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, January 26, 2003 3:37 PM
 To: '@ Nilaab'; 'Php-General'
 Subject: RE: [PHP] Predefined Variables In Classes


  Well, I don't think this has anything to do with predefined variables
  being
  global or not because I only have use for them within the specific
  methods.
  The methods will capture their values and assign them to a variable
 inside
  the function, which will return that variable at the end. The
 processing
  of
  $PHP_SELF and $DOCUMENT_ROOT only happens in one place. I might be
 wrong,
  not sure. But right now all I know is that I am confused and the link
 you
  sent me didn't help explain what I need to know because it states no
  mention
  of predefined variables. Can you perhaps give me an example of what
 you
  are
  trying to tell me?

 Predefined or not, it's still a variable. If you want a variable inside
 of your function to have the value of a variable outside of your
 function, then you have to make it global. $PHP_SELF inside of your
 function has no value because it's relative to the function, not the
 script. Just like $a inside of a function wouldn't have a value unless
 you assigned one to it. Using global $PHP_SELF at the beginning of
 your function (or method, same thing) will now make the variable
 $PHP_SELF have the same value as it does outside of your function.

  I read about variable scope and it says nothing about predefined
  variables.
  So how will using the $_SERVER associate array help me with this?
 Remember
  that globals is on, so I don't need to use $_SERVER, $_POST, $_GET,
 etc.
  to
  get my values. But, in the meantime I'll go ahead and try using the
  associate autoglobal arrays anyway, like $_SERVER, just to test it and
 to
  see if it works for me. And if it does, it'll bug me until I find out
 why
  it
  works. Thanks your input Philip. If anyone else has any thoughts or
  explainations for me to understad this then that would be great.

 $_SERVER['PHP_SELF'] will always work, regardless of variable scope or
 register_globals setting. The $_SERVER array is a superglobal, so it'll
 have the same value inside your method or outside of it, without you
 having to do anything special.

 Hope that helps.

 ---John W. Holmes...

 PHP Architect - A monthly magazine for PHP Professionals. Get your copy
 today. http://www.phparch.com/



 --
 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] Predefined Variables In Classes

2003-01-26 Thread @ Nilaab
Nevermind John, it worked! I had $_SERVER['PHP_SELF'] spelled as
$SERVER['PHP_SELF']. I appreciate your help!  :P

 -Original Message-
 From: @ Nilaab [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, January 26, 2003 4:01 PM
 To: Php-General
 Subject: RE: [PHP] Predefined Variables In Classes


 John,

 YES! That's what I was looking for. Thanks for the explaination.
 It helps a
 great deal. I had $_SERVER['DOCUMENT_ROOT'] work for me. But I'm still
 struggling with $_SERVER['PHP_SELF'], because it's not returning anything.

 So here's the second part to my question stated earlier. Let's say, for
 example, I had a class included in someFile.php. The included class looks
 like the class below:

 ?php
 class someClass {

function someFunction () {
   $root = $_SERVER['DOCUMENT_ROOT'];
   return $root;
}

function someFunction2 () {
   $path = $this-someFunction() . $_SERVER['PHP_SELF'];
   return $path;
}
 }
 ?

 Shouldn't the value of $_SERVER['PHP_SELF'] contain the path of
 someFile.php
 and not the path of the class file which was included in someFile.php? Or
 what should this value be? I want the $_SERVER['PHP_SELF'] value to be
 /path/someFile.php, or the value of whatever page included this class file
 and called the methods of the class. How would I do that? Because
 right now
 it returns a blank string.



  -Original Message-
  From: John W. Holmes [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, January 26, 2003 3:37 PM
  To: '@ Nilaab'; 'Php-General'
  Subject: RE: [PHP] Predefined Variables In Classes
 
 
   Well, I don't think this has anything to do with predefined variables
   being
   global or not because I only have use for them within the specific
   methods.
   The methods will capture their values and assign them to a variable
  inside
   the function, which will return that variable at the end. The
  processing
   of
   $PHP_SELF and $DOCUMENT_ROOT only happens in one place. I might be
  wrong,
   not sure. But right now all I know is that I am confused and the link
  you
   sent me didn't help explain what I need to know because it states no
   mention
   of predefined variables. Can you perhaps give me an example of what
  you
   are
   trying to tell me?
 
  Predefined or not, it's still a variable. If you want a variable inside
  of your function to have the value of a variable outside of your
  function, then you have to make it global. $PHP_SELF inside of your
  function has no value because it's relative to the function, not the
  script. Just like $a inside of a function wouldn't have a value unless
  you assigned one to it. Using global $PHP_SELF at the beginning of
  your function (or method, same thing) will now make the variable
  $PHP_SELF have the same value as it does outside of your function.
 
   I read about variable scope and it says nothing about predefined
   variables.
   So how will using the $_SERVER associate array help me with this?
  Remember
   that globals is on, so I don't need to use $_SERVER, $_POST, $_GET,
  etc.
   to
   get my values. But, in the meantime I'll go ahead and try using the
   associate autoglobal arrays anyway, like $_SERVER, just to test it and
  to
   see if it works for me. And if it does, it'll bug me until I find out
  why
   it
   works. Thanks your input Philip. If anyone else has any thoughts or
   explainations for me to understad this then that would be great.
 
  $_SERVER['PHP_SELF'] will always work, regardless of variable scope or
  register_globals setting. The $_SERVER array is a superglobal, so it'll
  have the same value inside your method or outside of it, without you
  having to do anything special.
 
  Hope that helps.
 
  ---John W. Holmes...
 
  PHP Architect - A monthly magazine for PHP Professionals. Get your copy
  today. http://www.phparch.com/
 
 
 
  --
  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




RE: [PHP] Transition Page?

2003-01-26 Thread @ Nilaab
Hello Lee  :)

Well, there is one way that I know of that some people might overlook. What
you can do is use CSS positioning and set the Uploading Now message
(Whether it's text, an image, a flash file, etc.) BEHIND the result page by
setting the z-index value of the Uploading Now message to a lower number
than the z-index of the result page.

So what happens in this case is that the user will see the Uploading Now
message until the other page or image loads, which will automatically load
on top of the message, therefore hiding it once it's loaded. This works
great with images especially. You may need to use some positioning
creativity to do the same with the html pages, as you have to find a way to
be able to hide the transition message (by another image, a colored table,
or just about anything else.

The good thing about this method is that you never need to create an extra
file just to display the message. You can use it in the same file. Or if you
have to use it on many pages, just include it from an include file or a
function or something. Lots of room for creativity here.

Anyway, that's how I would do it. I'm sure there are many other great ways.
But there's my input. Hope it helps you a little.

 -Original Message-
 From: Lee Herron [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, January 26, 2003 6:05 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Transition Page?


 I'm interested in how most would create a transition page..

 I have an upload process that takes a bit before it changes the page
 displayed on the browser.  I would like to create a transition page
 [Uploading Now .. please standby] that would refresh to a result page once
 the upload is done.  Now I've seen this done on other sites
 (loading pages)
 and I'm sure there are many ways to do this, just looking for methods and
 pro/cons to the various approaches.

 thanks..





 --
 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] I'm new in PHP

2003-01-26 Thread @ Nilaab
Beogradjanin,

In addition to Philip's links, don't forget that PHP works great with the
MySQL database. If you plan to use MySQL, then go to the following for great
tutorials:

http://www.mysql.com

Remember, PHP can be as creative as you want to be. If you need any help
with anything else, please feel free to come here and ask again.

P.S. -- Philip, thanks for helping out the newbies.
PHP will continue to grow better and bolder thanks to you and others.


 -Original Message-
 From: Philip Olson [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, January 26, 2003 7:05 PM
 To: Beogradjanin
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] I'm new in PHP


 On Sun, 26 Jan 2003, Beogradjanin wrote:

  Zdravo php-general,
 
Hi I have setup PHP Apache MySql.
I;m new in this stuff where can I learn hot to make web pages in
PHP...???

 Go here:

   Learn HTML
   http://www.w3schools.com/html/

   Learn SQL
   http://www.w3schools.com/sql/
   http://www.sqlcourse.com/

   Learn PHP
   http://www.faqts.com/knowledge_base/view.phtml/aid/2836/fid/51
   http://www.php.net/manual/
   http://www.php.net/links.php

 Regards,
 Philip


 --
 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] Form Validating Class (OOP misunderstandings...)

2003-01-21 Thread @ Nilaab
Nicholas,

I think I know where you found this code. I have the same code, except I
modified it a little to work for me. You may need to change it for your
needs. When I first used it, it didn't work. I had to modify it to make it
work. My code is usually kind of sloppy, but maybe you would get better use
of the following class:

?php

class FormValidator {

var $_errorList;


function FormValidator() {
   $this-resetErrorList();
}


function isEmpty($field, $msg) {
   if (trim($field) == ) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return true;
   } else {
  return false;
   }
}


function isZero($field, $msg) {
   if($field == 0) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return true;
   } else {
  return false;
   }
}


function isUploadedFile($img, $img_type, $img_size, $msg) {
   $pattern = /(pjpeg)$/;
   if (is_uploaded_file($img)  preg_match($pattern, $img_type) 
$img_size = 100) {
  return true;
   } else {
  $this-_errorList[] = array(value = $img, msg = $msg);
  return false;
   }
}


function isString($field, $msg) {
   if(!is_string($field)) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   } else {
  return true;
   }
}


function isNumber($field, $msg) {
   if(!is_numeric($field)) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   } else {
  return true;
}
}


function isInteger($field, $msg) {
   if(!is_integer($field)) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   } else {
  return true;
   }
}


function isFloat($field, $msg) {
   if(!is_float($field)) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   } else {
  return true;
   }
}


function isWithinRange($field, $msg, $min, $max) {
   if(!is_numeric($field) || $field  $min || $field  $max) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   } else {
  return true;
   }
}


function isStringWithinRange($field, $msg, $min, $max) {
   if(strlen($field)  $min || strlen($field)  $max) {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   } else {
  return true;
   }
}


function isAlpha($field, $msg, $special_chars=) {
   $pattern = /^[a-zA-Z\s . $special_chars . ]+$/;
   if(preg_match($pattern, $field)) {
  return true;
   } else {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   }
}


function isAlphaNum($field, $msg, $special_chars=) {
   $pattern = /^[a-zA-Z0-9\s . $special_chars . ]+$/;
   if(preg_match($pattern, $field)) {
  return true;
   } else {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   }
}


function isEmailAddress($field, $msg) {
   $pattern =
/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/;
   if(preg_match($pattern, $field)) {
  return true;
   } else {
  $this-_errorList[] = array(value = $field, msg = $msg);
  return false;
   }
}


function isError() {
   if (sizeof($this-_errorList)  0) {
  return true;
   } else {
  return false;
   }
}


function getErrorList() {
   return $this-_errorList;
}


function resetErrorList() {
   $this-_errorList = array();
}



}

?




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




[PHP] Passing Arrays Through Forms

2003-01-16 Thread @ Nilaab
Hello Everyone,

I've attempted this many times, but have failed to understand it each time.
I want to make it easier for myself to deal with passing variables through a
form. So I thought, why not use a single array variable to do that. If I do
such a thing, what steps do I need to take to ensure that the values in the
array are intact just as the user entered it? How do I serialize array data
from an initial form? Here's a simple example of what I might have:

form method=post action=some_page.php
   input type=text name=form_vars['firstname']/input
   input type=text name=form_vars['lastname']/input
   input type=text name=form_vars['address']/input
   input type=text name=form_vars['city']/input
   input type=text name=form_vars['state']/input
   input type=text name=form_vars['zip']/input
/form

Now, how do I ensure that the values in the associated array, that will be
sent over to some_page.php, are the values entered by the user? How do I
serialize this array from this form? Or if I cannot do that, what other
steps do I need to take to ensure the preservation of the values passed to
another page as an array?


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




RE: [PHP] class inside class

2003-01-13 Thread @ Nilaab
If these two classes are in separate files then you will need to include one
of the classes in with the other class using the include() or require()
functions. Have you also used the extends keyword to extend the main class?
When you use inheritance properties, you can use the $this- mechanism
within the classes to reference all functions of both classes. Read about
inheritance of classes for more information. If you already knew the above
and it doesn't help you, then just ignore it. I'm just trying to narrow down
your problem. Good luck.


 -Original Message-
 From: Michael Hall [mailto:[EMAIL PROTECTED]]
 Sent: Monday, January 13, 2003 12:20 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] class inside class


 --

 G'day:

 I am using a 'wrapper' class to create all the boilerplate HTML
 on a website,
 plus do stuff like authentication and print menus etc according
 to properties
 set dynamically within the class.

 The actual content of each page is generated by seperate
 'content' classes.
 These classes are 'embedded' within and instantiated within the
 wrapper class,
 but are otherwise independent of it.

 This system allows for something approaching a PHP object publishing
 application, which is where I'm heading.

 My problem is that now I need to get at the values of some wrapper class
 properties from within a content class: in other words, I need to
 access the
 dynamically assigned values of the properties of one class, from
 inside another
 class (which is embedded within the first, though I'm not sure
 that really
 matters).

 I can't use the $this- mechanism because the value is inside a different
 class.
 I can't use the first class's handle (eg $page , from $page = new
 WebPage())
 because the embedded class doesn't know about it.
 I have been playing around with declaring globals, and with PHP's
 class/object
 functions, but have got nowhere yet.


 Is this possible, and if so, does anyone have any pointers? Hope
 my description
 of the problem makes sense.

 TIA
 Mick

 
 MICHAEL HALL Web Development Officer
 Batchelor Institute of Indigenous Tertiary Education
 W: [EMAIL PROTECTED](08) 8951 8352
 H: [EMAIL PROTECTED](08) 8953 1442
 

 --
 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 Delete Multiple Items Of Multiple Tables Using PHP and MySQL

2003-01-01 Thread @ Nilaab
Jason, thanks, but see if you can you read the initial question and try to
answer that one for me. You are a great help with resources when I need
them. Your help is always appreciated. The origial clip is as follows
(concentrate on the ending question):



Hello Everyone,

I want to DELETE multiple items of multiple TABLES in a MySQL database. My
version of MySQL is 3.23, which means this version doesn't support the
DELETE functionality on multiple tables. The following is my PHP code, where
$item_id is a multi-dimensional array containing the ids of the many items I
want to delete from the table.

   # DELETE records
   for ($i = 0; $i  count($item_id); $i++) {
 $query_item2 .=  DELETE QUICK FROM item_dimension WHERE item_id =
'.$item_id[$i][0].'; ;
 $query_item2 .= DELETE QUICK FROM item_popup WHERE item_id =
'.$item_id[$i][0].'; ;
   }

When I run this through the database using PHP, it returns a syntax error in
the SQL. So what I did was echo out $query_item2, then copied and pasted the
SQL into the MySQL application manually, and ran it through. Well the exact
same SQL statement that I used in PHP worked when I entered it manually in
MySQL. In other words it didn't work doing it through PHP, but it worked in
MySQL directly. What gives?

Is there a better way to delete multiple items
from multiple tables with one SQL string? I don't want to separate the two
DELETE functions and run them through two separate times because of overhead
concerns. I tried looking on the MySQL and PHP website for better ways of
using DELETE syntax on multiple tables, but I had no luck finding anything
useful with my version of MySQL. Any help would be greatly appreciated.



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




RE: [PHP] How To Delete Multiple Items Of Multiple Tables Using PHP and MySQL

2003-01-01 Thread @ Nilaab
Hey, that's right! I forgot about that. So here's what I did to fix my
problem. I separated everything and called the queries separately, except
this time I didn't call the mysql_close() function to close the connection
after each query. Initially I had called the mysql_close() on function I
made called db_connect(). This was a big no-no, as it would have put a big
strain on my application. I forgot that the connection closes itself after
the script ends.

Thanks Thomas, Stephen, Jason, and Tom Henry for all your help on this. I
greatly appreciate it.


 -Original Message-
 From: Thomas Seifert [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 01, 2003 6:29 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] How To Delete Multiple Items Of Multiple Tables Using
 PHP and MySQL


 there is no need to close and open the connection for every query.
 just run the mysql_query again and again and again on the open connection.
 Still Stephen's quote is true, you can't run more than one query
 by one call to mysql_query.


 Thomas

 On Tue, 31 Dec 2002 16:30:38 -0600 [EMAIL PROTECTED] (@ Nilaab) wrote:

  I was hoping for better news. Thanks for the suggestion, but it
 will put a
  very big strain on my application since every DELETE query will open and
  close the mysql connection everytime. Think about deleting 100s
 of records
  one at a time. Surely someone has thought of a better way to do
 this with
  MySQL 3.23. Also, I don't want to run persistent connections,
 as I only have
  a limited number of simultaneous connections to the database
 currently. Is
  there a better way to do all this? Anyone?
 
   -Original Message-
   From: Stephen [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, December 31, 2002 1:10 PM
   To: @ Nilaab
   Cc: PHP List
   Subject: Re: [PHP] How To Delete Multiple Items Of Multiple
 Tables Using
   PHP and MySQL
  
  
   From experience, I don't think you can run more then one SQL
 statement at
   once in a single time. Try assigning each variable with
 delete, then query
   them all seperately. I also don't think you need the ; in the SQL
   statement...
  
  
   - Original Message -
   From: @ Nilaab [EMAIL PROTECTED]
   To: Php-General [EMAIL PROTECTED]
   Sent: Tuesday, December 31, 2002 1:36 PM
   Subject: [PHP] How To Delete Multiple Items Of Multiple Tables
   Using PHP and
   MySQL
  
  
   : Hello Everyone,
   :
   : I want to DELETE multiple items of multiple TABLES in a MySQL
   database. My
   : version of MySQL is 3.23, which means this version doesn't
 support the
   : DELETE functionality on multiple tables. The following is
 my PHP code,
   where
   : $item_id is a multi-dimensional array containing the ids of
 the items I
   want
   : to delete from the table.
   :
   :# DELETE records
   :for ($i = 0; $i  count($item_id); $i++) {
   :  $query_item2 .=  DELETE QUICK FROM item_dimension
 WHERE item_id =
   : '.$item_id[$i][0].'; ;
   :  $query_item2 .= DELETE QUICK FROM item_popup WHERE item_id =
   : '.$item_id[$i][0].'; ;
   :}
   :
   : When I run this through the database using PHP, it returns a
   syntax error
   in
   : the SQL. So what I did was echo out $query_item2, then
 copied and pasted
   the
   : SQL into the MySQL application manually, and ran it
 through. Well the
   exact
   : same SQL statement that I used in PHP worked when I entered it
   manually in
   : MySQL. In other words it didn't work doing it through PHP,
 but it worked
   in
   : MySQL directly. What gives? Is there a better way to delete
   multiple items
   : from multiple tables with one SQL string? I don't want to
   separate the two
   : DELETE functions and run them through two separate times because of
   overhead
   : concerns. I tried looking on the MySQL and PHP website for
   better ways of
   : using DELETE syntax on multiple tables, but I had no luck
   finding anything
   : useful with my version of MySQL. Any help would be greatly
 appreciated.
   :
   :
   : --
   : 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



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




[PHP] How To Delete Multiple Items Of Multiple Tables Using PHP and MySQL

2002-12-31 Thread @ Nilaab
Hello Everyone,

I want to DELETE multiple items of multiple TABLES in a MySQL database. My
version of MySQL is 3.23, which means this version doesn't support the
DELETE functionality on multiple tables. The following is my PHP code, where
$item_id is a multi-dimensional array containing the ids of the items I want
to delete from the table.

   # DELETE records
   for ($i = 0; $i  count($item_id); $i++) {
 $query_item2 .=  DELETE QUICK FROM item_dimension WHERE item_id =
'.$item_id[$i][0].'; ;
 $query_item2 .= DELETE QUICK FROM item_popup WHERE item_id =
'.$item_id[$i][0].'; ;
   }

When I run this through the database using PHP, it returns a syntax error in
the SQL. So what I did was echo out $query_item2, then copied and pasted the
SQL into the MySQL application manually, and ran it through. Well the exact
same SQL statement that I used in PHP worked when I entered it manually in
MySQL. In other words it didn't work doing it through PHP, but it worked in
MySQL directly. What gives? Is there a better way to delete multiple items
from multiple tables with one SQL string? I don't want to separate the two
DELETE functions and run them through two separate times because of overhead
concerns. I tried looking on the MySQL and PHP website for better ways of
using DELETE syntax on multiple tables, but I had no luck finding anything
useful with my version of MySQL. Any help would be greatly appreciated.


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




RE: [PHP] How To Delete Multiple Items Of Multiple Tables Using PHP and MySQL

2002-12-31 Thread @ Nilaab
I was hoping for better news. Thanks for the suggestion, but it will put a
very big strain on my application since every DELETE query will open and
close the mysql connection everytime. Think about deleting 100s of records
one at a time. Surely someone has thought of a better way to do this with
MySQL 3.23. Also, I don't want to run persistent connections, as I only have
a limited number of simultaneous connections to the database currently. Is
there a better way to do all this? Anyone?

 -Original Message-
 From: Stephen [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 31, 2002 1:10 PM
 To: @ Nilaab
 Cc: PHP List
 Subject: Re: [PHP] How To Delete Multiple Items Of Multiple Tables Using
 PHP and MySQL


 From experience, I don't think you can run more then one SQL statement at
 once in a single time. Try assigning each variable with delete, then query
 them all seperately. I also don't think you need the ; in the SQL
 statement...


 - Original Message -
 From: @ Nilaab [EMAIL PROTECTED]
 To: Php-General [EMAIL PROTECTED]
 Sent: Tuesday, December 31, 2002 1:36 PM
 Subject: [PHP] How To Delete Multiple Items Of Multiple Tables
 Using PHP and
 MySQL


 : Hello Everyone,
 :
 : I want to DELETE multiple items of multiple TABLES in a MySQL
 database. My
 : version of MySQL is 3.23, which means this version doesn't support the
 : DELETE functionality on multiple tables. The following is my PHP code,
 where
 : $item_id is a multi-dimensional array containing the ids of the items I
 want
 : to delete from the table.
 :
 :# DELETE records
 :for ($i = 0; $i  count($item_id); $i++) {
 :  $query_item2 .=  DELETE QUICK FROM item_dimension WHERE item_id =
 : '.$item_id[$i][0].'; ;
 :  $query_item2 .= DELETE QUICK FROM item_popup WHERE item_id =
 : '.$item_id[$i][0].'; ;
 :}
 :
 : When I run this through the database using PHP, it returns a
 syntax error
 in
 : the SQL. So what I did was echo out $query_item2, then copied and pasted
 the
 : SQL into the MySQL application manually, and ran it through. Well the
 exact
 : same SQL statement that I used in PHP worked when I entered it
 manually in
 : MySQL. In other words it didn't work doing it through PHP, but it worked
 in
 : MySQL directly. What gives? Is there a better way to delete
 multiple items
 : from multiple tables with one SQL string? I don't want to
 separate the two
 : DELETE functions and run them through two separate times because of
 overhead
 : concerns. I tried looking on the MySQL and PHP website for
 better ways of
 : using DELETE syntax on multiple tables, but I had no luck
 finding anything
 : useful with my version of MySQL. Any help would be greatly appreciated.
 :
 :
 : --
 : 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




[PHP] How To Use The next() and prev() functions on multi-dimensional arrays

2002-12-26 Thread @ Nilaab
Hello Everyone,

I have a multi-dimensional array called $cat_data, and I need to access
certain elements in the array using the next() and prev() functions. I did
consider using loops like for, foreach, and while...but for this particular
application, I don't want to loop through the entire array. Also, I need
everything in that array, so no I don't want to limit the data drawn from
the database. I know the two above mentioned functions work with normal
arrays, but how would I make it work with multi-dimensional arrays? The
following is a little idea of the structure of the array:

$cat_data[$a][$b] where $a is the row number from the database, and $b is
the column being accessed.

$cat_data[0][0] = the first row of the id column.
$cat_data[0][1] = the first row of the name column.


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




[PHP] How To Get Last Item Of An Array?

2002-12-25 Thread @ Nilaab
Hello Everyone,

I have an multi-dimensional array called $cat_data, which is info extracted
from a MySQL DB. I want to retrieve the very last item of that array. How
would I do that? I know the first item can be retrieved by simply asking for
$cat_data[0][0], which contains an id number. But I can't figure out how to
get the last item in that same array -- $cat_data[x][0] where x is the last
item in the array.

P.S. - I read the section on Arrays at php.net, but unfortunately I didn't
find my answer there. I also checked my PHP books, no mention of my problems
there either.


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




[PHP] delete() and unlink()

2002-12-19 Thread @ Nilaab
Hello Everyone,

I'm using a test server on Windows XP. I have the following function (which
I got from the comment notes on php.net) that works wonders when deleting
directories that are not empty on a Windows system. But, I'm a bit confused.
I searched for the delete() function on php.net and it said that delete()
was not a real function, but a dummy manual entry for those who are actually
looking for the unlink() function. So then why does the delete() function
work in my script? I tried using the unlink() function in place of the
delete() function, but unlink() gave me many errors (possibly because of
permissions). Is there an error in the manual or is it just me? Is there a
difference in the two functions? Does the delete() function not care about
permissions as opposed to the unlink() function? This is really bugging me.
Can someone clear the air?

$c_dir = $DOCUMENT_ROOT/world/admin/backup2;  // current directory

function delete($dir) {
 if (file_exists($dir)) {
umask(0);
chmod($dir,0777);
   if (is_dir($dir)) {
 $handle = opendir($dir);
 while($dirname = readdir($handle)) {
   if ($dirname != .  $dirname != ..) {
delete($dir./.$dirname);
   }
 }
closedir($handle);
 rmdir($dir);
   } else {
unlink($dir);
   }
 }
}

delete ($c_dir);


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




RE: [PHP] delete() and unlink()

2002-12-19 Thread @ Nilaab
Thanks Jason,

That makes much more sense now. I forgot about recursive functions, as I
don't use them often. I should look into it further. It seems to be very
helpful in some cases. Thanks again for your help.

- Nilaab

 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 19, 2002 3:53 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] delete() and unlink()


 On Thursday 19 December 2002 17:39, [EMAIL PROTECTED] wrote:
  Hello Everyone,
 
  I'm using a test server on Windows XP. I have the following
 function (which
  I got from the comment notes on php.net) that works wonders
 when deleting
  directories that are not empty on a Windows system.

 Good.

  But, I'm a bit
  confused. I searched for the delete() function on php.net and
 it said that
  delete() was not a real function, but a dummy manual entry for those who
  are actually looking for the unlink() function.

 delete() is a dummy entry in the manual so people looking for
 said function
 will be directed to unlink() which is the correct function to use.

  So then why does the
  delete() function work in my script?

 delete() is undefined in php, that is why you can define your own
 function
 called delete().

  I tried using the unlink() function in
  place of the delete() function, but unlink() gave me many
 errors (possibly
  because of permissions).

 unlink() can only remove/delete directories that are empty.

  Is there an error in the manual or is it just me?

 There's no error in the manual (with regards to this subject). Probably a
 misunderstanding on your part.

  Is there a difference in the two functions? Does the delete()
 function not
  care about permissions as opposed to the unlink() function?
 This is really
  bugging me. Can someone clear the air?

 The delete() function as defined below is recursive and will
 automatically go
 inside non-empty directories and empty them first.

  $c_dir = $DOCUMENT_ROOT/world/admin/backup2;  // current directory
 
  function delete($dir) {
   if (file_exists($dir)) {
  umask(0);
  chmod($dir,0777);
 if (is_dir($dir)) {
   $handle = opendir($dir);
   while($dirname = readdir($handle)) {
 if ($dirname != .  $dirname != ..) {
  delete($dir./.$dirname);
 }
   }
  closedir($handle);
   rmdir($dir);
 } else {
  unlink($dir);
 }
   }
  }
 
  delete ($c_dir);

 To summarise -- there is no delete() function in php, the
 delete() function
 you're using is a user-defined function and as such will do
 whatever you can
 make it do.

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

 /*
 Garbage In -- Gospel Out.
 */


 --
 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] Need Redirection Trick...

2002-12-05 Thread @ Nilaab
Hello Everyone,

I have a simple problem that, I think, might require a little trick to be
used. I have a list of products in a database that is organized by
categories and subcategories. Categories can have as many subcategories as
it wants, but some categories don't need to have a subcategory at all.

In the following code cat refers to category and subcat refers to
subcategory.

cat_data and subcat_data refers to a multi-dimentional array, pulled from
the DB, with values of an id and a name.
example: cat_data[row_number][name_of_category] and
cat_data[row_number][id].

Ok, before I ask the question, here's the code:

[-- snip --]
?php
include (nay_general.php);
include ($include_path/base_db.class); // db

$db = new base_db();
$cat_data = $db-get_cat_data();
for ($i=0; $i  count($cat_data); $i++) {
   echo 'a href=' . $PHP_SELF . ?cat_id= . $cat_data[$i][id] . '' .
$cat_data[$i][name] . /abr /\n;
   if ($cat_id) {
  $subcat_data = $db-get_subcat_data($cat_id);
  if ($subcat_data != 0  ($cat_id == $cat_data[$i][id])) {
 for ($j=0; $j  count($subcat_data); $j++) {
echo 'nbsp;nbsp;nbsp;nbsp;- a href=' . $PHP_SELF .
?cat_id=$cat_idsubcat_id= . $subcat_data[$j][id] . '' .
$subcat_data[$j][name] . /abr /\n;
 }
  }
  elseif ($subcat_data == 0  ($cat_id == $cat_data[$i][id])) {
 $subcat_id = 0;
 header(Location: $PHP_SELF?cat_id=$cat_idsubcat_id=$subcat_id);
  }
   }
}

?
[-- snip --]

What this does is it lists all the categories in the database, initially.
When the user clicks on a category, the script will check if the category
has any subcategories associated with it. One of two things should happen
after this.

First, it should list all the subcategories directly below the category it
is associated with, with a little indention to specify that they are
subcategories. The subcategories listed will be a link that passes over the
cat_id and subcat_id GET variables to the same page.

example:category 1
category 2
   - subcategory 1
   - subcategory 2
   - subcategory 3
category 3
.
.
.

This part of the script works fine.

The second thing that should happen is that if there are actually no
subcategories for the selected category then subcat_id should equal 0 and
the script should redirect back to the same page with the GET variables of
cat_id and subcat_id (which is equal to zero at this point). The problem is
that I cannot redirect with a header() function because content is already
sent to the browser at the beginning of the script (the list of categories).
Is there any other way that I can redirect and send the variables of cat_id
and subcat_id to the page in the second situation mentioned earlier?
Register Globals is on.

- Nilaab



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




RE: [PHP] Need Redirection Trick...

2002-12-05 Thread @ Nilaab
Great Jason, thanks a lot. I was just looking for some direction and I think
you just helped me find it. Thanks for taking the time to look at my
problem.:)

- Nilaab

 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 05, 2002 11:46 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Need Redirection Trick...


 On Friday 06 December 2002 11:35, [EMAIL PROTECTED] wrote:
  Hello Everyone,

 [lots of irrelevant stuff snipped]

  The second thing that should happen is that if there are actually no
  subcategories for the selected category then subcat_id should
 equal 0 and
  the script should redirect back to the same page with the GET
 variables of
  cat_id and subcat_id (which is equal to zero at this point).
 The problem is
  that I cannot redirect with a header() function because content
 is already
  sent to the browser at the beginning of the script (the list of
  categories). Is there any other way that I can redirect and send the
  variables of cat_id and subcat_id to the page in the second situation
  mentioned earlier? Register Globals is on.

 1) BEFORE you output anything make your check whether you need to
 redirect.
 After all, if you're going to be redirecting, why output anything at all?

 or

 2) Use the output buffering functions.

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

 /*
 Do not drink coffee in early A.M.  It will keep you awake until noon.
 */


 --
 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] Show Folder Contents in Form

2002-12-02 Thread @ Nilaab
Here is a basic format for the select statement. All you have to do is take
the names of all the files and put them into an array, such as $filename[].
Then you place the file name between the option element using a for loop or
something similar. You will have to place a unique value that identifies
which file has been selected by using the value attribute of the option
element (which can be the same value as the array values if you want it to
be). When you press the submit button, you will have a variable called
$file_name (which was created from the name attribute of the select
element) and it will have the value of whatever option was selected from the
form. Then you can do whatever you want with the value found in $file_name.
Sorry, I'm too lazy to write the code tonight, but you have a basic
framework for what you need. Remember, the below is just pseudo-code, so
make sure you see that it cooperates with PHP by printing it out correctly,
adding the correct sets of quotes, etc. Then use a loop of some kind to list
the option data as you see fit.

If you have an array which has this:

$filename[0] = filename1.php;
$filename[1] = filename2.php;
$filename[2] = filename3.php;

select name=file_name
option value=$filename[0]$filename[0]/option
option value=$filename[1]$filename[1]/option
option value=$filename[2]$filename[2]/option
/select

So if the user picks option #2, he chose $filename[1], whose value is
filename2.php. After the user hits the submit button then $file_name equals
filename2.php and you can use that information however you need it. Hope
that didn't confuse you. If you need further help, please let me know. Good
luck...

- Nilaab




 -Original Message-
 From: Stephen [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 02, 2002 3:04 PM
 To: PHP List
 Subject: [PHP] Show Folder Contents in Form


 Hello,

 Is it possible, and if so how, to get the filenames and last edited
 time/date, then display them in a select field in a form for a user to
 select? I'd need to show them in order of most recently edited to last
 edited. How can this be done if it can?

 Thanks,
 Stephen Craton
 http://www.melchior.us

 Life is a gift from God. Wasting it is like destroying a gift
 you got from
 the person you love most. -- http://www.melchior.us




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




RE: [PHP] Multiple page form

2002-11-26 Thread @ Nilaab
Is there an actual way to store the data in a temporary table as you go
through the multi-page form and then extract that data from the temporary
storage from the DB App and either process the data or store it in a
permanent place?

I have never done this before, but maybe someone else has? Any tips on how
to do this, what type(s) of DB tables are required to do this and can you
give me an url to help me research it further?

I think this would be a great alternative to the sessions solution because
it doesn't work really well with some PHP error handling that you need to do
for the forms. You have to register and unregister variables throughout the
form and it gets hard to keep track of when you have so many forms and field
variables to deal with. With a temporary DB table, I can just insert any
data that has been checked for errors and then not have to worry about
passing them back and forth until the end of the application when I actually
need to do something with them.

- Nilaab



 -Original Message-
 From: Chris Boget [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, November 26, 2002 10:24 AM
 To: @ Edwin; Shane McBride
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Multiple page form


   Yes.  What's the point in taking the user's information if you aren't
   going to store it somewhere.  Even if all you need to do is email
   the data upon completion of the form, storing the data for later use
   would be a good idea.
  Not always. Are your users aware of this?
  Just wondering...

 Yes.
 Though, the later use I refer to is internal only.  We sell no data.

 Chris


 --
 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] Multiple page form

2002-11-26 Thread @ Nilaab
Oh, ok. That makes a lot more sense. Thanks for the info John   :)

- Nilaab

 -Original Message-
 From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, November 26, 2002 4:00 PM
 To: @ Nilaab; [EMAIL PROTECTED]
 Subject: Re: [PHP] Multiple page form


  Is there an actual way to store the data in a temporary table as you go
  through the multi-page form and then extract that data from the
 temporary
  storage from the DB App and either process the data or store it in a
  permanent place?
 
  I have never done this before, but maybe someone else has? Any
 tips on how
  to do this, what type(s) of DB tables are required to do this and can
 you
  give me an url to help me research it further?
 
  I think this would be a great alternative to the sessions
 solution because
  it doesn't work really well with some PHP error handling that
 you need to
 do
  for the forms. You have to register and unregister variables throughout
 the
  form and it gets hard to keep track of when you have so many forms and
 field
  variables to deal with. With a temporary DB table, I can just insert any
  data that has been checked for errors and then not have to worry about
  passing them back and forth until the end of the application when I
 actually
  need to do something with them.

 So don't add it to the session until you've verified the data.
 It's the same
 as using a temp table but you don't have to worry about the
 overhead of the
 database and you don't have to worry about cleanup with sessions.

 Also, a true TEMPORARY table will only be there for the current
 connection,
 so on the next page request, the table will be gone.

 ---John Holmes...



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




[PHP] Simple RegExp Problem...

2002-11-22 Thread @ Nilaab
Hello,

Ok, I know this is easy for most of you, and believe me I've been searching
and trying to learn all about regular expressions, but I can't seem figure
out how to allow addition of spaces between characters.

$text = Here is some text;

Here, I want to be able to match the alpha characters as well as the spaces
in between each word. So far I have:

preg_match(/^[a-zA-Z]+$/, $text);

But that only matches a single word without spaces. I would like to try to
stay away from ereg and use preg_match instead because I heard preg_match is
faster. ereg() has a way to match spaces by specifying [[:space:]], but I
didn't get that solution to work either. How do I match $text to return
true?

- Nilaab


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




RE: [PHP] How do I initialize a page to do something ONCE

2002-11-22 Thread @ Nilaab
The variable $initialize contains int(1), so it does set itself within the
last if statement. I'm just not sure why it's not unsetting all the sessions
when the page loads.

- Nilaab

 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 22, 2002 2:36 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] How do I initialize a page to do something ONCE


 On Friday 22 November 2002 07:26, [EMAIL PROTECTED] wrote:
  Hello,
 
  I have a newbie problem. I have an php page that has many
 layers of forms
  to it. Once the user is finished with filling out one form and
 sending it,
  another form appears. This is of course done using simple
 if-else or switch
  statements. The problem is, how do I initialize a function or any other
  type of process just ONCE for the entire page. I don't want the
 function or
  process to run everytime a new form is displayed. Keep in mind that I'm
  also using sessions for this. Here is a tiny stripped-down
 example, of my
  failed attempt, that might help you analyze my question:
 
  session_start();
 
  if(!isset($initialize)) {
 $start_over = 1;
  }

  if ($start_over == 1) {
 $temp_log = $logged_in;
 session_unset();
 $logged_in = $temp_log;
 $initialize = 1;
 session_register(logged_in, initialize);
  }

  There is the code/pseudo-code combination of what I have so
 far. The only
  problem is that it is not processing the second if block --
 if($start_over
  == 1) -- unless I actually set start_over=1 in the get string.
 How would I
  make sure that the page processes everything in that if block only ONCE
  after the page first loads? Also, if anyone knows a better way of
  displaying one form after another in on a single php page, I'm
 open to any
  ideas.

 OK, the only reason why the 2nd  IF block is not executed is if
 $initialize is
 not empty (ie isset($initialize) is TRUE hence $start_over = 1 is never
 executed). So try:

  if(!isset($initialize)) {
 $start_over = 1; }
  else {
var_dump($initialize); // to see what the  it contains
  }


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

 /*
 My BIOLOGICAL ALARM CLOCK just went off ... It has noiseless DOZE
 FUNCTION and full kitchen!!
 */


 --
 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] Simple RegExp Problem...

2002-11-22 Thread @ Nilaab
Thanks so much!!! It works. I didn't know I could also place extra
characters inside the brackets to specify what I want.  :)

 -Original Message-
 From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 22, 2002 7:19 AM
 To: @ Nilaab
 Cc: Php-General
 Subject: Re: [PHP] Simple RegExp Problem...


 At 13:38 22.11.2002, @ Nilaab spoke out and said:
 [snip]
 Ok, I know this is easy for most of you, and believe me I've
 been searching
 and trying to learn all about regular expressions, but I can't
 seem figure
 out how to allow addition of spaces between characters.
 
 $text = Here is some text;
 
 Here, I want to be able to match the alpha characters as well as
 the spaces
 in between each word. So far I have:
 
 preg_match(/^[a-zA-Z]+$/, $text);
 
 But that only matches a single word without spaces. I would like
 to try to
 stay away from ereg and use preg_match instead because I heard
 preg_match is
 faster. ereg() has a way to match spaces by specifying [[:space:]], but I
 didn't get that solution to work either. How do I match $text to return
 true?
 [snip]

 use
 preg_match('/^[a-zA-Z\s]+$/', $text);

 \s - any [:space:]
 \S - anything not [:space:]


 --
O Ernest E. Vogelsinger
(\) ICQ #13394035
 ^ http://www.vogelsinger.at/



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




RE: [PHP] Simple RegExp Problem...

2002-11-22 Thread @ Nilaab
Thanks again Ernest! This will be extremely helpful to me in the near
future.

- Nilaab

 -Original Message-
 From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 22, 2002 3:23 PM
 To: @ Nilaab
 Cc: Php-General
 Subject: RE: [PHP] Simple RegExp Problem...


 At 21:59 22.11.2002, @ Nilaab said:
 [snip]
 Thanks so much!!! It works. I didn't know I could also place extra
 characters inside the brackets to specify what I want.  :)
 [snip]

 The square brackets simply form a group of characters that are either
 allowed ('[abc]') or not allowed ('[^abc]').

 Instead of specifying '/[a-zA-Z]/' you have also the option of saying
 '/[a-z]/i', the i modifier making the whole regex case independent.

 For deeper regex insights (esp. for the preg_xxx functions which I
 personally prefer) I suggest visiting the Perl docs at
 Doc:http://www.perldoc.com/perl5.8.0/pod/perlre.html
 QuickIntro: http://www.perldoc.com/perl5.8.0/pod/perlrequick.html
 Tutorial:   http://www.perldoc.com/perl5.8.0/pod/perlretut.html

 For the PHP guyz'n gals listening - I suggest these links making it into
 the PHP docs :)

 --
O Ernest E. Vogelsinger
(\)ICQ #13394035
 ^ http://www.vogelsinger.at/




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




RE: [PHP] How do I initialize a page to do something ONCE

2002-11-22 Thread @ Nilaab
Jason Wong and Larry Brown,

Nevermind, it's working now. Not sure how. I performed the same test many
times, but this time when I tried it, it worked. It might be that I manually
deleted the older session variables. I did read the notes on php.net for
session_unset(), very informative. Thanks to both of you for your help.  :)

- Nilaab

 -Original Message-
 From: Larry Brown [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 22, 2002 9:31 AM
 To: PHP List; @ Nilaab
 Subject: RE: [PHP] How do I initialize a page to do something ONCE


 Your first post stated..
  The only problem is that it is not processing the second if block --
 if($start_over == 1) -- unless I actually set start_over=1 in the get
 string.
 

 Your second sounds like it is executing the second block...

 The variable $initialize contains int(1), so it does set itself within
 the last if statement.

 If the second block is being executed...

 Did you check out php.net and the comments about session_unset()?

 If it is not, are you closing the browser between tests?  The session
 information stays open even after leaving the site and coming back.

 Larry S. Brown
 Dimension Networks, Inc.
 (727) 723-8388







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




RE: [PHP] HTML page and php

2002-11-21 Thread @ Nilaab
There are several ways you can do this.
The easiest way is to include the file like this:
include(path_for_html_file);
You can place this line wherever you need the html file included.
See the include() function on php.net for more info.

If, instead, you want to capture the html file and do something with it, you
can use the file functions listed on php.net. It might seem a little
difficult to grasp at first, but it will be very straightforward once you
get used to using these functions. Just search for FileSystem on php.net
and it will get you to the exact place you need to be to start learning
about how to deal with files. Here is the direct link, just in case:
http://www.php.net/manual/en/ref.filesystem.php. This site might also help
you: http://www.devshed.com. Have fun...

- Nilaab



 -Original Message-
 From: Martin Johansson [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, November 21, 2002 10:16 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] HTML page and php


 How do I get a html page into a string variable in php?
 Isnt there any function working like this:
 $homepage = getHtmlPage(c);

 /Newbie



 --
 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 do I initialize a page to do something ONCE

2002-11-21 Thread @ Nilaab
Hello,

I have a newbie problem. I have an php page that has many layers of forms to
it. Once the user is finished with filling out one form and sending it,
another form appears. This is of course done using simple if-else or switch
statements. The problem is, how do I initialize a function or any other type
of process just ONCE for the entire page. I don't want the function or
process to run everytime a new form is displayed. Keep in mind that I'm also
using sessions for this. Here is a tiny stripped-down example, of my failed
attempt, that might help you analyze my question:

session_start();

if(!isset($initialize)) {
   $start_over = 1;
}

// There were too many sessions to unregister,
// so I just used the session_unset() function and kept one necessary
session
// which is the login_id that is needed in order for the person to be able
to
// access this page, which they have gotten through authentication earlier:

if ($start_over == 1) {
   $temp_log = $logged_in;
   session_unset();
   $logged_in = $temp_log;
   $initialize = 1;
   session_register(logged_in, initialize);
}

if (!$submit1) {

.. Display first form

elseif (!$submit2  $submit1) {

.. Display second form

elseif (!$submit3  $submit1  $submit2) {

.. Display third form

elseif ($submit1  $submit2  $submit3) {

.. Add To Database
}


There is the code/pseudo-code combination of what I have so far. The only
problem is that it is not processing the second if block -- if($start_over
== 1) -- unless I actually set start_over=1 in the get string. How would I
make sure that the page processes everything in that if block only ONCE
after the page first loads? Also, if anyone knows a better way of displaying
one form after another in on a single php page, I'm open to any ideas.

Thanks,
- Nilaab


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




[PHP] How to unregister a single array item...

2002-11-20 Thread @ Nilaab
Hello,
How do I unregister a single array item from an array? For example:


session_start()
session_register(item);

$item['name'] = Some Name;
$item['img'] = some_image_name.jpg;
$item['desc'] = Some Description;
$item['price'] = 400;

// Now I want to get rid of the desc array item.
// I tried:

session_unregister(item[desc]);

// But that didn't work. However, I had some luck with:

unset($item['desc']);

// Is there another way?
// What is the best way to take this out of the session
// of the array that I registered above as $item?

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




[PHP] Be nice to newbies...

2002-11-18 Thread @ Nilaab
Hello to all,

I don't know about some of you, but I think PHP and the rest of the whole
open-source movement is the coolest thing in the world. I also personally
think it takes a lot of effort and courage to make a transition from
proprietory Windows Apps (Windows OS, SQL Server, IIS, VB, etc.), which
Microsoft pays an exaustive amount of money to keep people addicted to it,
to something like Linux/Apache/MySQL/PHP, or better known as LAMP, which is
almost a whole different world. For this reason, we need to be more lenient
toward newbies. I'm not trying to bring about a debate on Open Source vs
Microsoft, so let's not turn this into a bloody mess. I'm making use of the
best of both worlds when I can. It's like the saying, I like the product,
but I don't like the government behind the product.

The reason for this mail is because I've seen a lot of not-so-good-treatment
towards newbies recently, and this bad trend will grow and we will
eventually scare them away from even giving PHP a chance. There are nicer
ways to say, You big dummy, look in the archives and stop filling up my
mailbox with useless questions that have already been answered here before
(an exaggeration). If a newbie overlooked the documentation, put on a good
helpful face and point them to the URL that can help them. If it's not in
the documentation and it seems like a simple answer, don't belittle them
with snobbish remarks. Don't be mean. Mean people suck. One day these
newbies will be in your position and they might help you out with a
difficult problem.

Anyway, my two cents worth. And again, please don't turn this into a
debate...

- Nilaab


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




[PHP] Redirect Problem

2002-11-14 Thread @ Nilaab
Ok, I have a problem with the header() redirect function, below is the
part-code/part-pseudocode information. The file that this code is
encapsulated in is a single file named add_item.php. There is no output
before the header() function. Now this is a weird one, but I did some
testing and here is what happens:

If there are no rows returned, redirect browser to the same page with some
needed get variables. The problem is with the submit_cat=1 get variable
attached to the URL-to-be-redirected. When I take this out of the get
string, the script redirects the user just fine when the value of
$num_rows=0. I still need that variable to be sent so when I place the
submit_cat=1 variable back into the get string it takes you to the default
Apache error page entitled, Internal Server Error. Why is this submit_cat
variable causing me so much trouble?

?php

if (this) {
.
.
.
} elseif (something) {
.
.
.
} elseif (something_else) {

   if ($num_rows == 0) {
   header(Location:
$PHP_SELF?submit_cat=1submit_subcat=1cat_id=$cat_id);
   exit;
   } elseif ($num_rows != 0) {
   $row = $db-fetch_results($query);
.
.
.
   }
}

?

- Nilaab


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




[PHP]

2002-11-14 Thread @ Nilaab
Ok, I have a problem with the header() redirect function, below is the
part-code/part-pseudocode information. The file that this code is
encapsulated in is a single file named add_item.php. There is no output
before the header() function. Now this is a weird one, but I did some
testing and here is what happens:

If there are no rows returned, redirect browser to the same page with some
needed get variables. The problem is with the submit_cat=1 get variable
attached to the URL-to-be-redirected. When I take this out of the get
string, the script redirects the user just fine when the value of
$num_rows=0. I still need that variable to be sent so when I place the
submit_cat=1 variable back into the get string it takes you to the default
Apache error page entitled, Internal Server Error. Why is this submit_cat
variable causing me so much trouble?

?php

if (this) {
.
.
.
} elseif (something) {
.
.
.
} elseif (something_else) {

   if ($num_rows == 0) {
   header(Location:
$PHP_SELF?submit_cat=1submit_subcat=1cat_id=$cat_id);
   exit;
   } elseif ($num_rows != 0) {
   $row = $db-fetch_results($query);
.
.
.
   }
}

?

- Nilaab


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




[PHP] How To Delete All Files In A Directory

2002-11-12 Thread @ Nilaab
Hello Everyone,

I have a directory that I want emptied everytime a script accesses a certain
function. I tried using rmdir() and then mkdir(), thinking that it will
delete the directory and the contents within it, and would create a brand
new directory for me to work with from scratch. Well, that didn't happen and
I read the PHP docs to see why.

I checked to see how else I can do this by reading about some other
filesystem functions, and now I'm more confused than ever. Which
combinations of functions would I need to empty a directory's entire
contents? I just need some direction on this. Thanks.

- Nilaab


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




[PHP] Moving Files From One Directory To Another

2002-11-11 Thread @ Nilaab
Which built-in PHP functions would I use to move a file from one directory
into another? I'm thinking that this requires more than one function to
achieve what I want.

What approaches should I take? Do I need to copy the file into a temporary
directory first and then move it to the destination directory? Or Is it
possible for me to move the file directly from one directory into another?

The functions I read about so far are copy() and move_uploaded_file(), but
the move_uploaded_file() function seems to work only when the file is
uploaded from an HTML form, or am I wrong?

Just looking for some direction.

- Nilaab


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