Re: [PHP] where php at?

2006-03-27 Thread Dusty Bin
tedd wrote:
 At 1:19 PM -0600 3/27/06, Jay Blanchard wrote:
 [snip]
 Where do I type in which php?
 [/snip]

 At the command line on the host.
 
 Aarrrg -- no disrespect meant.
 
 I'm totally and absolutely clueless and frustrated. It must be my age
 because I haven't seen a command line since my Apple][ days -- let alone
 one while doing web work.
 
 I'm sitting in front of my computer accessing my remote web site via ftp
 (GoLive) writing code and trying to set up a cron job using cpanel to
 run that code.
 
 Now, I have no idea of where I should type in which php  -- I've tried
 putting it in my cpanel cron jobs command to run box, but that doesn't
 do anything.
 
 Does anyone have any reference material of where a command line of the
 host is?
 
 Thanks.
 
 tedd
 
I know nothing of cpanel, but if you can use cpanel to execute your
script, can you not use cpanel to say 'which php'??
HTH...  Dusty

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



Re: [PHP] Mysql Rows

2006-03-06 Thread Dusty Bin
Another point to consider, is that Tedds method of renumbering the rows,
*may* not preserve the original sequence.  I have not checked the mysql
source, but if some delete activity has occurred in the table, then
there will be holes in the data, in some circumstances, inserting
further records to the table, some may go on the end, and some may fill
the holes.  I suspect that using Tedd's method of dropping the column,
and then re-adding the column, the auto increment, will either be added
in the physical sequence of the table, or added in the order of any
index that may be traversed in this process.  As an extreme example, if
one had a table with 5 million rows, and then deleted the first 4.5
million rows, where will the next insert go?  One of the benefits of a
relational database, is that you do not need to consider how the data is
physically stored.

Best regards... Dusty

[EMAIL PROTECTED] wrote:
 [snip]
 That's the reason when I started this thread I made it clear that I 
 was NOT talking about a relational dB but rather a simple flat file.
 
 What I find interesting in all of this exchange -- however -- is that 
 everyone agree's renumbering the id of a dB is something you don't 
 do, but no one can come up with a concrete (other than relational) 
 reason why.
 
 [/snip]
 
 Tedd, several here, including me, have said that if you have only a
 single table database that renumbering is OK, just not a preferred
 practice. (BTW, you never answered my question about this being a flat
 file database or single table, although I have figured it out now.)
 Renumber to your heart's content. If your users are allowed delete
 privileges (ACK!) and you don't want to confuse them, go ahead and
 renumber. 

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



[PHP] Re: Variables from database

2004-12-05 Thread Dusty Bin
Stuart Felenstein wrote:
I haven't try this yet but wondering if it's possible.
 
Can I do something like this:

select fieldone from table ;
$myvar = $fieldone ?
And more so could I do it with a where clause ?
i.e. select fieldone from table where fieldone = 3
$myvar = $fieldone ?
This is probably a stupid question.  I am also
wondering about syntax.
Thank you,
Stuart
Stuart,
	why don't you try it first, then if you get the syntax wrong(as you 
have), you can fix it.  Then if you are still in trouble, you can come 
to this newsgroup with a more meaningful request.  It'll save you loads 
of time too.
Best regards. . . Dusty

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


[PHP] Re: Silly OOP question

2004-11-14 Thread Dusty Bin
Brent Clements wrote:
I've always wondered this about OOP and maybe you guys can answer this question.
I'm writing a php application and I'm trying to figure out the correct way to 
right the oop part of this application.
for instance.
I have a project.class file that has functions for dealing with individual 
projects because you break down ideas into singular entities in OOP(as I understand it)
But what if I wanted to deal with multiple projects such as getting a list of the projects in my database, 
should I create a function in the project.class to handle the now plural request, or should I 
create a projects.class file that has a function called getProjects.
Hopefully I'm explaining this question right. It makes sense in my own head. :-)
Thanks,
Brent
Brent,
	there are many ways so skin a cat, but one way to solve your problem in 
an OO manner would be a container class, call it projects or what you will.
An example(not tested) could be:
?php
class Container {
private projects = array(); // Contains projects
private projectsLoaded = false;
...
other methods
...
public function getProjects() {
if (!$this-projectsLoaded) {
	$this-loadProjects();
}
return $this-projects;
}
private function loadProjects() {
//code to load the projects into the project array
$this-projectsLoaded = true;
}
}
?
In your main code you can have something like:
$container = new Container;
foreach($container-getProjects as $project) {
	$something = $project-someMethod(...);
	...
	...
}

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


[PHP] Re: Silly OOP question

