Re: [PHP] Parse Error on SQL Insert [Solved]

2006-04-08 Thread Tom Chubb
Sorry guys - knew it would be obvious!
I was using $_FILE['image']['name'][0],  instead of
$_FILES['image']['name'][0]

However, thanks for all your help.
Tom


On 07/04/06, Joe Henry [EMAIL PROTECTED] wrote:

 On Friday 07 April 2006 1:56 pm, Chrome wrote:
  Backticks (`) encapsulate table or database names
 
  I was thinking maybe if the array references were encapsulated in curly
  braces {}:
 
  $_POST['model'] to {$_POST['model']}
 
  Of course if the field in the DB isn't numeric this would be
  '{$_POST['model']}'
 
  Dan
 
  ---
  http://chrome.me.uk
 
 
  -Original Message-
  From: Joe Henry [mailto:[EMAIL PROTECTED]
  Sent: 07 April 2006 20:53
  To: php-general@lists.php.net; [EMAIL PROTECTED]
  Subject: Re: [PHP] Parse Error on SQL Insert
 
  On Friday 07 April 2006 1:37 pm, Tom Chubb wrote:
   $insertSQL = INSERT INTO cars (model, `year`, details, price, image1,
 
  Not sure if this is your problem, but those look like backticks around
 year
  instead of single quotes. Should there even be quotes there?
 
  HTH
  --
  Joe Henry
  www.celebrityaccess.com
  [EMAIL PROTECTED]
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  __ NOD32 1.1475 (20060406) Information __
 
  This message was checked by NOD32 antivirus system.
  http://www.eset.com

 Good to know. Thanks.

 --
 Joe Henry
 www.celebrityaccess.com
 [EMAIL PROTECTED]




--
Tom Chubb
[EMAIL PROTECTED]
07915 053312


Re: [PHP] PHP Book Recommendation

2006-04-08 Thread Jad madi
it depends on your programming level and taste of reading 
I really like Advanced PHP programming but some people he's a lousy
teacher, SitePoint books are the most reader friendly books but maybe
they aren't the most valuable books in the market.

In the last two months the market got load of new PHP books but this
time it wasn't General-PHP books but php-specific-topic books, namely
design patterns, security, php5 objects etc.. 
so the best now is to look for php book talking about specific php
related topic

for me the best are
Topic   book
General Advanced PHP Programming
Security:   Ilia's security book Guide to php security
OOP patterns:   PHP design patterns
PHP5/general php:php5 power programming
Tools/extensions/internals: essential php tools

Finally the best is to read some chapters of the book to see if you like
how it's written and to check reviewers comments on Amazon.











On Fri, 2006-04-07 at 21:50 -0700, Jim Lucas wrote:
 Paul Goepfert wrote:
  Hi all,
 
  Can anyone tell me a good php book to buy.  I already have Web
  Database Applications with PHP  MySQL by O'Reilly.
 
  Thanks,
  Paul
 

 Professional PHP5 by WROX
 

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



Re: [PHP] Ajax please....

2006-04-08 Thread Rasmus Lerdorf

Rasmus Lerdorf wrote:

?php
if(!empty($_POST['loc'])) {
  $src = 
http://api.local.yahoo.com/MapsService/V1/mapImage?appid=YahooDemo;;

  $src.= location=.urlencode($_GET['loc']).
 output=phpimage_width=300image_height=300zoom=7;
  header(Content-type: application/x-json);
  echo json_encode(unserialize(file_get_contents($src)));
  exit;
}
?


Typo in the above.  $_GET['loc'] should be $_POST['loc'].  I switched 
from GET to POST and missed this one.  The next version of the Yahoo 
libs coming out soon will have GET support.  My previous example was a 
touch ahead of the released version.


-Rasmus

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



Re: [PHP] Re: Parsing variables within string variables

2006-04-08 Thread David Clough

Dear Paul,

this is exactly the solution I needed, and works as described! Many  
thanks for thinking through this with me.


Yours,

David.

On 8 Apr 2006, at 00:05, Paul Novitski wrote:


At 02:41 PM 4/7/2006, David Clough wrote:

I have to parse the string 'Hello $foo' as it comes from the
database: I don't get to construct it.

I did hold out more hope for the eval function, but it seems to me  
that

this is for PHP code in a database, not to evaluate variables.



David, please try the eval() route: it will do what you want.  You  
say, this is for PHP code in a database, not to evaluate  
variables, but evaluating variables is absolutely part of PHP code  
processing!  Eval() will operate on $x = 4; just as easily as on  
Hello $foo.


You should not use eval() frivolously because it presents a  
potential vulnerability in your code.  You may wish to ensure that  
the database text it operates on is first cleansed of any other PHP  
syntax -- similarly to the way we should all ensure that any  
incoming data is clean before we process it and incorporate it into  
our scripts.


Here's an example of variaible evaluation:
___

$bar = cat;
$foo = Hello \$bar.;

echo $foo;
RESULT: Hello $bar.

By escaping the $, I have made it a literal character in the text,  
the same as if I'd read Hello $bar from a database.

___

eval(echo \$foo\;);
RESULT: Hello cat.

This is equivalent to scripting:
echo $foo;
I'm using eval() to execute the echo command and interpret the PHP  
variable $foo.

___

eval(\$dog = \$bar;);
echo dog =  . $dog;

RESULT: dog = cat

Here I'm using eval() to set one PHP variable equal to another.
___

You can't simply write:
eval(\$bar;);
or
$x = eval($foo);

because everything inside the eval() parentheses needs to be a  
complete PHP statement.  The eval() function itself doesn't return  
the value of an evaluated expression.  To capture the value of an  
expression, you must evaluate a complete statement that sets a  
variable equal to the expression as above.

___

Clear as mud?

Regards,
Paul


--
Dr. David Clough
Tutor in Ethics and Systematic Theology; Director of Studies
Cranmer Hall, St. John's College, Durham DH1 3RJ, U. K.
Tel. +44 (0)191 334 3858 Fax. +44 (0)191 334 3501
[EMAIL PROTECTED]
--
E-MAIL WARNING;
The information in this e-mail is confidential and may be subject to  
legal professional privilege.  It is intended solely for the  
attention and use of the named addressee(s). If you are not the  
intended recipient, please notify the sender immediately.  Unless you  
are the intended recipient or his/her representative you are not  
authorised to, and must not, read, copy, distribute, use or retain  
this message or any part of it.


At present the integrity of e-mail across the Internet cannot be  
guaranteed and messages and documents sent via this medium are  
potentially at risk. You should perform your own virus checks before  
opening any documents sent with this message. All liability is  
excluded to the extent permitted by law for any claims arising from  
the use of this medium by St John's College Durham.





Re: [PHP] Is it a bug of CakePHP?

2006-04-08 Thread John Wells
  Pham Huu Le Quoc Phuc a écrit :
   I catch an error, could you tell me if you have some ideas?
  
   Error message: Undefined index: start_date in
   c:\Inetpub\wwwroot\Cake\app\controllers\dsptrainings_controller.php on
 line
   33
  

PHP is telling you that what you are trying to access doesn't exist. 
This is is a matter of you trying to access something that doesn't
exist.

So the question is, what does $data look like?  My suggestion is to
print_r($data) to see.  Perhaps findBySql() doesn't return the results
as an associative array?  Or since you're sending a query for only one
record, it doesn't send a 2-dimensional array back? Maybe your start
date can be accessed simply by $data['start_date']?  I don't know, I
don't use CakePHP.

Again, print your $data variable to the screen to find out what it contains.

Consider this to be a powerful tool in your bag of debugging tricks. 
I print variables to the screen all the time to find out what's wrong.
 In fact, I'll do it in a two step process:

print_r($my_variable);
die(hrfilename.php:line_num);

The first line prints the variable I'm after to the screen.  The
second line kills the script, but outputs the text I send it first. 
So it draws a horizontal rule across the page, and then prints out the
file name and line number that the script was killed at.

So if I'm tracing a particularly elusive bug, I can place these two
lines in various places across my app, and walk through it step by
step.  The important part is knowing the filename and location of your
debugging marks, so that you can clean them up easily.

HTH,
John W

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



Re: [PHP] headers already sent.

2006-04-08 Thread P. Guethlein

At 10:30 PM 04/07/2006, you wrote:

Comment inline:


Thanks,  I just found that out after, well I don't want to say how 
long it took smile.


Is that just the way things are in PHP or is there a command / 
configuration to make something like this more obvious?  Hmmm. 
maybe the IDE I'm using?  Using EnginSite.  Is there a better one for 
a Windows Environment ?


( head banging against wall )

-Pete





P. Guethlein wrote:

(Know enough to be dangerous beginner...)

Routine for a web login asked user name and password.

User Name is entered correctly.

Password is Incorrect.

Next Try.

User Name is enter correctly.

Password is Entered Correctly.

PHP notifies me on the html output that I am logged in.  However, 
an error is appearing in text above the html output.  It states


Warning: Cannot modify header information - headers already sent by 
(output started at D:\webpages\\users.inc:11) in 
D:\webpages\\web\loginfunctions.php on line 26


Users.inc is

==
?php
$domain = 'localhost';
$admin = 'x';
$user = 'x';
$web = 'x';
$password = 'xx';
$site = 'x';
$leads = 'x';
?
This gap right here, it's outputting a carriage return and/or 
linefeed. headers get sent on the first character of output being sent.

?php
// Configuration settings for My Site

// Email Settings
$mailsite['from_name'] = 'x Website'; // from email name
$mailsite['from_email'] = '[EMAIL PROTECTED]'; // from email address

// Just in case we need to relay to a different server,
// provide an option to use external mail server.
$mailsite['smtp_mode'] = 'enabled'; // enabled or disabled
$mailsite['smtp_host'] = 'mail..xxx;mail.x2.xxx';
$mailsite['smtp_port'] = '25';
$mailsite['smtp_username'] = null;
?
===

Line 26 from the loginfunctions.php file is

//now redirect the user to whatever page they wanted.
header('Location: index.php?href='.$link);

==

I can anticipate what the problem is with the notification that PHP 
gives me with the headers already output.  However, it says 
'headers already sent by users.inc', huh?


Suggestions of where to look on this bug is appreciated!

-Pete


--
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] a php image gallery

2006-04-08 Thread Ross

Does anyone know know of a good php image gallery?  I want to generate the 
pages automatially from stored images.

Please don't reply with 'search google under php gallery' or some other 
useless reply. I want someone to advise,  who has used code either free or 
paid for that is decent and is easy use.


Ross

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



Re: [PHP] a php image gallery

2006-04-08 Thread chris smith
On 4/8/06, Ross [EMAIL PROTECTED] wrote:

 Does anyone know know of a good php image gallery?  I want to generate the
 pages automatially from stored images.

 Please don't reply with 'search google under php gallery' or some other
 useless reply. I want someone to advise,  who has used code either free or
 paid for that is decent and is easy use.

There was a recent thread:
http://marc.theaimsgroup.com/?l=php-generalm=114439402126801w=2

which lists a few.

I use coppermine (coppermine.sf.net), gallery is pretty popular too
(gallery.sf.net).

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

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



[PHP] What does this mean: ?=

2006-04-08 Thread Merlin

Hi there,

I am somehow confused about the this command: ?=

What does the equetion sigh mean?

I would like to replace the ?= sign inside this line:


?= $ajax-loadJsApp(true) ?

so I could do something like this:
?php
$ajax-loadJsApp(true);
echo 'test';
?

But this does not work. Some how this equetion sign has something to do with it.

Thank you for any hint,

Merlin

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



Re: [PHP] What does this mean: ?=

2006-04-08 Thread Rory Browne
?=expression ?

?php echo expression; ?

On 4/8/06, Merlin [EMAIL PROTECTED] wrote:

 Hi there,

 I am somehow confused about the this command: ?=

 What does the equetion sigh mean?

 I would like to replace the ?= sign inside this line:


  ?= $ajax-loadJsApp(true) ?

 so I could do something like this:
 ?php
  $ajax-loadJsApp(true);
  echo 'test';
 ?

 But this does not work. Some how this equetion sign has something to do
 with it.

 Thank you for any hint,

 Merlin

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




Re: [PHP] What does this mean: ?=

2006-04-08 Thread Dave Goodchild
?= $arse; ?

...is a concise, if less readable way, to echo the value of arse. It is only
used to echo a value. To do anything else, for example, call a method, use
the second approach you describe. In fact, you already seem to know the
difference, so why the question? Are you trying to replace this notation in
exisiting code?

On 08/04/06, Merlin [EMAIL PROTECTED] wrote:

 Hi there,

 I am somehow confused about the this command: ?=

 What does the equetion sigh mean?

 I would like to replace the ?= sign inside this line:


  ?= $ajax-loadJsApp(true) ?

 so I could do something like this:
 ?php
  $ajax-loadJsApp(true);
  echo 'test';
 ?

 But this does not work. Some how this equetion sign has something to do
 with it.

 Thank you for any hint,

 Merlin

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




--
http://www.web-buddha.co.uk
dynamic web programming from Reigate, Surrey UK

look out for e-karma, our new venture, coming soon!


Re: [PHP] Re: make global variables accessible to functions?

2006-04-08 Thread Rory Browne
I have to agree with passing them as opposed to accessing them from inside
the function

Clean
$a = whatever;
function foo($a){
echo $a;
}

Ugly
$a = whatever;
function foo(){
global $a;
echo $a;
}

Unless the variables in question are for all intents and purposes constant (
real constants can't be arrays ), ie for example configuration vars, I would
avoid making them global.

Having that said, it's your code..


Re: [PHP] microtime questions

2006-04-08 Thread Brad Bonkoski



tedd wrote:


-B

At 12:51 PM -0400 4/7/06, Brad Bonkoski wrote:


How is the CPU not in question?  Does this script run on air?



I did not say that. I said that it was not MY CPU that was involved 
and it isn't.



Who cares, it is irrelavent who's CPU it is runing on.

It may not be YOUR CPU, but it is still a CPU bound by the sceduling 
algorithm of the Operating System, so the time differentials are too 
be expected.



Negative times are expected? Incorrect times are expected? What's the 
point of microtime if you can't reply on it?


Please explain.


Please tell me where it say Negative times are expected??  I don't 
see it. 
And take a class on Operating System Theroy!  If you want a real time 
OS, then get a real time OS, otherwise realize that although you MAY be 
executing the same code, it may take different amounts of time to 
execute that code.  That's how scheduling works.  If you want 
performance measurements then take a sample and average them out.




tedd

--- previous ---


-B

tedd wrote:


At 12:24 PM -0400 4/7/06, Brad Bonkoski wrote:


Interesting...
as for your first question...
Know that PHP/Apache does not have free reign to your CPU, so the 
times could be different based on the scheduling going on in the OS 
kernel.


As for the second one...
No idea why you would get a negative number, I just copied and ran 
from the command line and did not encounter 1 negative time for 
about 30 runs


Do you get negative times if you run it from the command line as well?
-B


RE:

http://www.xn--ovg.com/microtime.php



Brad:

Thanks for looking.

My questions are with regard to what happens on the site, not via my 
command line. As such, my command line and my CPU are not involved.


Can you answer the questions as they pertain to the site in question?

Thanks.

tedd







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



[PHP] Re: Problems with Arrays and print and echo

2006-04-08 Thread Michael Felt

Michael Felt wrote:

Slowly I am getting the output I want.

Trying to use dynamic arrays, does creat the array I want, but getting 
the info is sometimes surprising.


I notice a difference between arrays used locally in a function, and 
arrays used as a 'var' in a class function (all in PHP 4 atm).


Code snippet:
echo ROWS returned are: $max\n;
$this-count = $max;

while ($max--) {
$row = mysql_fetch_row($result);
$this-name[$max] = sprintf(%s, $row[0]);
$Name[$max] = sprintf(%s, $row[0]);
echo init \$this-Xame[$max] = $row[0];
echo  $Name[$max] $this-name[$max]\n;
$regionID[$max] = $row[1];
$constellationID[$max] = $row[2];
$this-ID[$max] = $row[3]; 
printf(%d:%d/%d/%s\n,$max,$regionID[$max],$constellationID[$max],

   $this-name[$max]);
}

Line wrap is messing things up a bit.
Was trying sprintf to see if the was a buffer problem coming from mysql.
Problem seems to be the same, regardless.
Also, the names changes ($this-name[] versus $Name[]) are deliberate, 
for just in case



Output (debuging):
ROWS returned are: 7
init $this-Xame[6] = 8-TFDX 8-TFDX Array[6]
6:1003/2044/8-TFDX
init $this-Xame[5] = B-E3KQ B-E3KQ Array[5]
5:1003/2044/B-E3KQ
init $this-Xame[4] = BR-6XP BR-6XP Array[4]
4:1003/2044/BR-6XP
init $this-Xame[3] = G5ED-Y G5ED-Y Array[3]
3:1003/2044/G5ED-Y
init $this-Xame[2] = O-LR1H O-LR1H Array[2]
2:1003/2044/O-LR1H
init $this-Xame[1] = UL-4ZW UL-4ZW Array[1]
1:1003/2044/UL-4ZW
init $this-Xame[0] = Y5J-EU Y5J-EU Array[0]
0:1003/2044/Y5J-EU
++
Thanks for your ideas, help, etc..

Maybe it is somethign as simple as can't do that with echo, but when 
the arrays are all single element ( foo_array[0] is only element ) all 
statements work as expected.


regards,
Michael
 From - Fri

Anyone?

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



Re: [PHP] Handling Large Select Boxes

2006-04-08 Thread Brad Bonkoski

Thanks for the responses to this...

The AJAX thing would probably not work as this is a critical piece to 
the UI, so even though the form would load faster, the users would still 
really need to wait for the select options to come through before they 
could actually do any *work* on the page.


The problems are horrific data, in that it has not been cleaned and 
validated, and there are not linkages, or layers to the data either, so 
there is literally no way to sub-select, which of course is poor 
planning by people before me. 

So, before I can fix the real problem, my stop gap solution was to load 
the list exactly once, as well as loading the contents into JS, 
therefore the users can search through to narrow down the list, and then 
using JS they can select an option and place in the the form element 
they are dealing with.  Load time are much better, but still not great.  
I guess this is what happens when people get a ton of data before they 
properly planned to get that much data


-Brad

Brad Ciszewski wrote:


Perhaps try implementing some AJAX on the page. Therefore, once the page has
loaded, the select tag is populated with different options, without actually
lagging the page.


Jay Blanchard [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
[snip]
I have a form for user interaction and part of it is a select box with a

large number of options from a database ~12K options.
Currently I have a function which queries the DB to get fresh data and
loads the HTML (option value=XY/option) into a string, so the DB is
only hit once,
but the page still takes a while to load.

Anyone else have any experience with something like this, or any other
helpful suggestions for making the page load time a little less
cumbersome?
[/snip]

If you are loading 12000 entries into a select box then that is way too
much. The gods of usability frown on you. Is there no way to make the
data selection slimmer?

 



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



[PHP] Re: Problems with Arrays and print and echo

2006-04-08 Thread Michael Felt

Michael Felt wrote:

Slowly I am getting the output I want.

Trying to use dynamic arrays, does creat the array I want, but getting 
the info is sometimes surprising.


I notice a difference between arrays used locally in a function, and 
arrays used as a 'var' in a class function (all in PHP 4 atm).


Code snippet:
echo ROWS returned are: $max\n;
$this-count = $max;

while ($max--) {
$row = mysql_fetch_row($result);
$this-name[$max] = sprintf(%s, $row[0]);
$Name[$max] = sprintf(%s, $row[0]);
echo init \$this-Xame[$max] = $row[0];
echo  $Name[$max] $this-name[$max]\n;
$regionID[$max] = $row[1];
$constellationID[$max] = $row[2];
$this-ID[$max] = $row[3]; 
printf(%d:%d/%d/%s\n,$max,$regionID[$max],$constellationID[$max],

   $this-name[$max]);
}

Line wrap is messing things up a bit.
Was trying sprintf to see if the was a buffer problem coming from mysql.
Problem seems to be the same, regardless.
Also, the names changes ($this-name[] versus $Name[]) are deliberate, 
for just in case



Output (debuging):
ROWS returned are: 7
init $this-Xame[6] = 8-TFDX 8-TFDX Array[6]
6:1003/2044/8-TFDX
init $this-Xame[5] = B-E3KQ B-E3KQ Array[5]
5:1003/2044/B-E3KQ
init $this-Xame[4] = BR-6XP BR-6XP Array[4]
4:1003/2044/BR-6XP
init $this-Xame[3] = G5ED-Y G5ED-Y Array[3]
3:1003/2044/G5ED-Y
init $this-Xame[2] = O-LR1H O-LR1H Array[2]
2:1003/2044/O-LR1H
init $this-Xame[1] = UL-4ZW UL-4ZW Array[1]
1:1003/2044/UL-4ZW
init $this-Xame[0] = Y5J-EU Y5J-EU Array[0]
0:1003/2044/Y5J-EU
++
Thanks for your ideas, help, etc..

Maybe it is somethign as simple as can't do that with echo, but when 
the arrays are all single element ( foo_array[0] is only element ) all 
statements work as expected.


regards,
Michael
 From - Fri

Some additional debug tests.

Code:
print_r($this-name);
echo \nprint_r item 5\n;
print_r($this-name[5]);
echo \necho item 5 in quotes\n;
echo \n$this-name['5']\n;
echo \necho item 5 not in quotes\n;
echo \n$Name[5]\n;
echo \necho class item 5 not in quotes\n;
echo \n$this-name[5]\n;
exit;


Output:

Array
(
[0] = Y5J-EU
[6] = 8-TFDX
[5] = B-E3KQ
[4] = BR-6XP
[3] = G5ED-Y
[2] = O-LR1H
[1] = UL-4ZW
)

print_r item 5
B-E3KQ
echo item 5 in quotes

Array['5']

echo item 5 not in quotes

B-E3KQ

echo class item 5 not in quotes

Array[5]
==
I am particilarily interested in the differences in these two echo 
statements with array variables in them. Why the difference in output?

echo \necho item 5 not in quotes\n;
echo \n$Name[5]\n;
echo \necho class item 5 not in quotes\n;
echo \n$this-name[5]\n;

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



Re: [PHP] Problems with Arrays and print and echo

2006-04-08 Thread chris smith
On 4/7/06, Michael Felt [EMAIL PROTECTED] wrote:
 Slowly I am getting the output I want.

 Trying to use dynamic arrays, does creat the array I want, but getting
 the info is sometimes surprising.

 I notice a difference between arrays used locally in a function, and
 arrays used as a 'var' in a class function (all in PHP 4 atm).

 Code snippet:
  echo ROWS returned are: $max\n;
  $this-count = $max;

  while ($max--) {
  $row = mysql_fetch_row($result);
  $this-name[$max] = sprintf(%s, $row[0]);
  $Name[$max] = sprintf(%s, $row[0]);
 echo init \$this-Xame[$max] = $row[0];
 echo  $Name[$max] $this-name[$max]\n;
  $regionID[$max] = $row[1];
  $constellationID[$max] = $row[2];
  $this-ID[$max] = $row[3];
 printf(%d:%d/%d/%s\n,$max,$regionID[$max],$constellationID[$max],
 $this-name[$max]);
  }
 
 Line wrap is messing things up a bit.
 Was trying sprintf to see if the was a buffer problem coming from mysql.
 Problem seems to be the same, regardless.
 Also, the names changes ($this-name[] versus $Name[]) are deliberate,
 for just in case
 

 Output (debuging):
 ROWS returned are: 7
 init $this-Xame[6] = 8-TFDX 8-TFDX Array[6]

Is the problem that you're getting array[6] instead of the value?
Explain what you see and what you expect to see.

What is var $name originally set to, ie:

var $name = array(); (or '' or ) ?

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

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



Re: [PHP] Problems with Arrays and print and echo

2006-04-08 Thread Michael Felt

chris smith wrote:

On 4/7/06, Michael Felt [EMAIL PROTECTED] wrote:


Slowly I am getting the output I want.

Trying to use dynamic arrays, does creat the array I want, but getting
the info is sometimes surprising.

I notice a difference between arrays used locally in a function, and
arrays used as a 'var' in a class function (all in PHP 4 atm).

Code snippet:
echo ROWS returned are: $max\n;
$this-count = $max;

while ($max--) {
$row = mysql_fetch_row($result);
$this-name[$max] = sprintf(%s, $row[0]);
$Name[$max] = sprintf(%s, $row[0]);
echo init \$this-Xame[$max] = $row[0];
echo  $Name[$max] $this-name[$max]\n;
$regionID[$max] = $row[1];
$constellationID[$max] = $row[2];
$this-ID[$max] = $row[3];
printf(%d:%d/%d/%s\n,$max,$regionID[$max],$constellationID[$max],
   $this-name[$max]);
}

Line wrap is messing things up a bit.
Was trying sprintf to see if the was a buffer problem coming from mysql.
Problem seems to be the same, regardless.
Also, the names changes ($this-name[] versus $Name[]) are deliberate,
for just in case


Output (debuging):
ROWS returned are: 7
init $this-Xame[6] = 8-TFDX 8-TFDX Array[6]



Is the problem that you're getting array[6] instead of the value?
Explain what you see and what you expect to see.

What is var $name originally set to, ie:


$row = mysql_fetch_row($result);
$this-name[$max] = sprintf(%s, $row[0]);
$Name[$max] = sprintf(%s, $row[0]);

Is the actual assignment of variables. What surprises me is that the 
'local' variable echos what I expect, but the 'class' variable does not.


function init($id)
{
$this-ID[0] = ERROR;
$this-name[0] = ;

Hope this answers your question.

And yes, I am not happy the the 'Array[X]' output, I am expecting the 
value, not what it is.


I have already tried establishing an array type early in the function...



var $name = array(); (or '' or ) ?

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


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



Re: [PHP] Problems with Arrays and print and echo

2006-04-08 Thread Michael Felt

Michael Felt wrote:

OK . a rewrite, bit shorter...

1. A class construct with two arrays:

var $name;
var $ID;

function init($id) {
$this-name = array();
$this-ID = array();


# firther in code assignment done from a mysql database:
while ($max--)
read
$this-name[$max] = $row[0];
$this-ID[$max]   = $row[1];
$Name[$max] = $row[0];
$ID[$max]   = $row[1];
}

and now some debug code
print_r($this-name);
print_r($this-ID);
echo \n$Name[5]\n;

echo $this-name[5]\n;
echo $this-ID[5]\n;
$a1 = $this-name;
$a2 = $this-ID;
echo \n$a1[5] $a2[5]\n;

Output:
Array
(
[6] = 8-TFDX
[5] = B-E3KQ
[4] = BR-6XP
[3] = G5ED-Y
[2] = O-LR1H
[1] = UL-4ZW
[0] = Y5J-EU
)
Array
(
[6] = 3312
[5] = 3307
[4] = 3311
[3] = 3310
[2] = 3309
[1] = 3313
[0] = 3308
)

B-E3KQ

Array[5]
Array[5]

B-E3KQ 3307

chris smith wrote:



var $name = array(); (or '' or ) ?

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


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



Re: [PHP] Problems with Arrays and print and echo

2006-04-08 Thread Michael Felt

Michael Felt wrote:
echo \n. $this-name[5] .   . $this-ID[5]. \n;
This give the same output as:
$a1 = $this-name;
$a2 = $this-ID;
echo \n$a1[5] $a2[5]\n;

Looks like I may need to use the '.' constructor more often

Who can explain this (please)?


Michael Felt wrote:

OK . a rewrite, bit shorter...

1. A class construct with two arrays:

var $name;
var $ID;

function init($id) {
$this-name = array();
$this-ID = array();

.
# firther in code assignment done from a mysql database:
while ($max--)
read
$this-name[$max] = $row[0];
$this-ID[$max]   = $row[1];
$Name[$max] = $row[0];
$ID[$max]   = $row[1];
}

and now some debug code
print_r($this-name);
print_r($this-ID);
echo \n$Name[5]\n;

echo $this-name[5]\n;
echo $this-ID[5]\n;
$a1 = $this-name;
$a2 = $this-ID;
echo \n$a1[5] $a2[5]\n;

Output:
Array
(
[6] = 8-TFDX
[5] = B-E3KQ
[4] = BR-6XP
[3] = G5ED-Y
[2] = O-LR1H
[1] = UL-4ZW
[0] = Y5J-EU
)
Array
(
[6] = 3312
[5] = 3307
[4] = 3311
[3] = 3310
[2] = 3309
[1] = 3313
[0] = 3308
)

B-E3KQ

Array[5]
Array[5]

B-E3KQ 3307


chris smith wrote:



var $name = array(); (or '' or ) ?

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


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



Re: [PHP] Ajax please....

2006-04-08 Thread Ryan A
Hey all,
first of all; a big thank you to all of you for replying, rather than mix up
my replies to all of you I will write my response to you under your name as
I have gotten so many different leads/opinions/views.

One last requirment I forgot to mention before was that I wanted to work
with PHP 4 only, I have not totally upgraded my knowledge to PHP5...I did
find a few classes on the php classes site for PHP5 that looked promising
but didnt work too well with what I had in mind.

Eric Wood:

Thanks for the link, will look into it, from your reply it sounds really
simple, at worst will learn something new  :-)


 Manuel Lemos:

Thanks for the links and the info, quite a bit that I didnt know about, esp
the IE6 part and activeX


 Rasmus Lerdorf:
-
That was a real long explanation; the least I can do is give the Yahoo
package another go since you took so much time to write that explanation
with the example.
:-)
 Problem is; its been ages since I fooled around with the JS DOM and to say
I am rusty would be an understatement. I had already downloaded the
YUI.zip file.
Thanks again.


Carlin Bingham / Tedd:
---
Yes, but then I would have to reload the whole page just to tell the person
that the account username was already taken...thats how its traditionally
done...but I want to try doing it without reloading the whole page...hence
Asynchronous JavaScript And XML (AJAX) although the XML part at the end is
not really too accurate because from what I see you can (and i have) use
AJAX without any XML...in my case it would be AJAH or AJAT (H=HTML, T=TEXT)
:-p

The other thing is, I thought I would start with something simple but still
real world and then work myself up to more complex stuff thats how I
learnt PHP; even though I didnt start with the Hello world in PHP I
started with basic strings and with the help of a book (PHP Blackbook) and
this list (better than any book) I rarely program in anything other than PHP
now.

AJAX is one of the new hot words over here and I see quite a few job
openings with this word used even though going the the employers site I see
very basic or non existant use of it (or even unnecessary use of it), it
does not seem very distant from normal programming (and i used to fool
around with JS a while back) so might as well learn a bit about it and add a
little more to the old CV ;-)


In closingall of you. get your butts off the chair and off
the computerand have a nice weekend!

Cheers,
Ryan

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



Re: [PHP] Problems with Arrays and print and echo

2006-04-08 Thread John Wells
  echo $this-name[5]\n;
  echo $this-ID[5]\n;
  $a1 = $this-name;
  $a2 = $this-ID;
  echo \n$a1[5] $a2[5]\n;

use curly brackets to help PHP understand what you're after:

echo {$this-name[5]}\n;

When you're in a string like this, PHP has a hard time knowing when
you're wanting to access a variable, and when you're simply trying to
output text.  Using curly brackets clears it up.

HTH,
John W

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



[PHP] php newbie having trouble going to detail page

2006-04-08 Thread David Doonan

I'm having trouble getting the correct results on a display page.

The first query is pulling the name of active authors from the d/b  
and sending a request to only return essay titles by the requested  
author. The list page however is displaying essay titles by all authors.


No doubt something is wrong with the where clause in the List page  
query. I've tried countless variations on the syntax for Author.ID =  
Author.ID without success.


Sorry for so basic a question.

-
author page query =

$query_GetAuthors = SELECT Distinct Author.Autholr_Name, Author.ID,  
Writings.Writings_Author FROM Author, Writings

WHERE Author.Autholr_Name = Writings.Writings_Author and
   Author.ID = Author.ID;

$GetAuthors = mysql_query($query_GetAuthors, $connDerbyTrail) or die 
(mysql_error());

$row_GetAuthors = mysql_fetch_assoc($GetAuthors);
$totalRows_GetAuthors = mysql_num_rows($GetAuthors);


author page link =
a href=author.php?ID=?php echo $row_GetAuthors['ID']; ??php  
echo $row_GetAuthors['Autholr_Name']; ?/a




-
List page query =

$query_GetAuthorList = SELECT Writings.Writings_Author,  
Writings.Writings_Title, DATE_FORMAT(Writings_Date, '%M %D, %Y') as  
Writings_Date, Writings.Writings_Text, Writings.ID,  
Author.Autholr_Name, Author.ID FROM Writings, Author

WHERE Writings.ID = Writings.ID AND
Author.Autholr_Name = Writings.Writings_Author 
AND
Author.ID = Author.ID
ORDER BY Writings.Writings_Date desc;

$GetAuthorList = mysql_query($query_GetAuthorList, $connDerbyTrail)  
or die(mysql_error());

$row_GetAuthorList = mysql_fetch_assoc($GetAuthorList);
$totalRows_GetAuthorList = mysql_num_rows($GetAuthorList);

david

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



[PHP] Timestamp needed in error log

2006-04-08 Thread John Hicks
I would like to configure my PHP 4.3 to include a timestamp in its error 
messages.


It appears that PHP defaults to no timestamp. I can't a find a directive 
that allows me to configure this.


Do I have to recompile?

I've never looked at the source before. Any pointers on where I should 
look for the error message generation?


I posted a similar query a week ago and got no response.

Any response would be appreciated:

--Does anyone have a PHP that is configured with a timestamped error log?

--Is there a reason not to have a timestamp?

--Would you, like me, like to have the date and time in the error messages?

Thanks,

John Hicks

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



[PHP] php newbie having trouble going to list page

2006-04-08 Thread David Doonan

I'm having trouble getting the correct results on a list page.

The first query is pulling the name of active authors from the d/b  
and linking to a list page that is supposed to return essay titles by  
the requested author. The list page however is displaying essay  
titles by all authors.


No doubt something is wrong with the where clause in the List page  
query. I've tried countless variations on the syntax for Author.ID =  
Author.ID without success.


Sorry for so basic a question.

-
author page query =

$query_GetAuthors = SELECT Distinct Author.Autholr_Name, Author.ID,  
Writings.Writings_Author FROM Author, Writings

WHERE Author.Autholr_Name = Writings.Writings_Author and
   Author.ID = Author.ID;

$GetAuthors = mysql_query($query_GetAuthors, $connDerbyTrail) or die 
(mysql_error());

$row_GetAuthors = mysql_fetch_assoc($GetAuthors);
$totalRows_GetAuthors = mysql_num_rows($GetAuthors);


author page link =
a href=author.php?ID=?php echo $row_GetAuthors['ID']; ??php  
echo $row_GetAuthors['Autholr_Name']; ?/a




-
List page query =

$query_GetAuthorList = SELECT Writings.Writings_Author,  
Writings.Writings_Title, DATE_FORMAT(Writings_Date, '%M %D, %Y') as  
Writings_Date, Writings.Writings_Text, Writings.ID,  
Author.Autholr_Name, Author.ID FROM Writings, Author

WHERE Writings.ID = Writings.ID AND
Author.Autholr_Name = Writings.Writings_Author 
AND
Author.ID = Author.ID
ORDER BY Writings.Writings_Date desc;

$GetAuthorList = mysql_query($query_GetAuthorList, $connDerbyTrail)  
or die(mysql_error());

$row_GetAuthorList = mysql_fetch_assoc($GetAuthorList);
$totalRows_GetAuthorList = mysql_num_rows($GetAuthorList);

david

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



Re: [PHP] php newbie having trouble going to detail page

2006-04-08 Thread John Hicks

David Doonan wrote:

I'm having trouble getting the correct results on a display page.

The first query is pulling the name of active authors from the d/b  and 
sending a request to only return essay titles by the requested  author. 
The list page however is displaying essay titles by all authors.


No doubt something is wrong with the where clause in the List page  
query. I've tried countless variations on the syntax for Author.ID =  
Author.ID without success.


Sorry for so basic a question.

-
author page query =

$query_GetAuthors = SELECT Distinct Author.Autholr_Name, Author.ID,  
Writings.Writings_Author FROM Author, Writings

WHERE Author.Autholr_Name = Writings.Writings_Author and
   Author.ID = Author.ID;

$GetAuthors = mysql_query($query_GetAuthors, $connDerbyTrail) or die 
(mysql_error());

$row_GetAuthors = mysql_fetch_assoc($GetAuthors);
$totalRows_GetAuthors = mysql_num_rows($GetAuthors);


author page link =
a href=author.php?ID=?php echo $row_GetAuthors['ID']; ??php  echo 
$row_GetAuthors['Autholr_Name']; ?/a




-
List page query =

$query_GetAuthorList = SELECT Writings.Writings_Author,  
Writings.Writings_Title, DATE_FORMAT(Writings_Date, '%M %D, %Y') as  
Writings_Date, Writings.Writings_Text, Writings.ID,  
Author.Autholr_Name, Author.ID FROM Writings, Author

WHERE Writings.ID = Writings.ID AND
Author.Autholr_Name = Writings.Writings_Author AND
Author.ID = Author.ID
ORDER BY Writings.Writings_Date desc;

$GetAuthorList = mysql_query($query_GetAuthorList, $connDerbyTrail)  or 
die(mysql_error());

$row_GetAuthorList = mysql_fetch_assoc($GetAuthorList);
$totalRows_GetAuthorList = mysql_num_rows($GetAuthorList);

david


David--

First of all, yours is purely a SQL problem, so would get better 
response from the PHP-DB or MySQL list.


But a quick glance at your SQL shows that your second query returns all 
writings by all authors because you don't include anything to narrow it 
down to one author:


WHERE
Writings.ID = Writings.ID
AND
Author.Autholr_Name = Writings.Writings_Author
AND
Author.ID = Author.ID

First of all:
Writings.ID = Writings.ID   and  Author.ID = Author.ID
are nonsense. Every query will match those crieria. In other words, 
you'd probably best take an hour or so to RTF 'Intro to SQL M.'


Here's another hint: You have no PHP variable in your SQL query. That 
means you execute the same exact query every time you run it. So you 
will get the same exact results every time.


So your solution is this: Include a PHP variable in your SQL query to 
specify which author you want to select.


You probably want something like this:
WHERE
Author.Author_Name = Writings.Author_Name
AND
Author.ID = '$MySelectedAuthorID'

(but remember to define $MySelectedAuthorId before running it :)

Good luck and post again with your progress.

John

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



Re: [PHP] Ajax please....

2006-04-08 Thread tedd

Ryan:


Carlin Bingham / Tedd:
---
Yes, but then I would have to reload the whole page just to tell the person
that the account username was already taken...thats how its traditionally
done...but I want to try doing it without reloading the whole page...hence
Asynchronous JavaScript And XML (AJAX) although the XML part at the end is
not really too accurate because from what I see you can (and i have) use
AJAX without any XML...in my case it would be AJAH or AJAT (H=HTML, T=TEXT)
:-p


Okay, you don't need to stick your tongue out -- I know what ajax is.

Please review:

http://www.xn--ovg.com/ajax

Is that what you want? If so, contact me privately and I'll provide 
you with the code. It's pretty simple really.


tedd
--

http://sperling.com

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



Re: [PHP] Creating a Photo Album

2006-04-08 Thread tedd

Paul:

To continue top-posting,

It's pretty simple, just store the images in a folder, place the 
url's to the images in MySQL, create a web page that can show an 
image and pulls the first one from the dB with a reference such that 
when someone clicks the picture, it increments and pulls the next 
image url from the dB and displays it.


Are you into programming or are you looking for someone to do it for you?

tedd


At 5:05 PM -0700 4/7/06, Paul Goepfert wrote:

updating by user click for now.  I might change that in the future to
update by interval.

Paul

On 4/7/06, tedd [EMAIL PROTECTED] wrote:

 At 12:13 AM -0700 4/7/06, Paul Goepfert wrote:
 Hi all,
 
 I am postilng pictures up on a website.  So far I have a picture per
 page. This will get not be very efficient as time goes on.  Is there
 anyway that I can have one page with only the image updating?  Can
 this be done in PHP.  If it can would someone explain it to me.  The
 only thing I k.now how to do well in PHP is mysql queries and data
 validatlion.
 
 Thanks,
 Paul

 Paul:

 Updating how? By a time interval, by a user click, or what?

 tedd
 --


 http://sperling.com

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





--

http://sperling.com

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



[PHP] What is best way to do handle audio files?

2006-04-08 Thread Nicholas Couloute
On my website http://www.sidekick2music.com ! I use scandir() [php 5.0] 
to fetch all the files which are all in subfolders of this one folder. 
like this:

public_html/amrs/$cat/$author/*.amr

$cat = different catergoried of music
$author = Authors of the particular catergory

This way isn't fast when you have over 5,000+ files.

I use flatfile for everything on the site!
site: http://www.sidekick2music.com

Would it run faster if I used mysql?
How would this be done?
Is there another way when dealing with files and organizing them? CMS?

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



Re: [PHP] include path file errors

2006-04-08 Thread kmh496
2006-04-08 (토), 18:20 +0900, kmh496 쓰시길:
 hi,
 my webroot is 
 
 /a/b/current/
 
 i am in /a/b/current/d/file.php
 
 file.php has a line
 
 require_once ($_SERVER[document_root]./d/common.php);
 
 common.php has a line which says
 
 require_once ($_SERVER[document_root]./_common.php);  
 // main include file for whole site
 
 it sends me no errors about missing files, but the variables inside main
 include file _common.php are not set and don't exist in file.php
 
 where is my mistake?
I am going to say this is screwed up.  i can't include a file inside
another included file and access its variables.  all i can do is include
the main file in every single file in a backwards manner -- reaching
down the chain -- because i find that if i do 2 includes then the
initail data is no longer included.  but sometimes there is magic going
on, but then i move one file and then the whole system breaks, it makes
me crazy.

even more so because i can't explain it well because it's so freaky.

is there no tutorial on advanced php with all this include stuff?

i RTMFM but the page didn't address advanced questions like that.  and
despite my english i believe i am advanced level.

thankx everybody.

joseph

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



[PHP] Re: [SPAM] Re: [PHP] a php image gallery

2006-04-08 Thread kmh496
2006-04-08 (토), 20:32 +1000, chris smith 쓰시길:
 On 4/8/06, Ross [EMAIL PROTECTED] wrote:
 
  Does anyone know know of a good php image gallery?  I want to generate the
  pages automatially from stored images.
 
  Please don't reply with 'search google under php gallery' or some other
  useless reply. I want someone to advise,  who has used code either free or
  paid for that is decent and is easy use.
 
 There was a recent thread:
 http://marc.theaimsgroup.com/?l=php-generalm=114439402126801w=2
 
 which lists a few.
 
 I use coppermine (coppermine.sf.net), gallery is pretty popular too
 (gallery.sf.net).

gallery is bug city.  i ran 2 versions of it for a year to show pics of
my familiy and it was down for most months of the year.  it ran fine,
actually, until an upgrade lost all my pictures.  then, i found it
again, and it wouldn't log me in.  i don't know what i did to it to
deserve that kind of treatment.  just read the forum links on
sourceforge.  everybody is reporting some new and different error on the
install alone.  let alone running it.  and it's a 10 MB download.  the
problem is it's overcoded.  there are 36 developers listed.  most
projects have just a couple.  

coppermine is better coded.  it's more straightforward.  the integration
is a pain, though, if you want to integrate with another user table from
another application.  

just my 2cents

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



[PHP] What is best way to do handle audio files?

2006-04-08 Thread Nicholas Couloute
On my website http://www.sidekick2music.com ! I use scandir() to fetch 
all the files which are all in subfolders of this one folder.

like this:
public_html/amrs/$cat/$author/*.amr

$cat = different catergoried of music
$author = Authors of the particular catergory

This way isn't fast when you have over 5,000+ files.

I use flatfile for everything on the site!
site: http://www.sidekick2music.com

Would it run faster if I used mysql?
How would this be done?
Is there another way when dealing with files and organizing them? CMS?

~Nick Couloute
co-owner/Web Designer
Sidekick2Music.Com

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



Re: [PHP] include path file errors

2006-04-08 Thread John Hicks
kmh496 wrote:
 2006-04-08 (토), 18:20 +0900, kmh496 쓰시길:
 
hi,
my webroot is 

/a/b/current/

i am in /a/b/current/d/file.php

file.php has a line

require_once ($_SERVER[document_root]./d/common.php);

common.php has a line which says

require_once ($_SERVER[document_root]./_common.php);  
// main include file for whole site

it sends me no errors about missing files, but the variables inside main
include file _common.php are not set and don't exist in file.php

where is my mistake?
 
 I am going to say this is screwed up.  i can't include a file inside
 another included file and access its variables.  all i can do is include
 the main file in every single file in a backwards manner -- reaching
 down the chain -- because i find that if i do 2 includes then the
 initail data is no longer included.  but sometimes there is magic going
 on, but then i move one file and then the whole system breaks, it makes
 me crazy.
 
 even more so because i can't explain it well because it's so freaky.
 
 is there no tutorial on advanced php with all this include stuff?
 
 i RTMFM but the page didn't address advanced questions like that.  and
 despite my english i believe i am advanced level.
 
 thankx everybody.
 
 joseph

Just a thought:

Are your variable definitions, by any chance, inside functions? That
would explain why they aren't set when you continue. The 'global'
statement will help in that case.

I can assure you that includes are not advanced PHP. You should be
able to do what you are trying to do. There is no doubt a simple
explanation for your problem. Finding it is always the hard part.
Patience and perserverence and calm rational thought will get you there.

Good luck.

John

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



Re: [PHP] include path file errors

2006-04-08 Thread John Hicks

kmh496 wrote:

hi,
my webroot is 


/a/b/current/

i am in /a/b/current/d/file.php

file.php has a line

require_once ($_SERVER[document_root]./d/common.php);

common.php has a line which says

require_once ($_SERVER[document_root]./_common.php);  
// main include file for whole site


it sends me no errors about missing files, but the variables inside main
include file _common.php are not set and don't exist in file.php

where is my mistake?


muchas gracias.


KMH--

It's hard to say without seeing your code, but here are a few thoughts.

Remember that require_once is conditional. A given file will only be
included once for an entire response. (You might patch them from
'require_once' to 'require' to see if that makes a difference, although
of course it may break something else.)

You may need to do some basic trace debugging: i.e. inserting displays
(echos to the output or error_log() entries) to trace exactly what is
happening.

Good luck!

John

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



Re: [PHP] microtime questions

2006-04-08 Thread tedd

Brad:

Calm down, I'm simply asking for an explanation

Please tell me where it say Negative times are expected??  I 
don't see it.


If you will refresh the below link several times, as I asked, you 
will see it report negative times occasionally.


ttp://www.xn--ovg.com/microtime.php

That's not my imagination, that's fact!

 And take a class on Operating System Theroy!  If you want a real 
time OS, then get a real time OS, otherwise realize that although 
you MAY be executing the same code, it may take different amounts of 
time to execute that code.  That's how scheduling works.  If you 
want performance measurements then take a sample and average them 
out.


You know, you don't have to be rude. It might pay occasionally for 
you to try to understand what the person is asking before ranting on 
about things you have difficulty with.


Telling anyone that they don't know something when you have 
absolutely no idea of what they do, or don't, know is certainly not 
the most professional conduct, is it?


However, by your replies we do know is that you have no idea as to 
what the problem presented actually was, let alone an explanation for 
it. If you're not going to be helpful, then don't reply. Besides, 
what's the point?


In contrast to you, Joe Wollard read what I wrote and responded with 
a helpful answer.


Thank you Joe.

tedd

--

http://sperling.com

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



Re: [PHP] php newbie having trouble going to detail page

2006-04-08 Thread David Doonan

On Apr 8, 2006, at 11:24 AM, John Hicks wrote:

So your solution is this: Include a PHP variable in your SQL query  
to specify which author you want to select.


You probably want something like this:
WHERE
Author.Author_Name = Writings.Author_Name
AND
Author.ID = '$MySelectedAuthorID'

(but remember to define $MySelectedAuthorId before running it :)


John,

Taken your suggestion and added a variable, but the list page is now  
returning no records. The ID, which is showing up in the URL, is  
being passed from the first page to the list page (http://localhost/ 
Der/writings/author.php?ID=5) but the list page is not accepting that  
variable


New Query for list page=
mysql_select_db($database_connDer, $connDer);
$recordID = $_GET['recordID'];
$query_GetAuthorList = SELECT Writings.Writings_Author,  
Writings.Writings_Title, DATE_FORMAT(Writings_Date, '%M %D, %Y') as  
Writings_Date, Writings.Writings_Text, Writings.ID,  
Author.Autholr_Name, Author.ID FROM Writings, Author

WHERE  Author.Autholr_Name = Writings.Writings_Author and
   Author.ID = '$recordID'
ORDER BY Writings.Writings_Date desc;
$GetAuthorList = mysql_query($query_GetAuthorList, $connDerl) or die 
(mysql_error());

$row_GetAuthorList = mysql_fetch_assoc($GetAuthorList);
$totalRows_GetAuthorList = mysql_num_rows($GetAuthorList);

If this were a ColdFusion page, I would simply replace Author.ID =  
'$recordID' with ID = #ID#.


I'll take your suggestion and post in the PHP-DB list.

david

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



Re: [PHP] microtime questions

2006-04-08 Thread tedd

At 1:48 PM -0400 4/7/06, Joe Wollard wrote:
I just realized that I could check your version, and it appears that 
we've found the problem. You're running PHP 4.3.10, so I'd suggest 
using the non PHP5 work around on http://php.netphp.net's site.


Cheers!
- Joe



-Joe:

Thanks very much for your most excellent explanation -- it all makes 
sense now. I was expecting mcrotime(true or not) to return an every 
increasing value. Interesting how it works.


In any event, I was able to get much better timing function results 
by going with:


$floattime = array_sum(explode(chr(32), microtime()));

The demo can be seen at:

http://www.xn--ovg.com/a12.php

Thanks again for your most professional help.

tedd
--

http://sperling.com

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



Re: [PHP] include path file errors

2006-04-08 Thread kmh496
2006-04-08 (토), 12:18 -0400, John Hicks 쓰시길:
 kmh496 wrote:
  2006-04-08 (토), 18:20 +0900, kmh496 쓰시길:
  
 hi,
 my webroot is 
 
 /a/b/current/
 
 i am in /a/b/current/d/file.php
 
 file.php has a line
 
 require_once ($_SERVER[document_root]./d/common.php);
 
 common.php has a line which says
 
 require_once ($_SERVER[document_root]./_common.php);  
 // main include file for whole site
 
 it sends me no errors about missing files, but the variables inside main
 include file _common.php are not set and don't exist in file.php
 
 where is my mistake?
  
 Just a thought:
 
 Are your variable definitions, by any chance, inside functions? That
 would explain why they aren't set when you continue. The 'global'
 statement will help in that case.
 
 I can assure you that includes are not advanced PHP. You should be
 able to do what you are trying to do. There is no doubt a simple
 explanation for your problem. Finding it is always the hard part.
 Patience and perserverence and calm rational thought will get you there.
the problem is when i want to expand a site with a new application,
usually that comes in its own directory.  but, to include the new
application i have to wrap it inside the main directory -- in this
case /a/b/current   which requires of course that i call
first /a/b/current/common.php which starts the sessions, sends the
cookies, checks post variables.  

but that doesn't work, really, because then all of the includes for the
application says include(main.php) ... but php thinks it's
in /a/b/current not in /a/b/current/d/ . so it says cannot find
include file main.php in path:  path:::;; ..

my wish list:
1) applications came with a configurable directory to preced every
include or require.  
like, change include(main.php) --  include( $config[dir] .
main.php )

alternatively, 
2) all applications come with a unique prefix affixed to the files so
they can simply be laid out in the document root and be visually and
mentally and upgradably separate from the files of the other
applications existing in the same $_SERVER[document_root]


i honestly don't understand the include mechanism.  i have encountered
many cases ( sorry, can't be explicit) where a file which was 2 includes
away wouldn't have any variables in the main script, unless i added a
line to include that file in that file directly.  

as an example:

/a/b/current/index.php
include(common.php);
include(lib/functions2.php);
/a/b/current/lib/functions2.php 
you would think would be able to simply run with what was 
included above it but you can't.  you have to redeclare

include_once($g4[bbs]. /dbconfig.php);
include_once($g4[bbs]. /common.php);

the include of the common.php file.

i am looking for the rule for that they say it's global, but it's
not.  However, i found that if you include common.php again then it
finds the functions it misses, because it itself was included by
common.php.  as if the direction of the includes matters .
explicitly:
if common.php includes lib/functions.php common.php can access
lib/functions.php
but if lib/functions.php needs common.php then lib/functions.php needs
to include common.php

is that correct?

because of these problems, when i have to wrap another application
inside an existing SKIN and common.php, i end up changing the file
names, running a SED script to replace all occurrences of filenames with
their newly-uniquely-prefixed-names .  

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



Re: [PHP] php newbie having trouble going to detail page

2006-04-08 Thread John Hicks

David Doonan wrote:

On Apr 8, 2006, at 11:24 AM, John Hicks wrote:

So your solution is this: Include a PHP variable in your SQL query  to 
specify which author you want to select.


You probably want something like this:
WHERE
Author.Author_Name = Writings.Author_Name
AND
Author.ID = '$MySelectedAuthorID'

(but remember to define $MySelectedAuthorId before running it :)



John,

Taken your suggestion and added a variable, but the list page is now  
returning no records. The ID, which is showing up in the URL, is  being 
passed from the first page to the list page (http://localhost/ 
Der/writings/author.php?ID=5) but the list page is not accepting that  
variable


New Query for list page=
mysql_select_db($database_connDer, $connDer);
$recordID = $_GET['recordID'];
$query_GetAuthorList = SELECT Writings.Writings_Author,  
Writings.Writings_Title, DATE_FORMAT(Writings_Date, '%M %D, %Y') as  
Writings_Date, Writings.Writings_Text, Writings.ID,  
Author.Autholr_Name, Author.ID FROM Writings, Author

WHERE  Author.Autholr_Name = Writings.Writings_Author and
   Author.ID = '$recordID'
ORDER BY Writings.Writings_Date desc;
$GetAuthorList = mysql_query($query_GetAuthorList, $connDerl) or die 
(mysql_error());

$row_GetAuthorList = mysql_fetch_assoc($GetAuthorList);
$totalRows_GetAuthorList = mysql_num_rows($GetAuthorList);

If this were a ColdFusion page, I would simply replace Author.ID =  
'$recordID' with ID = #ID#.


I'll take your suggestion and post in the PHP-DB list.

david


David--

Note that your request URL has a value for 'ID' whereas your program is 
looking for a value for 'recordID'.


Try displaying your SQL query on the output page. I have a hunch it'll 
say Author.ID = ''


--John

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



Re: [PHP] What is best way to do handle audio files?

2006-04-08 Thread tedd

At 12:01 PM -0400 4/8/06, Nicholas Couloute wrote:
On my website http://www.sidekick2music.com ! I use scandir() [php 
5.0] to fetch all the files which are all in subfolders of this one 
folder. like this:

public_html/amrs/$cat/$author/*.amr

$cat = different catergoried of music
$author = Authors of the particular catergory

This way isn't fast when you have over 5,000+ files.

I use flatfile for everything on the site!
site: http://www.sidekick2music.com

Would it run faster if I used mysql?
How would this be done?
Is there another way when dealing with files and organizing them? CMS?


Nicholas:

You certainly can use MySQL to store the url's to the sound files OR 
the sound files themselves -- MySQL can handle both ways and both 
ways have their advantages and disadvantages.


However, in either event, using MySQL is in my mind a preferable 
method of organizing a large data set.


You'll need to set up a MySQL database, with a table containing the 
name, catalog, artist, and whatever else you want. Then you'll need 
to enter the data and finally set up your web site to dynamically 
access the dB and pull out what the user wants. I've done this with 
several sites, but I charge.


However, it's certainly something that you can receive free help from 
this list.


tedd


--

http://sperling.com

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



Re: [PHP] include file path errors

2006-04-08 Thread tedd

At 6:15 PM +0900 4/8/06, kmh496 wrote:

hi,
my webroot is

/a/b/current/

i am in /a/b/current/d/file.php

file.php has a line

require_once ($_SERVER[document_root]./d/common.php);

it finds the file, but the variables inside common.php are not set and
don't exist in file.php

where is my mistake?


Probably in your links -- the methodology should work.

tedd
--

http://sperling.com

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



Re: [PHP] Ajax please....

2006-04-08 Thread Ryan A
 Hey

CLIP
Carlin Bingham / Tedd:
---
Yes, but then I would have to reload the whole page just to tell the person
that the account username was already taken...thats how its traditionally
done...but I want to try doing it without reloading the whole page...hence
Asynchronous JavaScript And XML (AJAX) although the XML part at the end is
not really too accurate because from what I see you can (and i have)use
AJAX without any XML...in my case it would be AJAH or AJAT (H=HTML, T=TEXT)
:-p

Okay, you don't need to stick your tongue out -- I know what ajax is.

Please review:

http://www.xn--ovg.com/ajax

Is that what you want? If so, contact me privately and I'll provide
you with the code. It's pretty simple really.
/CLIP

Hehe, didnt mean anything about sticking out my tongue or writing what
A.J.A.X stands for...
except it kind of sounded intelligent and hey, why should Jay, Chris, Rasmus
(to name three off the
top of my head) be the only ones to say really intelligent (and intelligent
sounding) stuff? :-D

Thanks for the link, examples and offer for the code, will get back to you
about it as am still testing
YAHOO!'s package and four others that seem quite good...each have they own
advantages and disadvantages,
I'm quite happy I took the time to check out different systems/packages
instead of sticking to the most
popular one or most widely used one etc now i can settle on the best one for
my requirments...
BTW, while we are on the subjectwhich one do you use?

Cheers!

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



Re: [PHP] php newbie having trouble going to detail page

2006-04-08 Thread David Doonan

On Apr 8, 2006, at 12:55 PM, John Hicks wrote:


$recordID = $_GET['recordID'];


Note that your request URL has a value for 'ID' whereas your  
program is looking for a value for 'recordID'.


Changed above to:
$recordID = $_GET['ID'];

And all was right with the world.

Thanks John!

david

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



Re: [PHP] Creating a Photo Album

2006-04-08 Thread Paul Goepfert
I'm not looking for someome to do it for me.  I would like to learn
how to do this my self.  I have written code in Java and C/C++ before.
 From the function list in the PHP manual some of the functions look
like the C/C++ functions.

Thanks,
Paul

On 4/8/06, tedd [EMAIL PROTECTED] wrote:
 Paul:

 To continue top-posting,

 It's pretty simple, just store the images in a folder, place the
 url's to the images in MySQL, create a web page that can show an
 image and pulls the first one from the dB with a reference such that
 when someone clicks the picture, it increments and pulls the next
 image url from the dB and displays it.

 Are you into programming or are you looking for someone to do it for you?

 tedd


 At 5:05 PM -0700 4/7/06, Paul Goepfert wrote:
 updating by user click for now.  I might change that in the future to
 update by interval.
 
 Paul
 
 On 4/7/06, tedd [EMAIL PROTECTED] wrote:
   At 12:13 AM -0700 4/7/06, Paul Goepfert wrote:
   Hi all,
   
   I am postilng pictures up on a website.  So far I have a picture per
   page. This will get not be very efficient as time goes on.  Is there
   anyway that I can have one page with only the image updating?  Can
   this be done in PHP.  If it can would someone explain it to me.  The
   only thing I k.now how to do well in PHP is mysql queries and data
   validatlion.
   
   Thanks,
   Paul
 
   Paul:
 
   Updating how? By a time interval, by a user click, or what?
 
   tedd
   --
 
 
   http://sperling.com
 
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 --
 
 http://sperling.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] Ajax please....

2006-04-08 Thread Manuel Lemos
Hello,

on 04/08/2006 10:53 AM Ryan A said the following:
 Carlin Bingham / Tedd:
 ---
 Yes, but then I would have to reload the whole page just to tell the person
 that the account username was already taken...thats how its traditionally
 done...but I want to try doing it without reloading the whole page...hence
 Asynchronous JavaScript And XML (AJAX) although the XML part at the end is
 not really too accurate because from what I see you can (and i have) use
 AJAX without any XML...in my case it would be AJAH or AJAT (H=HTML, T=TEXT)
 :-p

There is a misunderstanding here. The X does not necessarily means
generic XML. It may mean XHTML. Anyway, an AJAX request may server any
type of data.

Another point is that AJAX does not mean necessarily using
XMLHttpRequest objects . As you may read in the Wikipedia definition,
many AJAX frameworks use IFrame.

http://en.wikipedia.org/wiki/Ajax_%28programming%29

There are certain things that it is not possible to achieve with
XMLHttpRequests, like form file uploads .

Other than the fact that ActiveX may be disabled, XMLHttpRequest objects
are often inneficient and slower. For instance, if you want to execute
some action that may take some time on the server, you cannot give any
progress feedback in the same request because the response of a
XMLHttpRequest is only available to the browser when it is completely
received.

OTOH if you use an hidden IFrame based solution, you can start sending
the response right away, and use script sections with Javascript to
start executing one or more actions on the browser even before the
server has finished to execute its task. This is very good to give
progress feedback.

You simply can't do that with XMLHttpRequest. Even if you keep polling
the server repeatedly, it is not the same thing as making it all with a
single request as you can with hidden IFrame, and you waste bandwidth
and impose additional server load.


 The other thing is, I thought I would start with something simple but still
 real world and then work myself up to more complex stuff thats how I
 learnt PHP; even though I didnt start with the Hello world in PHP I
 started with basic strings and with the help of a book (PHP Blackbook) and
 this list (better than any book) I rarely program in anything other than PHP
 now.

That is why I suggested that to take a look at the test_ajax_form.php
example of this forms package:

http://www.phpclasses.org/formsgeneration


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] Ajax please....

2006-04-08 Thread Ryan A
Hey,

clip There is a misunderstanding here. The X does not necessarily means
generic XML. It may mean XHTML. Anyway, an AJAX request may server any
type of data.

Another point is that AJAX does not mean necessarily using
XMLHttpRequest objects . As you may read in the Wikipedia definition,
many AJAX frameworks use IFrame.
/clipH, I guess I forgot about the X in XHTML, but if you look on the
SEs most of theresults for AJAX come up with X being XML...maybe thats what
the idea was in the beginning?CLIP
Other than the fact that ActiveX may be disabled, XMLHttpRequest
objects
are often inneficient and slower. For instance, if you want to execute
some action that may take some time on the server, you cannot give any
progress feedback in the same request because the response of a
XMLHttpRequest is only available to the browser when it is completely
received./CLIP
Actually, in my search for AJAX on google, I did find some ways that you can
give the user a waiticon or some feedback while you are doing something in
the backgroundYou might be interested in this:
http://www.sergiopereira.com/articles/prototype.js.html looking viagoogle
you should find other links...also dont forget Gmail has some real good live
working ajaxexamples as you login there including a very good ajax file
upload system...check it out.clip The other thing is, I thought I would
start with something simple but
still
 real world and then work myself up to more complex stuff thats
how I...

That is why I suggested that to take a look at the test_ajax_form.php
example of this forms package:

http://www.phpclasses.org/formsgeneration/clipIts on my todo list, I'm
checking out the packages one by one in the same order that suggestionswere
sent to me from the list and from what I found on google.Thanks,Ryan

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



Re: [PHP] Ajax please....

2006-04-08 Thread Robert Cummings
On Sat, 2006-04-08 at 14:40, Manuel Lemos wrote:
 Hello,
 
 on 04/08/2006 10:53 AM Ryan A said the following:
  Carlin Bingham / Tedd:
  ---
  Yes, but then I would have to reload the whole page just to tell the person
  that the account username was already taken...thats how its traditionally
  done...but I want to try doing it without reloading the whole page...hence
  Asynchronous JavaScript And XML (AJAX) although the XML part at the end is
  not really too accurate because from what I see you can (and i have) use
  AJAX without any XML...in my case it would be AJAH or AJAT (H=HTML, T=TEXT)
  :-p
 
 There is a misunderstanding here. The X does not necessarily means
 generic XML. It may mean XHTML. Anyway, an AJAX request may server any
 type of data.
 
 Another point is that AJAX does not mean necessarily using
 XMLHttpRequest objects . As you may read in the Wikipedia definition,
 many AJAX frameworks use IFrame.

 [-- SNIP PIMPING OF IFRAMES --]

I'm probably just having a bowel movement or something, but I think
going with a lib that supports either iframe or xmlhttprequest
interchangeably is probably the way to go. While iframe may have more
features and less instability surrounding it right now, you can probably
bet your ass, xmlhttprequest is going to become the standard for the
simple reason that it's purpose was to do this kind of thing, whereas
iframes are a dirty little hack :)

I would just hate to have to rewrite everything once iframes start
sucking. And no, I don't currently know of an ajax lib that does this,
but I'll certainly be making mine do so in the near future :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Creating a Photo Album

2006-04-08 Thread Robert Cummings
On Sat, 2006-04-08 at 14:00, Paul Goepfert wrote:
 I'm not looking for someome to do it for me.  I would like to learn
 how to do this my self.  I have written code in Java and C/C++ before.
  From the function list in the PHP manual some of the functions look
 like the C/C++ functions.

That's a good observation. PHP drew a lot of it's initial design
directly from C.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Ajax please....

2006-04-08 Thread Ryan A
On Sat, 2006-04-08 Robert Cummings wrote: [-- SNIP PIMPING OF
IFRAMES --]HEHHEHE funnyI started picturing a guy with loud colors, a
big hat and live fish in his heels...LOLCheers,Ryan

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



Re: [PHP] Timestamp needed in error log

2006-04-08 Thread darren kirby
quoth the John Hicks:
 I would like to configure my PHP 4.3 to include a timestamp in its error
 messages.

 It appears that PHP defaults to no timestamp. I can't a find a directive
 that allows me to configure this.

 Do I have to recompile?

 I've never looked at the source before. Any pointers on where I should
 look for the error message generation?

 I posted a similar query a week ago and got no response.

 Any response would be appreciated:

 --Does anyone have a PHP that is configured with a timestamped error log?

 --Is there a reason not to have a timestamp?

 --Would you, like me, like to have the date and time in the error messages?

 Thanks,

 John Hicks

You don't explain much about your setup here, but on mine, I just write my 
errors to the apache error log, which provides its own timestamp. 

Another option is to log to the system logs:
error_log = syslog  # in php.ini

and use your loggers filter facilities to keep the php messages in a separate 
file. Again, here syslog will provide its own timestamp.

-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
...the number of UNIX installations has grown to 10, with more expected...
- Dennis Ritchie and Ken Thompson, June 1972


pgphwxW1z7255.pgp
Description: PGP signature


Re: [PHP] Ajax please....

2006-04-08 Thread Manuel Lemos
Hello,

on 04/08/2006 04:23 PM Ryan A said the following:
 Hey,

 clip There is a misunderstanding here. The X does not necessarily means
 generic XML. It may mean XHTML. Anyway, an AJAX request may server any
 type of data.

 Another point is that AJAX does not mean necessarily using
 XMLHttpRequest objects . As you may read in the Wikipedia definition,
 many AJAX frameworks use IFrame.
 /clipH, I guess I forgot about the X in XHTML, but if you look
on the
 SEs most of theresults for AJAX come up with X being XML...maybe thats
what
 the idea was in the beginning?

That is because last year Jesse James Garrett coined the AJAX term as
something that uses XMLHttpRequest object, but if you know that object,
you know that it can make HTTP request that return any type of data.



 CLIP
 Other than the fact that ActiveX may be disabled, XMLHttpRequest
 objects
 are often inneficient and slower. For instance, if you want to execute
 some action that may take some time on the server, you cannot give any
 progress feedback in the same request because the response of a
 XMLHttpRequest is only available to the browser when it is completely
 received./CLIP
 Actually, in my search for AJAX on google, I did find some ways that
you can
 give the user a waiticon or some feedback while you are doing something in
 the backgroundYou might be interested in this:

You are missing the point. If you want to perform a lengthy task, say
send a newsletter to thousands of users, the wait icon has nothing to do
with AJAX and is a very limited form of feedback.

Using IFrame not only the server can perform the task and at the same
time update the browser to tell how much of the task has been performed
and give an estimate of how much time is remaining, updating that
progres feedback regularly with accurate figures from the server.

You can't achieve this with a single XMLHttpRequest in the same request
that starts and runs the lengthy task.


 http://www.sergiopereira.com/articles/prototype.js.html looking viagoogle
 you should find other links...also dont forget Gmail has some real
good live
 working ajaxexamples as you login there including a very good ajax file
 upload system...check it out.

FYI Gmail uses IFrames extensively.

Anyway, the point about file upload restriction is that it is impossible
to send files via XMLHttpRequest. For security reasons Javascript code
cannot have access to the contents of the files in the user disk.
Without that, you cannot compose and send a HTTP request with
XMLHttpRequest object.

As with IFrame you do not need to access the contents of the files. You
just need to set the target of a form with an file upload input to point
to the IFRAME id and then submit the form.

Not only this is a viable solution to upload files, but it takes much
less Javascript code to execute.


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] Ajax please....

2006-04-08 Thread Manuel Lemos
Hello,

on 04/08/2006 04:13 PM Robert Cummings said the following:
 I'm probably just having a bowel movement or something, but I think
 going with a lib that supports either iframe or xmlhttprequest
 interchangeably is probably the way to go. While iframe may have more
 features and less instability surrounding it right now, you can probably
 bet your ass, xmlhttprequest is going to become the standard for the
 simple reason that it's purpose was to do this kind of thing, whereas
 iframes are a dirty little hack :)

Have you tried uploading files with XMLHttpRequest?

Have you tried making a single request with XMLHttpRequest to execute a
task on the server and obtain progress feedback within the same response?

Have you tried developing a AJAX solution based on XMLHttpRequest for a
wide audience that applied the latest Microsoft service pack that
disables ActiveX for IE ?

Once you try common things like this, you will see better which solution
is the dirty little hack. ;-)


 I would just hate to have to rewrite everything once iframes start
 sucking. And no, I don't currently know of an ajax lib that does this,
 but I'll certainly be making mine do so in the near future :)

Right, once you try things for yourself you will reach the same
conclusions like I have that XMLHttpRequest is the solution that it
s*cks. ;-)

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] Ajax please....

2006-04-08 Thread Satyam
May I supply this very little example to show how easy it can be to use 
iFrame?


This is the first document:

iframe id=myFrame/iframe
input type=button value=go
   onclick=document.getElementById('myFrame').src='second.htm' /
div id=myDiv/div

It just has an iframe, an action button, which sets the src property of the 
iframe and a div to store the response.


The document second.htm contains:

body onLoad=parent.document.getElementById('myDiv').innerHTML = 'hello!'; 
/


That's it.

I placed this in the onLoad event, to make sure nothing gets executed before 
everything is loaded, but I might as well do this:


scriptparent.document.getElementById('myDiv').innerHTML = 
'Hello!';/script


And it also works, though should it invoke a function not yet loaded, it 
would fail.
Instructions set as this last one might move a progress bar while the 
scripts are being loaded.
For example, if the information sent comes from database records, a row 
count can be queried first and insterspersed with the actual data of the 
rows, a progress bar might be moved a fraction of that row count.  (this 
would count for communication from the server to the browser since that bar 
wouldn't move until the first instruction of the response is received)


This, of course, are very minimal documents just containing what's essential 
to prove the point, not working documents and, of course, both might be PHP 
scripts.


Satyam 


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



Re: [PHP] Ajax please....

2006-04-08 Thread Greg Beaver
Robert Cummings wrote:
 On Sat, 2006-04-08 at 14:40, Manuel Lemos wrote:
 
Hello,

on 04/08/2006 10:53 AM Ryan A said the following:

Carlin Bingham / Tedd:
---
Yes, but then I would have to reload the whole page just to tell the person
that the account username was already taken...thats how its traditionally
done...but I want to try doing it without reloading the whole page...hence
Asynchronous JavaScript And XML (AJAX) although the XML part at the end is
not really too accurate because from what I see you can (and i have) use
AJAX without any XML...in my case it would be AJAH or AJAT (H=HTML, T=TEXT)
:-p

There is a misunderstanding here. The X does not necessarily means
generic XML. It may mean XHTML. Anyway, an AJAX request may server any
type of data.

Another point is that AJAX does not mean necessarily using
XMLHttpRequest objects . As you may read in the Wikipedia definition,
many AJAX frameworks use IFrame.

[-- SNIP PIMPING OF IFRAMES --]
 
 
 I'm probably just having a bowel movement or something, but I think
 going with a lib that supports either iframe or xmlhttprequest
 interchangeably is probably the way to go. While iframe may have more
 features and less instability surrounding it right now, you can probably
 bet your ass, xmlhttprequest is going to become the standard for the
 simple reason that it's purpose was to do this kind of thing, whereas
 iframes are a dirty little hack :)
 
 I would just hate to have to rewrite everything once iframes start
 sucking. And no, I don't currently know of an ajax lib that does this,
 but I'll certainly be making mine do so in the near future :)

HTML_AJAX (http://pear.php.net/HTML_AJAX) has had iframe fallback
support since I first checked it out in version  0.2.0

Greg

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



Re: [PHP] Ajax please....

2006-04-08 Thread Robert Cummings
On Sat, 2006-04-08 at 15:54, Manuel Lemos wrote:
 Hello,
 
 on 04/08/2006 04:13 PM Robert Cummings said the following:
  I'm probably just having a bowel movement or something, but I think
  going with a lib that supports either iframe or xmlhttprequest
  interchangeably is probably the way to go. While iframe may have more
  features and less instability surrounding it right now, you can probably
  bet your ass, xmlhttprequest is going to become the standard for the
  simple reason that it's purpose was to do this kind of thing, whereas
  iframes are a dirty little hack :)
 
 Have you tried uploading files with XMLHttpRequest?
 
 Have you tried making a single request with XMLHttpRequest to execute a
 task on the server and obtain progress feedback within the same response?
 
 Have you tried developing a AJAX solution based on XMLHttpRequest for a
 wide audience that applied the latest Microsoft service pack that
 disables ActiveX for IE ?
 
 Once you try common things like this, you will see better which solution
 is the dirty little hack. ;-)
 
 
  I would just hate to have to rewrite everything once iframes start
  sucking. And no, I don't currently know of an ajax lib that does this,
  but I'll certainly be making mine do so in the near future :)
 
 Right, once you try things for yourself you will reach the same
 conclusions like I have that XMLHttpRequest is the solution that it
 s*cks. ;-)

You're preaching to the choir. I didn't dispute any of the current
advantages of iframes. If you re-read my message I indicate the status
quo right now favours iframes for functionality and stability but that
the tide will more than likley change in favour of the industry standard
XmlHttpRequest. Nobody likes dirty little hacks, and despite the current
merits of iframes, they remain a dirty little hack.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] headers already sent.

2006-04-08 Thread Stephen Lake
There is no real way of knowing if output is going to be sent before a 
header or not, unless its a very simple page.

Your best bet is to investigate the output buffering functions here:
http://www.php.net/manual/en/ref.outcontrol.php

HTH
Steve


P. Guethlein [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 At 10:30 PM 04/07/2006, you wrote:
Comment inline:

 Thanks,  I just found that out after, well I don't want to say how long it 
 took smile.

 Is that just the way things are in PHP or is there a command / 
 configuration to make something like this more obvious?  Hmmm. maybe 
 the IDE I'm using?  Using EnginSite.  Is there a better one for a Windows 
 Environment ?

 ( head banging against wall )

 -Pete




P. Guethlein wrote:
(Know enough to be dangerous beginner...)

Routine for a web login asked user name and password.

User Name is entered correctly.

Password is Incorrect.

Next Try.

User Name is enter correctly.

Password is Entered Correctly.

PHP notifies me on the html output that I am logged in.  However, an 
error is appearing in text above the html output.  It states

Warning: Cannot modify header information - headers already sent by 
(output started at D:\webpages\\users.inc:11) in 
D:\webpages\\web\loginfunctions.php on line 26

Users.inc is

==
?php
$domain = 'localhost';
$admin = 'x';
$user = 'x';
$web = 'x';
$password = 'xx';
$site = 'x';
$leads = 'x';
?
This gap right here, it's outputting a carriage return and/or linefeed. 
headers get sent on the first character of output being sent.
?php
// Configuration settings for My Site

// Email Settings
$mailsite['from_name'] = 'x Website'; // from email name
$mailsite['from_email'] = '[EMAIL PROTECTED]'; // from email address

// Just in case we need to relay to a different server,
// provide an option to use external mail server.
$mailsite['smtp_mode'] = 'enabled'; // enabled or disabled
$mailsite['smtp_host'] = 'mail..xxx;mail.x2.xxx';
$mailsite['smtp_port'] = '25';
$mailsite['smtp_username'] = null;
?
===

Line 26 from the loginfunctions.php file is

//now redirect the user to whatever page they wanted.
header('Location: index.php?href='.$link);

==

I can anticipate what the problem is with the notification that PHP gives 
me with the headers already output.  However, it says 'headers already 
sent by users.inc', huh?

Suggestions of where to look on this bug is appreciated!

-Pete

--
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] Binary Data / Strings

2006-04-08 Thread Richard Lynch
Background:

I'm using cURL to snarf down a web page and examine an image in that
page -- where I would like to be able to use
http://php.net/imagecolorat on the image.

There are some wrinkles, however, best explained by a slimmed-down
sample program:
?php
function foo(){
  global $curl;
  if (!isset($curl)) $curl = curl_init();

  //Fetch HTML
  curl_setopt($curl, CURLOPT_RETURNTRANSFER);
  curl_setopt($curl, CURLOPT_COOKIEJAR, 'cookies');
  curl_setopt($curl, CURLOPT_COOKIEFILE, 'cookies');
  curl_setopt($curl, CURLOPT_URL, 'http://example.com');
  $html = curl_exec($curl);

  //Fetch image:
  preg_match('/img src=([^]*/', $html, $image_url);
  $image_url = $image_url[1];
  curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1); //Getting binary data
  curl_setopt($curl, $image_url);
  $image_string = curl_exec($curl);
  curl_setopt9$curl, CURLOPT_BINARYTRANSFER, 0); //Set it BACK to text!

  //SOMETIMES that URL sends me this for an image:
  $bad_data = 'META HTTP-EQUIV=Refresh URL=0;http://example.com;';
  if (stristr($image_string, $bad_data)){
//start all over again:
return foo();
  }

  //Use GD to get image:
  $image = imagecreatefromstring($image_string);

  //Begin analysis
  //irrelevant to the problem, deleted.
  $result = 'foo';

  return $result;
}

//Assume  the image changes on every page hit, and we call foo() a LOT
for ($i = 0; $i  10; $i++){
  echo foo();
  sleep(mt_rand(1, 5); //Don't kill their server
}

?

NOW, for the problem[s].

#1.
If I don't use BINARYTRANSFER, then imagecreatefromstring segfaults,
pretty much every time.  Well usually, anyway.

Presumably, that's because cURL/PHP are pretending the string is
null-terminated when it's not, and then handing a corrupted image
string to GD, and that's bad.  Or, perhaps, without BINARYTRANSFER,
some sort of CRLF correction is corrupting the binary data.  I dunno,
really.  I just figured I got binary data coming in, and I must want
BINARYTRANSFER, based on what I can find documented.

So, assuming BINARYTRANSFER means what I think it means, I need that.

I've put in a bug report here, and pajoye is being VERY helpful, in
hopefully getting segfault to be an E_ERROR instead of segfault:

http://bugs.php.net/bug.php?id=37005

So this one will probably get resolved, eventually.

But I'm hoping for a pointer to a longer explanation of what
BINARYTRANSFER actually does, as I've only found rather circular/brief
definitions so far on php.net and I'm not finding anything on the
libcurl page here:
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html

A quick Google also yielded only the barest circular definition:
CURLOPT_BINARYTRANSFER
TRUE to return the raw output when CURLOPT_RETURNTRANSFER is used.

I mean, yeah, guys, I know what the words BINARY and raw output
mean, and the docs pretty much tell me they are synonyms...  That's
not real useful, eh? :-) :-) :-)

#2.
Once I start using BINARYTRANSFER, however...

I *still* get segfaults sometimes, even when everything else seems to
be okay.
This is happening in *all* of these versions from CGI compile on
command-line usage:
PHP 5.0.4
PHP 5.1.2
PHP 5.1.2RC3

So, perhaps my use of BINARYTRANSFER is completely wrong, and merely
masks the real problem a little bit?

The segfault DOES happen at different points in the different versions
of PHP. 5.0.4 segfaults within call to imagecreatefromstring()
5.1.2RC3 segfaults at some later point.

#3.
It seems like once is set BINARYTRANSFER to 1, setting it back to 0 is
not taking effect...

I say this because after a recursive call to foo() to start over, I
get $html filled with data such as:

htmlhead.../headbody.../body/htmlZZZ...?more
garbage data

I.E., it seems like curl and/or PHP are ignoring null-terminated data,
and using some other indicator to define the end of a string.

As additional evidence, I get messages such as:

Run-time warning. String is not zero-terminated (   ) (source:
/php-5.1.2/Zend/zend_variables.h:45) in /script.php:128
/php-5.1.2/Zend/zend-hash.c(754) : ht=0x8381124 is being cleaned

Now, I dunno what all that is supposed to mean, but I'm pretty sure
it's a sign of things going drastically wrong with a string being
treated as binary data when it's not or vice versa...

Is it not possible to switch CURLOPT_BINARYTRANSFER back to 0 ?

Or is 0 treated as TRUE in cURL and I need FALSE?  Surely not, right,
since PHP handles that internally...

#4
The complaint about a string not being zero-terminated is happening on
the line such as:
if (stristr($image_string, $bad_data)){

stristr is supposed to be binary-safe

My assumption, then, was that I could search inside of a binary data
string (a valid image) for a particular pattern (the HTML they send
out instead of a JPEG sometimes) to detect when they've done that...

So, apparently, binary-safe doesn't mean what I think it means...
Or I've found another bug in PHP? Unlikely.

What does binary-safe actually MEAN anyway?

#5
Is there some way to distinguish between a 

Re: [PHP] Timestamp needed in error log

2006-04-08 Thread darren kirby
quoth the John Hicks:
  You don't explain much about your setup here, but on mine, I just write
  my errors to the apache error log, which provides its own timestamp.
 
  Another option is to log to the system logs:
  error_log = syslog  # in php.ini
 
  and use your loggers filter facilities to keep the php messages in a
  separate file. Again, here syslog will provide its own timestamp.
 
  -d

 Thanks for the feedback, Darren!

 So at least one person in the world does get a filestamp in his error
 messages. That's useful information. From my googling I see number of
 references to the absence of timestamps so I was beginning to think that
 was the norm.

 Mine is a RHES4 box running the RH default configuration of PHP 4.3.9
 (RedHat's latest).

 Please let me know your distribution and PHP version so I can start to
 narrow this down.

 Thanks!

 John

Hey,

I am using Gentoo and PHP 5.1.2 with the hardened patch, but I am pretty sure 
the logging is identical to php4, as I only upgraded to 5 a few months ago,

In any event, how is your logging set up in php.ini? In mine I have:
display_errors = Off
log_errors = On

error_log is commented out, and this causes php to write directly to my 
Apache error_log, which as I mentioned, provides the timestamp itself.

I am not sure on this point, but if you have your error_log set 
to /some/random/file and you do not see a timestamp then I think it is safe 
to conclude that PHP does not provide this facility itself. So, if you need 
the timestamp you might need to use Apache's or syslog's logging facilities 
instead.

HTH

By the way, please CC the list so that others may benefit from this 
discussion...

-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
...the number of UNIX installations has grown to 10, with more expected...
- Dennis Ritchie and Ken Thompson, June 1972


pgpORMYnH4hJZ.pgp
Description: PGP signature


Re: [PHP] Creating a Photo Album

2006-04-08 Thread tedd

At 3:14 PM -0400 4/8/06, Robert Cummings wrote:

On Sat, 2006-04-08 at 14:00, Paul Goepfert wrote:

 I'm not looking for someome to do it for me.  I would like to learn
 how to do this my self.  I have written code in Java and C/C++ before.
  From the function list in the PHP manual some of the functions look
 like the C/C++ functions.


That's a good observation. PHP drew a lot of it's initial design
directly from C.

Cheers,
Rob.


Rob:

Isn't php written in C?

tedd
--

http://sperling.com

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



Re: [PHP] Creating a Photo Album

2006-04-08 Thread Robert Cummings
On Sat, 2006-04-08 at 18:38, tedd wrote:
 At 3:14 PM -0400 4/8/06, Robert Cummings wrote:
 On Sat, 2006-04-08 at 14:00, Paul Goepfert wrote:
   I'm not looking for someome to do it for me.  I would like to learn
   how to do this my self.  I have written code in Java and C/C++ before.
From the function list in the PHP manual some of the functions look
   like the C/C++ functions.
 
 That's a good observation. PHP drew a lot of it's initial design
 directly from C.
 
 Cheers,
 Rob.
 
 Rob:
 
 Isn't php written in C?

It is, but so are many other languages that don't keep much of the C
philosophy :) Part of the philosophy behind PHP was to make it easy for
developers writing traditional CGI (the hard way in C) to make the
switch to PHP. The other part of the philosophy was to make it simple
enough for the average programmer to also use. Somewhere along the line
I think they came across a good mesh... although some critics would say
that those elements are a bad thing. Personally I love the closeness to
C. I've had routines in C that I've cut and pasted into PHP, prefixed
the vars with a $, removed var declarations, tweaked a few other things
here and there (pointers *hah*) and voila, it runs *drool*.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Creating a Photo Album

2006-04-08 Thread tedd

  Rob:


 Isn't php written in C?


It is, but so are many other languages that don't keep much of the C
philosophy :) Part of the philosophy behind PHP was to make it easy for
developers writing traditional CGI (the hard way in C) to make the
switch to PHP. The other part of the philosophy was to make it simple
enough for the average programmer to also use. Somewhere along the line
I think they came across a good mesh... although some critics would say
that those elements are a bad thing. Personally I love the closeness to
C. I've had routines in C that I've cut and pasted into PHP, prefixed
the vars with a $, removed var declarations, tweaked a few other things
here and there (pointers *hah*) and voila, it runs *drool*.

Cheers,
Rob.


Rob:

Well, I agree with you. I like the cryptic nature of php; and it 
being absent from all the pointer confusion; and I especially like 
the way php handles strings. For me, C was always problematic in the 
string area.


Plus, php linked with MySQL makes for a very complete development 
package that runs on more computers than any other language to date.


The only major problem I see is that it's server-side and thus 
isolated somewhat from user input. I would like to see more user 
inter-reaction and that's the reason I'm investigating ajax. In 
short, I miss the event loop.


Also, while I know how to pass variables by reference (i.e., 
pointers) to functions, I still wonder if one can obtain a pointer to 
a function? But, I'll find out in time.


tedd
--

http://sperling.com

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



[PHP] Best Way to Pass Variables between PHP files

2006-04-08 Thread Alan Schneider
What is the best way to pass variable values from one php file to another

thanks

Alan

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



[PHP] Passing Variables from Script to Script

2006-04-08 Thread Alan Schneider
What is the best way to pass a variable value from one script to another?

In unix or dos all I would need to do would be to add them just after the
name of the script

such as myscript.bat  

thanks

Alan

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



[PHP] cron via cPanel (revisited)

2006-04-08 Thread tedd

Hi gang:

Well my host responded with a very helpful reply to my request for 
help, he said:


-- quote --
Ok corn jobs is working on server. But my host says there is 
something wrong with the script.

-Have a great day
-- un-quote --

Now, it should be clear to everyone what the problem was -- I thought 
is was a cron job, and it turns out to be a corn job -- I don't even 
want to go there.


In any event, my cPanel calls for three things:

1. An email address of where to send the error messages.

2. The command line you want the cron to execute.

3. And, the times you want the cron to run.

Now, with 1 and 3, I got the idea. But, with 2 -- I can't get it to work.

I've tried:

/usr/local/bin/php /home/tedd/public_html/my_email.php

curl -N http://www.xn--ovg.com/my_email.php

but, neither work.

Any ideas?

Thanks.

tedd

ps: The above my_email.php does not exist -- I use another php app 
that sends me an email. I just didn't want to make it public so that 
I might receive 50K emails from this post.


--

http://sperling.com

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



Re: [PHP] Creating a Photo Album

2006-04-08 Thread Robert Cummings
On Sat, 2006-04-08 at 19:46, tedd wrote:

 Rob:
 
 Well, I agree with you. I like the cryptic nature of php; and it 
 being absent from all the pointer confusion; and I especially like 
 the way php handles strings. For me, C was always problematic in the 
 string area.
 
 Plus, php linked with MySQL makes for a very complete development 
 package that runs on more computers than any other language to date.
 
 The only major problem I see is that it's server-side and thus 
 isolated somewhat from user input. I would like to see more user 
 inter-reaction and that's the reason I'm investigating ajax. In 
 short, I miss the event loop.
 
 Also, while I know how to pass variables by reference (i.e., 
 pointers) to functions, I still wonder if one can obtain a pointer to 
 a function? But, I'll find out in time.

Like the following?

?php

function f_a()
{
echo 'a';
}

function f_b()
{
echo 'b';
}

function f_c()
{
echo 'c';
}

$map = array
(
'a' = 'f_a',
'b' = 'f_b',
'c' = 'f_c',
);

$map['a']();
$map['b']();
$map['c']();

?

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] question about magic_quotes_gpc not adding slashes into $_GET

2006-04-08 Thread jonathan
I  have a server where magic_quotes_gpc is set to On. It's my  
understanding that this should add slashes to something like Joe's  
so that it's Joe\'s but when I look in the db, it is in there as  
Joe's. This doesn't seem like it should be the anticipated behavior.  
Is there another setting in either PHP or MySQL that will  
subsequently strip out slashes from magic_quotes_gpc or override this  
setting such that the automatic adding of slashes isn't taking place?


thanks,
jon 


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



[PHP] Re: Best Way to Pass Variables between PHP files

2006-04-08 Thread Al

Alan Schneider wrote:

What is the best way to pass variable values from one php file to another

thanks

Alan


$_GET is the simplest if:

The size of the variables is small, there aren't too many and whether you care 
if users see it.

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



Re: [PHP] php newbie having trouble going to list page

2006-04-08 Thread chris smith
On 4/9/06, David Doonan [EMAIL PROTECTED] wrote:
 I'm having trouble getting the correct results on a list page.

 The first query is pulling the name of active authors from the d/b
 and linking to a list page that is supposed to return essay titles by
 the requested author. The list page however is displaying essay
 titles by all authors.
 -
 List page query =

 $query_GetAuthorList = SELECT Writings.Writings_Author,
 Writings.Writings_Title, DATE_FORMAT(Writings_Date, '%M %D, %Y') as
 Writings_Date, Writings.Writings_Text, Writings.ID,
 Author.Autholr_Name, Author.ID FROM Writings, Author
 WHERE Writings.ID = Writings.ID AND
 Author.Autholr_Name = 
 Writings.Writings_Author AND
 Author.ID = Author.ID
 ORDER BY Writings.Writings_Date desc;

What happens when you run that through phpmyadmin or mysql? Does it
give you the right results?

You are right, the query seems to be stuffed - you have the tables
joining to themselves (author.id=author.id)

What do the tables look like?

describe writings;
describe author;

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

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



[PHP] Date problems

2006-04-08 Thread Mace Eliason

Hi,

I am having troubles adding 7 days to the current date.  I have been 
reading through php.net date() and this is what I have come up with but 
it doesn't work

$today = date('m/d/Y');
$nextweek = date('m/d/Y',mktime(date(m), date(d)+7, date(Y)));

if I echo the above variables they are the same? Shouldn't the $nextweek 
be different?


Thanks for the help

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



[PHP] Re: Best Way to Pass Variables between PHP files

2006-04-08 Thread Alan Schneider
I tired sending via name-value pairs with the following but it did not work

require (DIR_WS_INCLUDES . 'filenames.php?lv_user_id=$user_id');

DIR_WS_INCLUDES is a defined constant and filenames.php is NOT a web page; 
just a php file that sets the file names to be used in the application.

Is there a way I can do it with include or require?

thanks

Alan

Al [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Alan Schneider wrote:
 What is the best way to pass variable values from one php file to another

 thanks

 Alan

 $_GET is the simplest if:

 The size of the variables is small, there aren't too many and whether you 
 care if users see it. 

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



Re: [PHP] Date problems

2006-04-08 Thread Rasmus Lerdorf

Mace Eliason wrote:

Hi,

I am having troubles adding 7 days to the current date.  I have been 
reading through php.net date() and this is what I have come up with but 
it doesn't work

$today = date('m/d/Y');
$nextweek = date('m/d/Y',mktime(date(m), date(d)+7, date(Y)));

if I echo the above variables they are the same? Shouldn't the $nextweek 
be different?


You are thinking too much!  ;)

$nextweek = date(m/d/Y,strtotime(+7 days));

-Rasmus

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



Re: [PHP] Re: Best Way to Pass Variables between PHP files

2006-04-08 Thread David Tulloh
Alan Schneider wrote:
 I tired sending via name-value pairs with the following but it did not work
 
 require (DIR_WS_INCLUDES . 'filenames.php?lv_user_id=$user_id');
 
 DIR_WS_INCLUDES is a defined constant and filenames.php is NOT a web page; 
 just a php file that sets the file names to be used in the application.
 
 Is there a way I can do it with include or require?
 

Include and require files share the same variable space as the parent
file.  You can think of it as being the same as copy  pasting the text
directly into the same file.

Hence, $user_id is available in filenames.php, just call as you would in
the parent file.


David

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



Re: [PHP] question about magic_quotes_gpc not adding slashes into $_GET

2006-04-08 Thread Richard Lynch
On Sat, April 8, 2006 7:49 pm, jonathan wrote:
 I  have a server where magic_quotes_gpc is set to On. It's my
 understanding that this should add slashes to something like Joe's
 so that it's Joe\'s but when I look in the db, it is in there as
 Joe's. This doesn't seem like it should be the anticipated behavior.

It DOES add the slashes to $_GET.

But when you put the data *IN* to MySQL, MySQL eats the slashes --
In fact, MySQL *needs* the slashes to distinguish somethings:
' the beginning of a string
\' an apostrophe embedded IN a string
' the end of a string.

So, in slow-motion:

HTTP sends '
PHP Magic Quotes makes it be \'
MySQL sees it *INSIDE* a string like 'Joe\'s'
MySQL stores this internally:   Joe's

 Is there another setting in either PHP or MySQL that will
 subsequently strip out slashes from magic_quotes_gpc or override this
 setting such that the automatic adding of slashes isn't taking place?

Just turn Magic Quotes *OFF* and use mysql_real_escape_string

For the love of god do *NOT* try to do *both* MagicQuotes and
mysql_real_escape_string and then be happy when you've got 'Joe\'s'
*inside* your database.

That just means you've corrupted your data.

TIP:
If you find yourself calling http://php.net/stripslashes you
almost-for-sure have ended up calling addslashes or some thing similar
twice.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] php newbie having trouble going to list page

2006-04-08 Thread David Tulloh
David Doonan wrote:
 I'm having trouble getting the correct results on a list page.
 
 The first query is pulling the name of active authors from the d/b  and
 linking to a list page that is supposed to return essay titles by  the
 requested author. The list page however is displaying essay  titles by
 all authors.
 
 No doubt something is wrong with the where clause in the List page 
 query. I've tried countless variations on the syntax for Author.ID = 
 Author.ID without success.
 
 Sorry for so basic a question.
 
 -
 author page query =
 
 $query_GetAuthors = SELECT Distinct Author.Autholr_Name, Author.ID, 
 Writings.Writings_Author FROM Author, Writings
 WHERE Author.Autholr_Name = Writings.Writings_Author and
Author.ID = Author.ID;
 ...
  
 author page link =
 a href=author.php?ID=?php echo $row_GetAuthors['ID']; ??php  echo
 $row_GetAuthors['Autholr_Name']; ?/a
 
 
 -
 List page query =
 
 $query_GetAuthorList = SELECT Writings.Writings_Author, 
 Writings.Writings_Title, DATE_FORMAT(Writings_Date, '%M %D, %Y') as 
 Writings_Date, Writings.Writings_Text, Writings.ID, 
 Author.Autholr_Name, Author.ID FROM Writings, Author
 WHERE Writings.ID = Writings.ID AND
 Author.Autholr_Name = Writings.Writings_Author AND
 Author.ID = Author.ID
 ORDER BY Writings.Writings_Date desc;
 ...


Nowhere in your query are you actually specifying which author you want
to get results for.  You need to use the variable passed to the page as
part of the query.  Try adding something like the following to your
where block.

Author.ID = .mysql_real_escape_string($_GET['ID'])


David

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



Re: [PHP] Date problems

2006-04-08 Thread Rasmus Lerdorf

Rasmus Lerdorf wrote:

Mace Eliason wrote:

Hi,

I am having troubles adding 7 days to the current date.  I have been 
reading through php.net date() and this is what I have come up with 
but it doesn't work

$today = date('m/d/Y');
$nextweek = date('m/d/Y',mktime(date(m), date(d)+7, date(Y)));

if I echo the above variables they are the same? Shouldn't the 
$nextweek be different?


You are thinking too much!  ;)

$nextweek = date(m/d/Y,strtotime(+7 days));


By the way, the reason your way isn't working is because you have your 
arguments wrong.  The first three arguments to mktime are hour, minute, 
second, and since you are only printing the date you lose the fact that 
you added 7 minutes.  If you try your script just before midnight you 
will notice the values are different.


-Rasmus

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



Re: [PHP] Mail problems with Outlook

2006-04-08 Thread Richard Lynch

Because you have created ta totally BOUGS MIME email.

You've rn rough-shod over the standards for html enhanced (cough,
cough) email.

Use plain-text, or do a ton of research or use the MIME email classes
from http://phpclasses.org


On Sat, April 8, 2006 5:52 pm, Schalk wrote:
 Greetings All,

 Is there any reason why the following code will correctly set the FROM
 and Reply-to fields in Thunderbird but not Outlook? Thanks!

 $firstName = $_POST['Contact_FirstName'];
 $lastName = $_POST['Contact_LastName'];
 $address = $_POST['Contact_Address'];
 $homePhone = $_POST['Contact_HomePhone'];
 $bestTime = $_POST['R1'];
 $email = $_POST['Contact_Email'];


 $to = '[EMAIL PROTECTED]';
 $subject = Request from www.helpmefindahome.info;
 $headers = MIME-Version: 1.0\r\n.
Content-type: text/html; charset=iso-8859-1\r\n.
From: .$email.\r\n.
Reply-to: .$email.\r\n.

Date: .date(r).\r\n;

 // Compose message:
 $message = 
 html
 body
 h1Message From: .$firstName.   .$lastName.
 /h1
 First Name: .$firstName.
 br /Last Name: .$lastName.
 br /Address: .$address.
 br /Home phone: .$homePhone.
 br /Best time to contact: .$bestTime.
 br /Email: .$email.
 /body
 /html
 ;

 // Send message
 mail($to, $subject, $message, $headers);

 --
 Kind Regards
 Schalk Neethling
 Web Developer.Designer.Programmer.President
 Volume4.Business.Solution.Developers

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Passing Variables from Script to Script

2006-04-08 Thread Richard Lynch
PHP has those variables in $argv

$argc tells you how many args there were.

$argv[0] is the actual script name, eg, myscript.php



On Sat, April 8, 2006 2:58 pm, Alan Schneider wrote:
 What is the best way to pass a variable value from one script to
 another?

 In unix or dos all I would need to do would be to add them just after
 the
 name of the script

 such as myscript.bat  

 thanks

 Alan

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] What is best way to do handle audio files?

2006-04-08 Thread Richard Lynch


If the files are constantly changing, scandir is probably as fast as
it gets...

If you rarely alter the files, do scandir once and store the results
in, say, MySQL and you can search/sort MUCH faster.

On Sat, April 8, 2006 11:01 am, Nicholas Couloute wrote:
 On my website http://www.sidekick2music.com ! I use scandir() [php
 5.0]
 to fetch all the files which are all in subfolders of this one folder.
 like this:
 public_html/amrs/$cat/$author/*.amr

 $cat = different catergoried of music
 $author = Authors of the particular catergory

 This way isn't fast when you have over 5,000+ files.

 I use flatfile for everything on the site!
 site: http://www.sidekick2music.com

 Would it run faster if I used mysql?
 How would this be done?
 Is there another way when dealing with files and organizing them? CMS?

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] php newbie having trouble going to list page

2006-04-08 Thread Richard Lynch
On Sat, April 8, 2006 10:12 am, David Doonan wrote:
 I'm having trouble getting the correct results on a list page.

 The first query is pulling the name of active authors from the d/b
 and linking to a list page that is supposed to return essay titles by
 the requested author. The list page however is displaying essay
 titles by all authors.

 No doubt something is wrong with the where clause in the List page
 query. I've tried countless variations on the syntax for Author.ID =
 Author.ID without success.

 Sorry for so basic a question.

 -
 author page query =

 $query_GetAuthors = SELECT Distinct Author.Autholr_Name, Author.ID,
 Writings.Writings_Author FROM Author, Writings
 WHERE Author.Autholr_Name = Writings.Writings_Author and
  Author.ID = Author.ID;

This gets every author several times over, then throws away the
duplicates.

Not what you want.

First thing:
WHERE Author.ID = Author.ID

This is just silly -- Author.ID will ALWAYS equal Author.ID
It's a tautology, like,  WHERE 1 = 1

Get rid of it.

Next, you really should NOT be storing the Author Name in both tables.

Suppose somebody gets married?

Suppose Cassius Clay changes his name to Mohammed Ali.

Suppose Madonna writes for you.

You should store an Author_ID field ni Writings so that you are
comparing the ID Numbers, not names that might change tomorrow.

Finally, you are JOINing the Author table and Writings table here, and
then throwing away all the info from the Writings table, just to get
the Names.

Either use JUST the author table to get JUST the names, or get BOTH
their Writings *AND* their names.

 $GetAuthors = mysql_query($query_GetAuthors, $connDerbyTrail) or die
 (mysql_error());
 $row_GetAuthors = mysql_fetch_assoc($GetAuthors);
 $totalRows_GetAuthors = mysql_num_rows($GetAuthors);

 
 author page link =
 a href=author.php?ID=?php echo $row_GetAuthors['ID']; ??php
 echo $row_GetAuthors['Autholr_Name']; ?/a



 -
 List page query =

 $query_GetAuthorList = SELECT Writings.Writings_Author,
 Writings.Writings_Title, DATE_FORMAT(Writings_Date, '%M %D, %Y') as
 Writings_Date, Writings.Writings_Text, Writings.ID,
 Author.Autholr_Name, Author.ID FROM Writings, Author
 WHERE Writings.ID = Writings.ID AND
   Author.Autholr_Name = Writings.Writings_Author 
 AND
   Author.ID = Author.ID
 ORDER BY Writings.Writings_Date desc;

Again, Writings.ID will ALWAYS equal Writings.ID
Author.ID will ALWAYS equal Author.ID

Matching up the names SHOULD get you just one of each, if your data is
not messed up...

 $GetAuthorList = mysql_query($query_GetAuthorList, $connDerbyTrail)
 or die(mysql_error());
 $row_GetAuthorList = mysql_fetch_assoc($GetAuthorList);
 $totalRows_GetAuthorList = mysql_num_rows($GetAuthorList);

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Timestamp needed in error log

2006-04-08 Thread Richard Lynch
http://php.net/set_error_handler



On Sat, April 8, 2006 10:01 am, John Hicks wrote:
 I would like to configure my PHP 4.3 to include a timestamp in its
 error
 messages.

 It appears that PHP defaults to no timestamp. I can't a find a
 directive
 that allows me to configure this.

 Do I have to recompile?

 I've never looked at the source before. Any pointers on where I should
 look for the error message generation?

 I posted a similar query a week ago and got no response.

 Any response would be appreciated:

 --Does anyone have a PHP that is configured with a timestamped error
 log?

 --Is there a reason not to have a timestamp?

 --Would you, like me, like to have the date and time in the error
 messages?

 Thanks,

 John Hicks

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: looking for shopping cart

2006-04-08 Thread Lisa A
I actually just installed OS commerce on my site, but I think it might be 
hard for my clients to upload their contents.  They need it to be real easy. 
Almost like fill in the blanks.  What do you think?
Lisa

Stephen Lake [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Give osCommerce a try, its free and easy to use
 http://www.oscommerce.com/

 Lisa A [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
I need a shopping cart for a website that once I install and set up, my 
client can easily add merchandise to it.  They use Paypal.  It has to be 
very easy for them to upload images and products, prices, etc.
 If anyone knows of something, please let me know.
 I host my own websites, so not interested in paying a monthly fee.
 thanks,
 Lisa 

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