|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 8 Apr 2006 14:57:07 -0000 Issue 4060
php-general-digest-help
lists.php.net
Date: Sat Apr 08 2006 - 09:57:07 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 8 Apr 2006 14:57:07 -0000 Issue 4060
Topics (messages 233514 through 233548):
mail() and exim
233514 by: Webmaster
233515 by: Manuel Lemos
Re: Ajax please....
233516 by: Rasmus Lerdorf
233518 by: tedd
233523 by: Carlin Bingham
233526 by: Rasmus Lerdorf
233546 by: Ryan A
Re: PHP Book Recommendation
233517 by: Jim Lucas
233521 by: Pablo L. de Miranda
233525 by: Jad madi
headers already sent.
233519 by: P. Guethlein
233522 by: Chris
233529 by: P. Guethlein
Re: microtime questions
233520 by: Joe Wollard
233538 by: Brad Bonkoski
Re: Parse Error on SQL Insert [Solved]
233524 by: Tom Chubb
Re: Parsing variables within string variables
233527 by: David Clough
Re: Is it a bug of CakePHP?
233528 by: John Wells
a php image gallery
233530 by: Ross
233533 by: chris smith
include file path errors
233531 by: kmh496
include path file errors
233532 by: kmh496
What does this mean: <?=
233534 by: Merlin
233535 by: Rory Browne
233536 by: Dave Goodchild
Re: make global variables accessible to functions?
233537 by: Rory Browne
Re: Problems with Arrays and print and echo
233539 by: Michael Felt
233541 by: Michael Felt
233542 by: chris smith
233543 by: Michael Felt
233544 by: Michael Felt
233545 by: Michael Felt
233547 by: John Wells
Re: Handling Large Select Boxes
233540 by: Brad Bonkoski
php newbie having trouble going to detail page
233548 by: David Doonan
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Hello,
I'm not sure if this is the right list to ask this on or not....
Here's the situation... my php scripts were generating emails as
expected. I was shocked when they told me that exim was not responding
to requests on port 25 and had to be restarted. So, PHP communicates
with exim internally and doesn't have the need for ports as far as PHP
generated emails go? Can anyone describe how this communication takes
place between PHP and exim (or any mail server for that matter)?? Is
this why exim would not send my emails via thunderbird but would send
them via PHP???
Thanks!
attached mail follows:
Hello,
on 04/08/2006 12:11 AM Webmaster said the following:
> I'm not sure if this is the right list to ask this on or not....
>
> Here's the situation... my php scripts were generating emails as
> expected. I was shocked when they told me that exim was not responding
> to requests on port 25 and had to be restarted. So, PHP communicates
> with exim internally and doesn't have the need for ports as far as PHP
> generated emails go? Can anyone describe how this communication takes
> place between PHP and exim (or any mail server for that matter)?? Is
> this why exim would not send my emails via thunderbird but would send
> them via PHP???
You are a bit confused, but that is a normal confusion. You do not need
an SMTP server to send messages. The role of the SMTP server is to
receive messages, not to send them. What sends messages is an MTA (Mail
Transfer Agent). Some SMTP servers are attached to MTA, so they can
receive messages to be resent to their final recipients.
PHP under Unix/Linux calls the sendmail program. Every Unix/Linux MTA
emulates sendmail, including exim. The sendmail program just attempts to
resend the message or queue it for later delivery attempt.
Thunderbird and other mail clients could use sendmail to deliver
messages if they were running on the same machine, but they do not
support it.
--
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/
attached mail follows:
Ryan A wrote:
> Just been googleing and trying out different AJAX frameworks..:
>>From PEAR HTML_AJAX
> Gauva
> My-Bic
> AjaxAC
> and quite a few more....and it happened, I confused myself :-(
>
> For some reason HTML_AJAX is not working on my local machine (windows based,
> I am getting runtime errors with the examples) and it seems quite
> bulky. I have even tried the YAHOO one, which Rasmus suggested to another
> guy some time back (found it
> after looking in the archives) unfortunatly could not find much
> documentation that I could understand...
It's really not hard. Remember my 30s AJAX post a while back? Well,
here is a revised version using the Yahoo! library. You can try it on
this slide:
http://talks.php.net/show/yul/14
There are basically 3 parts to any AJAX app. The initial HTML that the
user first loads up. In this case it is:
<form name="main" action="javascript:sendform('yajax.php','main')">
Location: <input type="text" name="loc" />
</form>
So, just a form with a single text field where the user can enter a
location. Easy enough so far. When the user hits enter the action line
there says to call the sendform() Javascript function and pass it the
strings 'yajax.php' and 'main'. 'yajax.php' is the name of the script
to post to and 'main' is the name of the form that contains the data to
post.
Ok, now to the second part, the Javascript portion that implements this
sendform() function using the Yahoo libs. You could have this in a
separate .js file, but to keep it simple I have just put it into the
same file in the head section:
<script language="javascript" src="/yui/YAHOO.js"></script>
<script language="javascript" src="/yui/connection.js"></script>
<script language="javascript">
<!--
var fN = function callBack(o) {
var resp = eval('(' + o.responseText + ')');
img = document.createElement('img');
img.src = resp.Result; img.width=300; img.height=300; img.border=1;
document.body.appendChild(img);
}
var callback = { success:fN }
function sendform(target,formName) {
YAHOO.util.Connect.setForm(formName);
YAHOO.util.Connect.asyncRequest('POST',target,callback);
}
// -->
</script>
This might look a bit complex, but the first part just includes the
Yahoo stuff. YAHOO.js and connection.js which are part of the ZIP file
you can get from here: http://developer.yahoo.com/yui/downloads/yui.zip
Next we have the callback function that will be called when we receive
data back from the server. This does an eval() which is simple, but if
you don't trust your source you might want to use
http://www.json.org/js.html instead. After parsing the returned json we
create an IMG tag, set some attributes on it and append it to the
document body. And finally the sendform function is a simple 2-liner
that goes and fetches the form data from the passed in formName followed
by the asynchronous backend request to the server.
The final part is the really easy part. The server-side PHP part.
<?php
if(!empty($_POST['loc'])) {
$src =
"http://api.local.yahoo.com/MapsService/V1/mapImage?appid=YahooDemo";
$src.= "&location=".urlencode($_GET['loc']).
"&output=php&image_width=300&image_height=300&zoom=7";
header("Content-type: application/x-json");
echo json_encode(unserialize(file_get_contents($src)));
exit;
}
?>
This makes a call to the Yahoo! map image api to get a map tile for the
location the user entered and it returns the image url json-encoded.
You will need the pecl/json extension installed do this encoding or
failing that there is a PEAR JSON as well.
You are not going to be able to avoid writing a little bit of Javascript
if you are going to do asynchronous backend requests (AJAX). You need
to send the request somehow from Javascript and you need to read the
response in Javascript. On the other hand, it is mostly just DOM
manipulation so if you know DOM in PHP it isn't hard to pick up.
-Rasmus
attached mail follows:
At 2:21 AM +0200 4/8/06, Ryan A wrote:
>This is what i want to use it for:
>Client comes to site, wants to make an account, I check if the username he
>entered is not already in use, if already in use I print out a failute
>message in red on the screen if not in use....i make his account and print
>out a success text or redirect him to a success page.
>THATS IT, nothing too fancy.
Ryan:
Unless you want something more, you don't need ajax for that. All of
that can be done in php.
Why do you think you need ajax?
tedd
--
--------------------------------------------------------------------------------
http://sperling.com
attached mail follows:
Just use PHP to do it.
To check if an account with that username exsists just use the
mysql_num_rows function and a 'die' statement.
Then use SQL/PHP code to log the information in a database and just echo
the success text at the bottom of your code.
Simple.
On 3:21:47 am 08/04/2006 "Ryan A" <Ryan
eZee.se> wrote:
> Hey,
>
> Just been googleing and trying out different AJAX frameworks..:
> From PEAR HTML_AJAX
> Gauva
> My-Bic
> AjaxAC
> and quite a few more....and it happened, I confused myself :-(
>
> For some reason HTML_AJAX is not working on my local machine (windows
> based, I am getting runtime errors with the examples) and it seems
> quite bulky. I have even tried the YAHOO one, which Rasmus suggested
> to another guy some time back (found it
> after looking in the archives) unfortunatly could not find much
> documentation that I could understand...
>
> Hopefully after reading about my requirment(s) someone can suggest
> something thats really simple (or really well
> documented with examples)
>
> Requirements:
> Write little or no JS
> When i submit the form, it should simply call my script and print out
> the answer inbetween the DIV tags
>
>
> This is what i want to use it for:
> Client comes to site, wants to make an account, I check if the
> username he entered is not already in use, if already in use I print
> out a failute message in red on the screen if not in use....i make
> his account and print out a success text or redirect him to a success
> page. THATS IT, nothing too fancy.
>
> Thanks in advance.
>
> Cheers,
> Ryan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
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=php&image_width=300&image_height=300&zoom=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
attached mail follows:
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 closing....all of you............. get your butts off the chair and off
the computer............................and have a nice weekend!
Cheers,
Ryan
attached mail follows:
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
attached mail follows:
Man,
Anothers good books:
- PHP|Architect's Guide to PHP Design Patterns, ISBN: 0973589825
- PHP 5 Objects, Patterns, and Practice, ISBN: 0973589825
On 4/8/06, Jim Lucas <lists
cmsws.com> 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
>
>
attached mail follows:
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
>
attached mail follows:
(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\XXXX\users.inc:11) in
D:\webpages\XXXX\web\loginfunctions.php on line 26
Users.inc is
==============
<?php
$domain = 'localhost';
$admin = 'xxxxx';
$user = 'xxxxx';
$web = 'xxxxx';
$password = 'xxxxxx';
$site = 'xxxxx';
$leads = 'xxxxx';
?>
<?php
// Configuration settings for My Site
// Email Settings
$mailsite['from_name'] = 'xxxxx Website'; // from email name
$mailsite['from_email'] = 'webserver
xxxxxx'; // 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.xxxx.xxx;mail.xxxxx2.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
attached mail follows:
Comment inline:
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\XXXX\users.inc:11) in
> D:\webpages\XXXX\web\loginfunctions.php on line 26
>
> Users.inc is
>
> ==============
> <?php
> $domain = 'localhost';
> $admin = 'xxxxx';
> $user = 'xxxxx';
> $web = 'xxxxx';
> $password = 'xxxxxx';
> $site = 'xxxxx';
> $leads = 'xxxxx';
> ?>
>
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'] = 'xxxxx Website'; // from email name
> $mailsite['from_email'] = 'webserver
xxxxxx'; // 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.xxxx.xxx;mail.xxxxx2.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
>
attached mail follows:
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\XXXX\users.inc:11) in
>>D:\webpages\XXXX\web\loginfunctions.php on line 26
>>
>>Users.inc is
>>
>>==============
>><?php
>>$domain = 'localhost';
>>$admin = 'xxxxx';
>>$user = 'xxxxx';
>>$web = 'xxxxx';
>>$password = 'xxxxxx';
>>$site = 'xxxxx';
>>$leads = 'xxxxx';
>>?>
>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'] = 'xxxxx Website'; // from email name
>>$mailsite['from_email'] = 'webserver
xxxxxx'; // 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.xxxx.xxx;mail.xxxxx2.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
attached mail follows:
Tedd,
I think Brad was just making some observations, he wasn't trying to be rude.
When he said that "the time differentials are too be expected." I think he
was just answering the question of why the exact same FOR loop could
possibly take different amounts of time to execute under the same conditions
in the script; not necessarily why it was providing negative values.
On your original issue, were you able to make use of the example function on
http://php.net/microtime? The documentation there along with what I posted
should hopefully clear things up for you as to why microtime() is reliable,
and that it doesn't return a pure float that should be used in equations. It
seems as though you knew that, but as I said before the way that you're
using microtime() is not valid with the version of PHP your host is using.
Please let us know if you'd like more clarification on this. There are a lot
of people on this list, so someone will have the answer that you need. ;-)
- Joe
On 4/7/06, tedd <tedd
sperling.com> 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.
>
> >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.
>
> 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
>
>
> --
>
> --------------------------------------------------------------------------------
> http://sperling.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
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
>>
>
>
attached mail follows:
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 <jhenry
celebrityaccess.com> 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:jhenry
celebrityaccess.com]
> > Sent: 07 April 2006 20:53
> > To: php-general
lists.php.net; tom
ps-promo.co.uk
> > 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
> > jhenry
celebrityaccess.com
> >
> > --
> > 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
> jhenry
celebrityaccess.com
>
--
Tom Chubb
tom
ps-promo.co.uk
07915 053312
attached mail follows:
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
David.Clough
durham.ac.uk
--
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.
attached mail follows:
> > 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("<hr>filename.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
attached mail follows:
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
attached mail follows:
On 4/8/06, Ross <ross
aztechost.com> 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-general&m=114439402126801&w=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/
attached mail follows:
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?
muchas gracias.
--
my site <a href="http://www.myowndictionary.com">myowndictionary</a> was
made to help students of many languages learn them faster.
attached mail follows:
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.
--
my site <a href="http://www.myowndictionary.com">myowndictionary</a> was
made to help students of many languages learn them faster.
attached mail follows:
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
attached mail follows:
<?=expression ?>
<?php echo expression; ?>
On 4/8/06, Merlin <news.groups
web.de> 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
>
>
attached mail follows:
<?= $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 <news.groups
web.de> 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!
attached mail follows:
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......
attached mail follows:
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:10000003/20000044/8-TFDX
> init $this->Xame[5] = B-E3KQ B-E3KQ Array[5]
> 5:10000003/20000044/B-E3KQ
> init $this->Xame[4] = BR-6XP BR-6XP Array[4]
> 4:10000003/20000044/BR-6XP
> init $this->Xame[3] = G5ED-Y G5ED-Y Array[3]
> 3:10000003/20000044/G5ED-Y
> init $this->Xame[2] = O-LR1H O-LR1H Array[2]
> 2:10000003/20000044/O-LR1H
> init $this->Xame[1] = UL-4ZW UL-4ZW Array[1]
> 1:10000003/20000044/UL-4ZW
> init $this->Xame[0] = Y5J-EU Y5J-EU Array[0]
> 0:10000003/20000044/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?
attached mail follows:
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:10000003/20000044/8-TFDX
> init $this->Xame[5] = B-E3KQ B-E3KQ Array[5]
> 5:10000003/20000044/B-E3KQ
> init $this->Xame[4] = BR-6XP BR-6XP Array[4]
> 4:10000003/20000044/BR-6XP
> init $this->Xame[3] = G5ED-Y G5ED-Y Array[3]
> 3:10000003/20000044/G5ED-Y
> init $this->Xame[2] = O-LR1H O-LR1H Array[2]
> 2:10000003/20000044/O-LR1H
> init $this->Xame[1] = UL-4ZW UL-4ZW Array[1]
> 1:10000003/20000044/UL-4ZW
> init $this->Xame[0] = Y5J-EU Y5J-EU Array[0]
> 0:10000003/20000044/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";
attached mail follows:
On 4/7/06, Michael Felt <register
felt.demon.nl> 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/
attached mail follows:
chris smith wrote:
> On 4/7/06, Michael Felt <register
felt.demon.nl> 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/
attached mail follows:
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] => 30000312
[5] => 30000307
[4] => 30000311
[3] => 30000310
[2] => 30000309
[1] => 30000313
[0] => 30000308
)
B-E3KQ
Array[5]
Array[5]
B-E3KQ 30000307
> chris smith wrote:
>
>>
>> var $name = array(); (or '' or ....) ?
>>
>> --
>> Postgresql & php tutorials
>> http://www.designmagick.com/
attached mail follows:
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] => 30000312
> [5] => 30000307
> [4] => 30000311
> [3] => 30000310
> [2] => 30000309
> [1] => 30000313
> [0] => 30000308
> )
>
> B-E3KQ
>
> Array[5]
> Array[5]
>
> B-E3KQ 30000307
>
>> chris smith wrote:
>>
>>>
>>> var $name = array(); (or '' or ....) ?
>>>
>>> --
>>> Postgresql & php tutorials
>>> http://www.designmagick.com/
attached mail follows:
> > 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
attached mail follows:
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"" <jblanchard
pocket.com> wrote in message
>news:56608562F6D5D948B22F5615E3F57E6921BFFC
YGEX01WAL.onecall.local...
>[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=X>Y</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?
>
>
>
attached mail follows:
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
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]