2004-11-14 Thread Dusty Bin
Dusty Bin wrote:
snip
/snip
foreach($container-getProjects as $project) {
snip
/snip
Sorry about the typo, of course it should read:
foreach($container-getProjects() as $project) {
Dusty
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Zip Codes

2004-11-04 Thread Dusty Bin
Brian V Bonini wrote:
On Thu, 2004-11-04 at 12:47, Vail, Warren wrote:

If you can figure out how to make sense of this, you might be able to find
the point that a system is connected to the internet, by tracing back to a
visitors current IP address.

Which may get you close but either way would probably be more indicative
of the service providers location then the actual user and even
narrowing it down to a single city does not mean you have only a single
zip code to deal with.
not to mention DHCP!!!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Unable to validate XML with Schema if namespace is specified.

2004-11-01 Thread Dusty Bin
Thanks Christian(or chregu),
and thanks for the pointer to trang.  I've not met that tool before.
Best regards. . . Dusty
Christian Stocker wrote:
snip
/snip
Aren't you missing any namespace declaration in your Schema File?
Yes I was - duh!!
snip
/snip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Unable to validate XML with Schema if namespace is specified.

2004-10-31 Thread Dusty Bin
I am trying to validate an XML document, using 
DomDocument::schemaValidate() as in the following code:

?php
$txt =EOT
?xml version=1.0?
Article xmlns='http://www.example.com/xml'
  ItemItemText/Item
/Article
EOT;
$dom = new DOMDocument();
$dom-loadXML($txt);
if ($dom-schemaValidate(Article.xsd)) {
print $dom-saveXML();
}
?
The schema I am trying to validate against is:
?xml version=1.0 ?
xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema; 
xs:element name=Article
xs:complexType
xs:sequence
xs:element name=Item maxOccurs=unbounded/
/xs:sequence
/xs:complexType
/xs:element
/xs:schema
This produces the following output:
Warning: Element Article not declared in E:\PHPTest\testXML.php on line 10
Warning: Element Article not declared in E:\PHPTest\testXML.php on line 10
If I remove the default namespace from the article tag, the XML 
validates correctly.  I seem to recollect that namespace support is not 
fully implemented, so my question is, is this a bug, or just something 
not yet implemented, or is there an obvious blunder in what I am trying 
to do, which I cannot see.
Best regards. . . Dusty

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


[PHP] DOM XML/XSL questions

2004-10-27 Thread Dusty Bin
I have a requirement to create an XML file which looks approximately like:
?xml version=1.0 ?
?xml-stylesheet type='text/xsl' href='article.xsl' ?
article
  itemItem Text/item
  ...
/article
The file needs to be formatted.
I built a dom using the Dom extension, creating a document, adding 
nodes, and I got a nicely formatted XML file from $dom-saveXML();

The only problem I had, was that I could see no way to add the 
stylesheet definition to the XML.  I'm not sure that a DOM should know 
anything about stylesheets, but an XML file probably should.

I managed to bypass the problem, by loading the dom from a file, with 
the style sheet and the root element included, and then proceeding to 
build the dom by adding the extra nodes.  This also worked fine, but now 
the output from $dom-saveXML() is no longer formatted.
Here is some sample code:

?php
$txt =EOT
?xml version=1.0?
?xml-stylesheet type='text/xsl' href='../../../article.xsl' ?
Article
xmlns='http://www.example.com/xml'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://www.example.com/test/xml article.xsd'
/Article
EOT;
$dom = new DOMDocument();
$dom-preserveWhiteSpace = FALSE;
$dom-resolveExternals = TRUE;
$dom-loadXML($txt);
$item = $dom-createElement(Item);
$itemText = $dom-createTextNode(Item Text);
$item-appendChild($itemText);
$dom-documentElement-appendChild($item);
$dom-formatOutput = TRUE;
echo $dom-saveXML();
?
My questions are:
1) How should I add a stylesheet to this type of document? (I do not 
need to process the stylesheet in php, it is for the guidance of the end 
user of the document, who may use it or modify it),
and,
2) Is this a (dare I say bug in an experimental extension) that if I 
load the dom, and perform operations on the dom, I lose formatting(A dom 
that is just loaded, or just created by dom operations, is correctly 
formatted, a dom with mixed processes is not).

TIA for any advice...   Dusty
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] DOM XML/XSL questions

