php-general Digest 16 Jun 2013 22:29:48 -0000 Issue 8267

Topics (messages 321410 through 321415):

Re: PHP is Zero
        321410 by: Tamara Temple

Re: LightBox click detection
        321411 by: Tamara Temple
        321412 by: Tamara Temple
        321413 by: Julian Wanke
        321414 by: Bastien

newbie PDO query display question
        321415 by: dealTek

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
BUSCHKE Daniel <daniel.busc...@nextiraone.eu> wrote:
> Why is PHP doing that? I know it works as designed and I know it is
> documented like this but that does not mean that it is a good feature,
> does it? So lets talk about the question: Is that behaviour awaited by
> PHP software developers? Is that really the way PHP should work here?
> May we should change that?!

If you've been using PHP since 2000, you probably well know all the
rants there are about how terrible PHP is as a language; this is one of
the big ones people always mention.

An analog to your statement above is "This screwdriver is absolute
*bollux* at pounding in nails! Maybe we should change that!?". (In point
of fact, PHP can be seen as a screwdriver that is *astoundingly* capable
of pounding in nails, so the analogy is in kind only, not in fact. In
real fact, PHP is a programmer's wealthy toolkit; not complete by any
means, but tools that will work for most things, *when you know how to
use them*.)

I don't know the reasons why; it's moot to me. The designers of PHP
chose to go that route, it's up to me as a developer to know how the
language works. If I'm insufficiently able to use it without throwing
errors, or without realizing my code is throwing errors, perhaps it
isn't the language's fault, but mine to learn to adapt to it's
quirks. If I am sufficiently fed up with having to adapt to it's quirks,
Then I will find another language to use.

Now, that said, PHP is often some people's first programming language,
and that, IMO, is a serious problem. PHP is full of these sorts of
things that may not help a newbie learn proper software development
skills. I love that people can teach themselves to program; I wouldn't
want to take that away from anyone. And sometimes that leads to
problems, too. Eventually they'll learn, and get better, or they won't,
and probably not make much of a living at it if that's their desire.

When I came up, I was learning how to program in two languages at the
same time (not mixed in the same program; alternating): Pascal and
Lisp. There really could not be two more different languages (and this
was before anyone thought about OO as an actual thing rather than some
loosely associated concepts.) Pascal being strongly typed, Lisp having
no types and no distinction between code and data. I actually learned a
hella lot more working in Lisp than I did working in Pascal. (Not the
least of which was how to make my TAs scratch their heads in confusion.)
But that may just be me, and since it may just be me, I'm not about to
suggest it to anyone else.

Now, the question here may be merely academic (read: somewhat
interesting, but not really that practical). If it is not, however, this
isn't the right forum. Take your question to -dev and see what they
think. I am personally not interested in such a change to the language
at this point. It's bad enough when they roll to a new major release
breaking backwards compatibility. The anger and invective goes on for
years; people quit using PHP altogether because of such things and hold
grudges for years and years.

> Regards
> Daniel


Cheers,
   tamouse__

--- End Message ---
--- Begin Message ---
Tedd Sperling <t...@sperling.com> wrote:
> It's Friday so I am allowed to ask odd questions.

W00T! Friday!

> Here's the problem --  I need to count the number of times a user activates a 
> LightBox -- how do you do that?
> 
> Here's a LightBox Example:
> 
>    http://www.webbytedd.com/c2/lightbox/
> 
> All the javascript is there (jQuery et al).
> 
> Ideally, I would like to have a php/javascript combination that would:
> 
> 1. Detect when a user clicked the LightBox;
> 2. Pass that value to PHP so I can keep count.
> 
> Any ideas?

First off, do you have the javascript code available in an unsquished
form? That would mean I could read it.

Not knowing whether your JS code or Lightbox has any hooks that you can
take advantage of, I'd steal the onclick event from those images that
start lightbox, fire off an AJAX request and ignore the return, then
fire the lightbox event handler.

--- End Message ---
--- Begin Message ---
Marc Guay <marc.g...@gmail.com> wrote:
> $('.lightbox-image-class').click(function(){
>     $.post('ajax.php', {click: true});
> });

Do javascript DOM events stack? If they do, this is definitely the
simplest way to go. If they don't, you need to capture the previous
click handler and call it.



--- End Message ---
--- Begin Message ---
They do, afaik...

Am 15.06.2013, 20:11 Uhr, schrieb Tamara Temple <tamouse.li...@gmail.com>:

Marc Guay <marc.g...@gmail.com> wrote:
$('.lightbox-image-class').click(function(){
    $.post('ajax.php', {click: true});
});

Do javascript DOM events stack? If they do, this is definitely the
simplest way to go. If they don't, you need to capture the previous
click handler and call it.



--- End Message ---
--- Begin Message ---
Sorry 'bout the top post.

That's how I do it. Capture the click event with jquery and Ajax that back to 
the server

Bastien Koert

On 2013-06-15, at 2:07 PM, Tamara Temple <tamouse.li...@gmail.com> wrote:

> Tedd Sperling <t...@sperling.com> wrote:
>> It's Friday so I am allowed to ask odd questions.
> 
> W00T! Friday!
> 
>> Here's the problem --  I need to count the number of times a user activates 
>> a LightBox -- how do you do that?
>> 
>> Here's a LightBox Example:
>> 
>>   http://www.webbytedd.com/c2/lightbox/
>> 
>> All the javascript is there (jQuery et al).
>> 
>> Ideally, I would like to have a php/javascript combination that would:
>> 
>> 1. Detect when a user clicked the LightBox;
>> 2. Pass that value to PHP so I can keep count.
>> 
>> Any ideas?
> 
> First off, do you have the javascript code available in an unsquished
> form? That would mean I could read it.
> 
> Not knowing whether your JS code or Lightbox has any hooks that you can
> take advantage of, I'd steal the onclick event from those images that
> start lightbox, fire off an AJAX request and ignore the return, then
> fire the lightbox event handler.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Hi all,

newbie PDO question...

I think (hard to tell - buried in a wrapper class) I am doing a select query 
using  - PDO::FETCH_ASSOC like...

wrapper ------ return $pdostmt->fetchAll(PDO::FETCH_ASSOC);

---

so my query is like...

$results = $db->select("mytable", "id = 201"); //just 1 exact record)

then I can loop like......
foreach ($results as $result) {
   .... 
?>

  <tr>
    <td><?php echo $result["First"]; ?></td>
    <td><?php echo $result["Last"]; ?></td>
    <td><?php echo $result["id"]; ?></td>

  </tr>

This all works fine.....

---> But since I only have 1 exact record - I don't need to LOOP anything - 
so...

Q: How do I display the columns without a loop


these fail - so what will work

echo $results["First"];
echo $results["First"][0]; ???
echo $results["First"][1]; ???





--
Thanks,
Dave
r...@musenet.com
[db-3]




--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


--- End Message ---

Reply via email to