2004-10-27 Thread Dusty Bin
Christian Stocker wrote:
snip
/snip
Use $dom-createProcessingInstruction($target, $data) ;
and then append this to the document.
that could maybe work
see
http://ch.php.net/manual/en/function.dom-domdocument-createprocessinginstruction.php
for more details.
Thank you Christian, the following code worked fine.
(From within the DOM object)
$this-preserveWhiteSpace = false;
$this-resolveExternals = true;
$styleSheet = $this-createProcessingInstruction(xml-stylesheet, 
type='text/xsl' href='../../../course.xsl');
$this-appendChild($styleSheet);
$this-createRoot();
$this-formatOutput = TRUE;
snip
/snip
And the formatting is not lost. you didn't provide any ;) The DOM
Extension doesn't make any assumptions about the formatting of your
XML document (or correctly said, it doesn't insert whitespace
automagically ) but you can try to set the property formatOutput
just before saveXML:
$doc-formatOutput = true;
Never tested, but should work
I already had formatOutput = true; in the sample code.  Of course when I 
am loading the DOM from a string, I am providing the formatting, which 
DOM is honouring but when I am creating the DOM completely from php, you 
are right, I am providing no formatting.  In this case, the formatOutput 
works as I would have expected, (default??)formatted output when true, 
and not formatted when false.  It would seem that if you provide some 
formatting, DOM expects you to provide it all.  When I have finished 
this current assignment, I'll try to follow the calls through from PHP 
to libxml2, and see if I can find something more.

Once again, thanks for your help...   Dusty
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] File Copy

2004-10-20 Thread Dusty Bin
Aidal,
	presumably, your server had the write to copy the file, otherwise the 
copy would have failed.  Is the only problem that you don't have the 
correct permissions on the copied file??  if so check out
http://www.php.net/manual/en/function.umask.php.  If you set the umask 
before you copy, you should have the correct permissions.

Best regards. . . Dusty
Silvio Porcellana wrote:
Chris Dowell wrote:
Aidal
Could you post the relevant parts of your code so we have a little 
context to work in?

You say you're copying a file from one location to another on the same 
server. If this is the case you are very unlikely to be in need of the 
ftp family of functions, which are only valid for use over an 
established ftp connection.

You can indeed establish an FTP connection to your local server - 
provided it has an FTP server running.
The files are actually copied by Apache (or whatever Web server he's 
using), so this is why the server becomes the owner.

I suspect that the file is indeed now owned by the webserver
has it changed from aidal:somegroup to nobody:nogroup or something 
like that?

I guess this is the problem Aidal is experiencing.
In order to maintain file ownserships, what he can do (since he doesn't 
have PHP 5) is copy the file with 'ftp_fput()' 
[http://php.libero.it/manual/en/function.ftp-fput.php].
That is, he opens the files he wants to copy and PUTs it via this 
function. Since he is logged in - using 'ftp_connect()' and 
'ftp_login()' - the files will be owned by the user he used to login.

My .2 euros...
Cheers,
Silvio Porcellana
snip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: File Copy

2004-10-20 Thread Dusty Bin
Aidal,
	I assume that you are using your server to copy the file, and since the 
copy apparently suceeds, your server must have read access to the source 
file.  Check out
http://www.php.net/manual/en/function.umask.php.  If you set the 
correct umask prior to your copy, your copied file should end up with 
the correct permissions.  Even if it doesn't, you should be able to 
chmod correctly.  Be careful with the mask, it is set up with negative 
logic.  If you have access to an *nix system, try a man umask for more 
information.

Hope this helps. . . Dusty
Aidal wrote:
Hi NG.
I'm experiencing some problems when trying to copy a file from one location
to another on the web server.
example:
dir1/subdir1/some_image_name.jpg  --  dir2/subdir2/some_new_image_name.jpg
When I do this the file permissions changes and I'm no longer the owner of
the file. I tried to use chmod('the_new_file', 0777); but it doesn't work,
because chmod() wont let me change the permissions since I'm not the owner
of this new file.
The server runs on some kind of UNIX based system...
Any help or suggestions would be much appreciated, thanks.
/Aidal
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: File Copy

2004-10-20 Thread Dusty Bin
Aidal,
	since you are using the server to copy the file, and the copy succeeds, 
the server obviously has at least read access to the source.
You just can't get the permissions right.  Check out: 
http://www.php.net/manual/en/function.umask.php.  If you have access 
to your server or another *nix machine also check out man umask.  If 
you set your umask before the copy, your file should be copied with the 
right permissions.  If you set the umask after the copy, you should be 
able to chmod.  Be careful how you set the umask, it's not as straight 
forward as is seems.

Hope this helps. . . Dusty
Aidal wrote:
Hi NG.
I'm experiencing some problems when trying to copy a file from one location
to another on the web server.
example:
dir1/subdir1/some_image_name.jpg  --  dir2/subdir2/some_new_image_name.jpg
When I do this the file permissions changes and I'm no longer the owner of
the file. I tried to use chmod('the_new_file', 0777); but it doesn't work,
because chmod() wont let me change the permissions since I'm not the owner
of this new file.
The server runs on some kind of UNIX based system...
Any help or suggestions would be much appreciated, thanks.
/Aidal
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php