php-general Digest 9 Feb 2009 04:04:25 -0000 Issue 5948
Topics (messages 287921 through 287945):
Re: Adding Records & Capture The New Record ID
287921 by: tedd
287942 by: Chris
Re: PHP usage stats
287922 by: tedd
287923 by: Stuart
287924 by: Richard Heyes
287934 by: tedd
287935 by: Paul M Foster
287936 by: Stuart
287937 by: Ashley Sheridan
287940 by: tedd
287941 by: tedd
287943 by: Stuart
Re: require() causing strange characters ?
287925 by: Nisse Engström
php get rss tag using DOM
287926 by: Morris
287928 by: Nathan Rixham
287944 by: Morris
Appending query result sets?
287927 by: Skip Evans
287929 by: Ashley Sheridan
287930 by: Skip Evans
287931 by: Ashley Sheridan
287932 by: Skip Evans
287933 by: Stuart
287938 by: tedd
287939 by: Per Jessen
Class constant inconsistency
287945 by: leledumbo
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 ---
At 1:36 AM +0000 2/8/09, Ashley Sheridan wrote:
On Sat, 2009-02-07 at 15:26 -0500, tedd wrote:
> That's one way, to use "mysql_insert_id" (probably the best).
But another is simply to read back in the record you just created and
check the $row['id']. That's the way I do it sometimes.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
How do you plan on reading back the row if you don't use the
mysql_insert_id value? For most cases, it's not enough to read back the
Ash:
As I said *sometimes* and I also said *using using "mysql_insert_id"
is probably the best*.
But to answer your question, there are records that are unique (or
should be) without knowing the record ID. Such as those records
having a certain logon and password, or a specific email address.
Those data are supposed to be an unique as the record's ID, right?
For example, I have one scheme to gather email addresses -- and an
email address IS unique. While two people can share one email
address, it makes no difference to a mailing list and thus the
record's ID and email address are equally unique and records can be
found just as easily using either. In fact, while it may be a good
idea to have a record ID for other functions, an ID field is not even
required if all the table is doing is providing email addresses --
simply index email address field.
Also, if you have an authorization scheme, then the logon and
password coupling are supposed to be as unique as a record ID, right?
Again, either the record ID or the logon/password coupling can be
used to find the record.
As I will say again, using "mysql_insert_id" is probably the best --
however -- it's just not the only way. If for no other person than
me, sometimes to show what the code is doing is more obvious by
finding the record you just created than by using "mysql_insert_id".
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
tedd wrote:
At 1:36 AM +0000 2/8/09, Ashley Sheridan wrote:
On Sat, 2009-02-07 at 15:26 -0500, tedd wrote:
> That's one way, to use "mysql_insert_id" (probably the best).
But another is simply to read back in the record you just created and
check the $row['id']. That's the way I do it sometimes.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
How do you plan on reading back the row if you don't use the
mysql_insert_id value? For most cases, it's not enough to read back the
Ash:
As I said *sometimes* and I also said *using using "mysql_insert_id" is
probably the best*.
But to answer your question, there are records that are unique (or
should be) without knowing the record ID. Such as those records having a
certain logon and password, or a specific email address. Those data are
supposed to be an unique as the record's ID, right?
For example, I have one scheme to gather email addresses -- and an email
address IS unique. While two people can share one email address, it
makes no difference to a mailing list and thus the record's ID and email
address are equally unique and records can be found just as easily using
either. In fact, while it may be a good idea to have a record ID for
other functions, an ID field is not even required if all the table is
doing is providing email addresses -- simply index email address field.
Your suggestion has to be done using a unique field (marked as such in
the db) otherwise it won't work.
If it's not -
Person a signs up with em...@example.com
Before you are able to fetch the result (which is possible in a high
traffic site), person b also signs up with em...@example.com
Going back to person a, when you fetch, you get record #2 instead of #1.
They are not the same record.
Not a great example because you probably wouldn't have people using the
same address from different locations, but it's just to demonstrate the
problem of doing it this way.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
At 2:35 PM +0000 2/8/09, Richard Heyes wrote:
Hi,
Can anyone point out some general statistics on PHP usage compared to
other server languages? I've tried Netcraft, but they only appear (or
I've only found) to have statistics on the httpd server used.
Thanks.
--
Richard Heyes
Richard:
I went looking for that same information a few weeks ago myself.
I wasn't able to find a lot of information, but here's a useful link:
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
I wrote them and asked for "where's ASP" in that listing. You see, I
wanted to compare the number of ASP users to the number of PHP users
-- I was thinking that ASP is the closest language to be PHP's
competition (I may be wrong). They wrote back:
"Thanks for your feedback on our TIOBE index. ASP is not a
programming language as such, that's why it is not part of the index.
Please read the FAQ at the end of the page (or search for ASP on the
page) for more details. If you want to compare PHP to ASP, here are
my 2 cents. You could combine Visual Basic and C# to get a
guestimate. Then ASP is 14.8% versus PHP 8.9%."
The only thing that brothers me about the 8.9 percent is how can that
be if there are millions of web sites that use php and that number is
growing? Additionally, this month they report a lower percentage for
php than they did last month -- it appears that something is wrong.
If you find any information of the numbers of php users out there,
please let me know.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
2009/2/8 tedd <tedd.sperl...@gmail.com>:
> At 2:35 PM +0000 2/8/09, Richard Heyes wrote:
>>
>> Hi,
>>
>> Can anyone point out some general statistics on PHP usage compared to
>> other server languages? I've tried Netcraft, but they only appear (or
>> I've only found) to have statistics on the httpd server used.
>>
>> Thanks.
>>
>> --
>> Richard Heyes
>
> Richard:
>
> I went looking for that same information a few weeks ago myself.
>
> I wasn't able to find a lot of information, but here's a useful link:
>
> http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
>
> I wrote them and asked for "where's ASP" in that listing. You see, I wanted
> to compare the number of ASP users to the number of PHP users -- I was
> thinking that ASP is the closest language to be PHP's competition (I may be
> wrong). They wrote back:
>
> "Thanks for your feedback on our TIOBE index. ASP is not a programming
> language as such, that's why it is not part of the index. Please read the
> FAQ at the end of the page (or search for ASP on the page) for more details.
> If you want to compare PHP to ASP, here are my 2 cents. You could combine
> Visual Basic and C# to get a guestimate. Then ASP is 14.8% versus PHP 8.9%."
>
> The only thing that brothers me about the 8.9 percent is how can that be if
> there are millions of web sites that use php and that number is growing?
> Additionally, this month they report a lower percentage for php than they
> did last month -- it appears that something is wrong.
Tedd, that's a list of programming languages, not web development
languages. I have no doubt that C# + VB accounts for more development
in the world than PHP. Both are used extensively in non-web
development whereas PHP is not.
> If you find any information of the numbers of php users out there, please
> let me know.
When you consider how such a thing would be measured it won't take
long to realise why the number is not available. You have to bear in
mind non-public use which will not be insignificant, servers where PHP
is not advertised and a multitude of other reasons why any number you
could come up with *will* be wrong, and therefore pretty useless.
Why anyone would see value in such a number is beyond me. IMHO the
community that exists around it and the number of jobs out there
requiring PHP should be enough to convince anyone that it's not an
insignificant player.
-Stuart
--
http://stut.net/
--- End Message ---
--- Begin Message ---
Hi,
> Why anyone would see value in such a number is beyond me.
Just trying to get an (over)view of the market.
--
Richard Heyes
HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 31st)
--- End Message ---
--- Begin Message ---
At 3:54 PM +0000 2/8/09, Stuart wrote:
2009/2/8 tedd <tedd.sperl...@gmail.com>:
> I wasn't able to find a lot of information, but here's a useful link:
> http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
Tedd, that's a list of programming languages, not web development
languages.
The list shows php, javascript, ruby, and perl -- are those NOT web
development languages?!?
-----
I have no doubt that C# + VB accounts for more development
in the world than PHP. Both are used extensively in non-web
development whereas PHP is not.
> If you find any information of the numbers of php users out there, please
> let me know.
When you consider how such a thing would be measured it won't take
long to realise why the number is not available. You have to bear in
mind non-public use which will not be insignificant, servers where PHP
is not advertised and a multitude of other reasons why any number you
could come up with *will* be wrong, and therefore pretty useless.
Why anyone would see value in such a number is beyond me. IMHO the
community that exists around it and the number of jobs out there
requiring PHP should be enough to convince anyone that it's not an
insignificant player.
-Stuart
I guess I'm not all that bright. To me a programming language is a
programming language regardless of platform or purpose -- that was so
when I was programming FORTRAN on Phoenix I, or Applesoft on Apple
]['s, or postscript on HI's; or ANSI C on Alphas, or FutureBasic and
C/C++ on Macs, or PHP on Apache, or Javascript on IE -- they are all
the same to me. I'm just trying to get a handle on the number of
people who program in php -- what's wrong with wanting to know that
figure?
Look, I teach at the local college and am trying to get PHP/MySQL
courses to be taught there. I have superiors who are asking "How does
PHP stack up against ASP?" which the college teaches AS THE web
development language. I really can't go back to them and say "Well,
everyone just *knows* PHP is a significant player" -- that's not
proof.
Sometimes I have to wonder why anyone would question an honest question?
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On Sun, Feb 08, 2009 at 03:20:48PM -0500, tedd wrote:
> At 3:54 PM +0000 2/8/09, Stuart wrote:
>> 2009/2/8 tedd <tedd.sperl...@gmail.com>:
>>
>> > I wasn't able to find a lot of information, but here's a useful link:
>>>
>> > http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
>>
>> Tedd, that's a list of programming languages, not web development
>> languages.
>
> The list shows php, javascript, ruby, and perl -- are those NOT web
> development languages?!?
>
> -----
>
>> I have no doubt that C# + VB accounts for more development
>> in the world than PHP. Both are used extensively in non-web
>> development whereas PHP is not.
>>
>> > If you find any information of the numbers of php users out there,
> please
>> > let me know.
>>
>> When you consider how such a thing would be measured it won't take
>> long to realise why the number is not available. You have to bear in
>> mind non-public use which will not be insignificant, servers where PHP
>> is not advertised and a multitude of other reasons why any number you
>> could come up with *will* be wrong, and therefore pretty useless.
>>
>> Why anyone would see value in such a number is beyond me. IMHO the
>> community that exists around it and the number of jobs out there
>> requiring PHP should be enough to convince anyone that it's not an
>> insignificant player.
>
> -Stuart
>
> I guess I'm not all that bright. To me a programming language is a
> programming language regardless of platform or purpose -- that was so
> when I was programming FORTRAN on Phoenix I, or Applesoft on Apple
> ]['s, or postscript on HI's; or ANSI C on Alphas, or FutureBasic and
> C/C++ on Macs, or PHP on Apache, or Javascript on IE -- they are all
> the same to me. I'm just trying to get a handle on the number of
> people who program in php -- what's wrong with wanting to know that
> figure?
>
> Look, I teach at the local college and am trying to get PHP/MySQL
> courses to be taught there. I have superiors who are asking "How does
> PHP stack up against ASP?" which the college teaches AS THE web
> development language. I really can't go back to them and say "Well,
> everyone just *knows* PHP is a significant player" -- that's not
> proof.
Perhaps a better question then might be how many IIS servers are there
out there compared to Apache. Apache servers uniformly support PHP, but
I think only IIS servers support ASP (I could be wrong). There's also
the FOSS argument. I'm continually surprised the pinheads in academia
don't see the value of FOSS compared to being beholden to huge corporate
behemoths like Microsoft.
Paul
--
Paul M. Foster
--- End Message ---
--- Begin Message ---
2009/2/8 tedd <tedd.sperl...@gmail.com>:
> At 3:54 PM +0000 2/8/09, Stuart wrote:
>>
>> 2009/2/8 tedd <tedd.sperl...@gmail.com>:
>>
>> > I wasn't able to find a lot of information, but here's a useful link:
>>>
>> > http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
>>
>> Tedd, that's a list of programming languages, not web development
>> languages.
>
> The list shows php, javascript, ruby, and perl -- are those NOT web
> development languages?!?
I didn't say it doesn't include web development languages, just that
it's not limited to them.
>> I have no doubt that C# + VB accounts for more development
>> in the world than PHP. Both are used extensively in non-web
>> development whereas PHP is not.
>>
>> > If you find any information of the numbers of php users out there,
>> please
>> > let me know.
>>
>> When you consider how such a thing would be measured it won't take
>> long to realise why the number is not available. You have to bear in
>> mind non-public use which will not be insignificant, servers where PHP
>> is not advertised and a multitude of other reasons why any number you
>> could come up with *will* be wrong, and therefore pretty useless.
>>
>> Why anyone would see value in such a number is beyond me. IMHO the
>> community that exists around it and the number of jobs out there
>> requiring PHP should be enough to convince anyone that it's not an
>> insignificant player.
>
> -Stuart
>
> I guess I'm not all that bright. To me a programming language is a
> programming language regardless of platform or purpose -- that was so when I
> was programming FORTRAN on Phoenix I, or Applesoft on Apple ]['s, or
> postscript on HI's; or ANSI C on Alphas, or FutureBasic and C/C++ on Macs,
> or PHP on Apache, or Javascript on IE -- they are all the same to me. I'm
> just trying to get a handle on the number of people who program in php --
> what's wrong with wanting to know that figure?
There's nothing wrong with wanting to know it, there's just no
reliable way to measure it so why bother asking for it?
> Look, I teach at the local college and am trying to get PHP/MySQL courses to
> be taught there. I have superiors who are asking "How does PHP stack up
> against ASP?" which the college teaches AS THE web development language. I
> really can't go back to them and say "Well, everyone just *knows* PHP is a
> significant player" -- that's not proof.
Ask them for proof that ASP is worth teaching over PHP? I bet they
have just as much trouble coming up with solid proof that ASP as a
platform is any more popular than PHP, or more valuable as a teaching
language.
When I was at university we were taught Java rather than C++ because,
and I quote one of the professors, "we don't need to teach you proper
memory management". I count myself lucky that I'd learnt C++ 12 years
before I got there.
I suggest you point them at the big players in the web world who use
PHP... Facebook, Yahoo, etc. If that doesn't convince them of its
importance in the world of web development nothing will.
> Sometimes I have to wonder why anyone would question an honest question?
I'm not questioning the question, I'm questioning the accuracy of any
answer you could possibly come up. Describe a practical method of
measuring language use that's likely to yield an accurate result then
I'll eat my words, but I'm yet to come up with one.
-Stuart
--
http://stut.net/
--- End Message ---
--- Begin Message ---
On Sun, 2009-02-08 at 15:37 -0500, Paul M Foster wrote:
> On Sun, Feb 08, 2009 at 03:20:48PM -0500, tedd wrote:
>
> > At 3:54 PM +0000 2/8/09, Stuart wrote:
> >> 2009/2/8 tedd <tedd.sperl...@gmail.com>:
> >>
> >> > I wasn't able to find a lot of information, but here's a useful link:
> >>>
> >> > http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
> >>
> >> Tedd, that's a list of programming languages, not web development
> >> languages.
> >
> > The list shows php, javascript, ruby, and perl -- are those NOT web
> > development languages?!?
> >
> > -----
> >
> >> I have no doubt that C# + VB accounts for more development
> >> in the world than PHP. Both are used extensively in non-web
> >> development whereas PHP is not.
> >>
> >> > If you find any information of the numbers of php users out there,
> > please
> >> > let me know.
> >>
> >> When you consider how such a thing would be measured it won't take
> >> long to realise why the number is not available. You have to bear in
> >> mind non-public use which will not be insignificant, servers where PHP
> >> is not advertised and a multitude of other reasons why any number you
> >> could come up with *will* be wrong, and therefore pretty useless.
> >>
> >> Why anyone would see value in such a number is beyond me. IMHO the
> >> community that exists around it and the number of jobs out there
> >> requiring PHP should be enough to convince anyone that it's not an
> >> insignificant player.
> >
> > -Stuart
> >
> > I guess I'm not all that bright. To me a programming language is a
> > programming language regardless of platform or purpose -- that was so
> > when I was programming FORTRAN on Phoenix I, or Applesoft on Apple
> > ]['s, or postscript on HI's; or ANSI C on Alphas, or FutureBasic and
> > C/C++ on Macs, or PHP on Apache, or Javascript on IE -- they are all
> > the same to me. I'm just trying to get a handle on the number of
> > people who program in php -- what's wrong with wanting to know that
> > figure?
> >
> > Look, I teach at the local college and am trying to get PHP/MySQL
> > courses to be taught there. I have superiors who are asking "How does
> > PHP stack up against ASP?" which the college teaches AS THE web
> > development language. I really can't go back to them and say "Well,
> > everyone just *knows* PHP is a significant player" -- that's not
> > proof.
>
> Perhaps a better question then might be how many IIS servers are there
> out there compared to Apache. Apache servers uniformly support PHP, but
> I think only IIS servers support ASP (I could be wrong). There's also
> the FOSS argument. I'm continually surprised the pinheads in academia
> don't see the value of FOSS compared to being beholden to huge corporate
> behemoths like Microsoft.
>
> Paul
>
> --
> Paul M. Foster
>
I'm not sure that would be much help either. ASP.Net is available on
Apache with the mono modules, and PHP is available on IIS.
Maybe another way to determine language popularity would be to obtain a
list (of suitable length) of the top websites, probably through the
lists released by the major search engines; and then try as best as
possible to determine the language used for each site. In some cases
this may not be possible, i.e. a website hides the language it uses so
well you can't see it, but the resulting list should be a fair
distribution of language popularity.
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
At 8:44 PM +0000 2/8/09, Stuart wrote:
2009/2/8 tedd <tedd.sperl...@gmail.com>:
> just trying to get a handle on the number of people who program in php --
what's wrong with wanting to know that figure?
There's nothing wrong with wanting to know it, there's just no
reliable way to measure it so why bother asking for it?
Huh!?
I must be getting dumber by the minute.
If you don't know there's no reliable way to measure something, then
what's wrong with asking about it? At least now I can say "There's no
reliable way to determine that figure, so I don't know the answer."
Sometimes trying to get a question answered on this list is a bit
like running through a gauntlet of "Why are you asking that? You
should know better!"
Now maybe you didn't mean it that way, but IMO that appears more
demeaning of the poster than providing help. I'm surprised, because
that's not typical of you nor this list.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
At 3:37 PM -0500 2/8/09, Paul M Foster wrote:
Perhaps a better question then might be how many IIS servers are there
out there compared to Apache. Apache servers uniformly support PHP, but
I think only IIS servers support ASP (I could be wrong). There's also
the FOSS argument. I'm continually surprised the pinheads in academia
don't see the value of FOSS compared to being beholden to huge corporate
behemoths like Microsoft.
Paul
Paul:
If that is the case, then data like this:
http://googleonlinesecurity.blogspot.com/2007/06/web-server-software-and-malware.html
might be useful. Excepting of course, if it isn't useful and I should
have known better before posting, then disregard.
With that proviso, consider this:
http://news.netcraft.com/archives/web_server_survey.html
It's an interesting read re this months figures.
In any event, it appears that Apache is certainly leading with a
respectable lead. One could conclude from that, that at least PHP has
more installations than ASP -- would that not be so?
There are a large number of other sites to consider -- I just have
not got to them yet.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
2009/2/8 tedd <tedd.sperl...@gmail.com>:
> At 8:44 PM +0000 2/8/09, Stuart wrote:
>>
>> 2009/2/8 tedd <tedd.sperl...@gmail.com>:
>>
>> > just trying to get a handle on the number of people who program in php
>> --
>>>
>>> what's wrong with wanting to know that figure?
>>
>> There's nothing wrong with wanting to know it, there's just no
>> reliable way to measure it so why bother asking for it?
>
> Huh!?
>
> I must be getting dumber by the minute.
>
> If you don't know there's no reliable way to measure something, then what's
> wrong with asking about it? At least now I can say "There's no reliable way
> to determine that figure, so I don't know the answer."
>
> Sometimes trying to get a question answered on this list is a bit like
> running through a gauntlet of "Why are you asking that? You should know
> better!"
>
> Now maybe you didn't mean it that way, but IMO that appears more demeaning
> of the poster than providing help. I'm surprised, because that's not typical
> of you nor this list.
Indeed. Not really sure what I was thinking when I wrote it and I
apologise for the attitude.
Asking questions should never be discouraged, but the point still
stands that it's important to understand the margin of error in the
answer.
-Stuart
--
http://stut.net/
--- End Message ---
--- Begin Message ---
On Fri, 6 Feb 2009 10:11:49 +0100, cr.vege...@gmail.com wrote:
> I saved both scripts with ANSI in stead of UTF-8 and the problem is gone.
> So the utf-8 BOM character (Byte Order Mark) caused it.
> Unfortunately my editor has no option to store BOM-free scripts.
>
> Is it standard that PHP scripts should be saved without a BOM character ?
This is not a PHP matter, unless PHP 6 (which will have
Unicode support) does something with it. PHP 5 just outputs
it as is.
A BOM character is supposed to be the *first* character in
a text stream. Otherwise it should be treated as a
ZERO WIDTH NON-BREAKING SPACE.
<http://unicode.org/faq/utf_bom.html#bom1>
> Test results ...
> If "test.php" (utf8) requires "echo.php" (utf8), page source has "C�testD",
> size 9
> If "test.php" (ansi) requires "echo.php" (utf8), page source has
> "CtestD", size 7
> If "test.php" (ansi) requires "echo.php" (ansi), page source has "CtestD",
> size 6
>
> The reason for asking is that sometimes "" is displayed on some pages.
That means you've used a utf-8 BOM in a page using an 8-bit
character encoding (eg. iso-8859-1 or similar), or that you
have utf-8 encoded it twice.
/Nisse
--- End Message ---
--- Begin Message ---
Hi,
I am trying to write a programme to read a rss xml file.
...
<media:content url="*exampe.jpg*" ...>
...
scan anyone tell me how to get the url attribute? I wrote some codes
similar:
$doc = new DOMDocument;
$doc->load($myFlickrRss);
$r = $doc->getElementsByTagName('media:content');
for($i=0;$i<=$r->length;$i++) {
// help here
}
--- End Message ---
--- Begin Message ---
Morris wrote:
Hi,
I am trying to write a programme to read a rss xml file.
...
<media:content url="*exampe.jpg*" ...>
...
scan anyone tell me how to get the url attribute? I wrote some codes
similar:
$doc = new DOMDocument;
$doc->load($myFlickrRss);
$r = $doc->getElementsByTagName('media:content');
for($i=0;$i<=$r->length;$i++) {
// help here
}
use http://rssphp.net/ you can view the source online and it's all done
using DOMDocuments :)
--- End Message ---
--- Begin Message ---
I know rss_php, but it doesn't fit my solution.
Is anyone able to help me with my question?
thx
2009/2/8 Nathan Rixham <nrix...@gmail.com>
> Morris wrote:
>
>> Hi,
>>
>> I am trying to write a programme to read a rss xml file.
>>
>> ...
>> <media:content url="*exampe.jpg*" ...>
>> ...
>>
>> scan anyone tell me how to get the url attribute? I wrote some codes
>> similar:
>>
>>
>> $doc = new DOMDocument;
>> $doc->load($myFlickrRss);
>>
>> $r = $doc->getElementsByTagName('media:content');
>> for($i=0;$i<=$r->length;$i++) {
>>
>> // help here
>>
>> }
>>
>>
> use http://rssphp.net/ you can view the source online and it's all done
> using DOMDocuments :)
>
--- End Message ---
--- Begin Message ---
Hey,
Is it possible to append a result query from one call to
mysql_query() to the end of another if the specified fields
are identical?
Something like that would accomplish ths?
$r1 = mysql_query('some sql');
$r2 = mysql_query('some sql');
$r3 = $r1.$r2;
I suppose they could be read into an array then output that
way, but I was hoping to more easily just append the result sets.
Thanks,
Skip
--
====================================
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://bigskypenguin.com
------------------------------------
Those of you who believe in
telekinesis, raise my hand.
-- Kurt Vonnegut
--- End Message ---
--- Begin Message ---
On Sun, 2009-02-08 at 12:22 -0600, Skip Evans wrote:
> Hey,
>
> Is it possible to append a result query from one call to
> mysql_query() to the end of another if the specified fields
> are identical?
>
> Something like that would accomplish ths?
> $r1 = mysql_query('some sql');
> $r2 = mysql_query('some sql');
>
> $r3 = $r1.$r2;
>
> I suppose they could be read into an array then output that
> way, but I was hoping to more easily just append the result sets.
>
> Thanks,
> Skip
>
> --
> ====================================
> Skip Evans
> Big Sky Penguin, LLC
> 503 S Baldwin St, #1
> Madison WI 53703
> 608.250.2720
> http://bigskypenguin.com
> ------------------------------------
> Those of you who believe in
> telekinesis, raise my hand.
> -- Kurt Vonnegut
>
Can you not take this to the SQL itself, like maybe using some form of
join on the query.
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
Can you not take this to the SQL itself, like maybe using some form of
join on the query.
I've been trying that, and frankly gave up, being whipped into
submission and having to admin I'm not an expert DBA, but I
hesitated to post the queries lest I be flamed for posting
off-topic.
--
====================================
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://bigskypenguin.com
------------------------------------
Those of you who believe in
telekinesis, raise my hand.
-- Kurt Vonnegut
--- End Message ---
--- Begin Message ---
On Sun, 2009-02-08 at 12:37 -0600, Skip Evans wrote:
> Ashley Sheridan wrote:
> >>
> > Can you not take this to the SQL itself, like maybe using some form of
> > join on the query.
> >
>
> I've been trying that, and frankly gave up, being whipped into
> submission and having to admin I'm not an expert DBA, but I
> hesitated to post the queries lest I be flamed for posting
> off-topic.
>
> --
> ====================================
> Skip Evans
> Big Sky Penguin, LLC
> 503 S Baldwin St, #1
> Madison WI 53703
> 608.250.2720
> http://bigskypenguin.com
> ------------------------------------
> Those of you who believe in
> telekinesis, raise my hand.
> -- Kurt Vonnegut
>
Well if a join is not an option, what about something like this:
$r1 = mysql_query('some sql');
$r2 = mysql_query('some sql');
$results = Array();
while($row = mysql_fetch_array($r1))
{
$results[] = $row;
}
while($row = mysql_fetch_array($r2))
{
$results[] = $row;
}
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Oh, yeah, that's fine. I knew I could od it with arrays, but
also looked to see if there was any way to just do an append,
and I also need to sort them as well, so maybe I better get
back to figuring out a join.
Skip
Ashley Sheridan wrote:
On Sun, 2009-02-08 at 12:37 -0600, Skip Evans wrote:
Ashley Sheridan wrote:
Can you not take this to the SQL itself, like maybe using some form of
join on the query.
I've been trying that, and frankly gave up, being whipped into
submission and having to admin I'm not an expert DBA, but I
hesitated to post the queries lest I be flamed for posting
off-topic.
--
====================================
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://bigskypenguin.com
------------------------------------
Those of you who believe in
telekinesis, raise my hand.
-- Kurt Vonnegut
Well if a join is not an option, what about something like this:
$r1 = mysql_query('some sql');
$r2 = mysql_query('some sql');
$results = Array();
while($row = mysql_fetch_array($r1))
{
$results[] = $row;
}
while($row = mysql_fetch_array($r2))
{
$results[] = $row;
}
Ash
www.ashleysheridan.co.uk
--
====================================
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://bigskypenguin.com
------------------------------------
Those of you who believe in
telekinesis, raise my hand.
-- Kurt Vonnegut
--- End Message ---
--- Begin Message ---
2009/2/8 Skip Evans <s...@bigskypenguin.com>:
> Is it possible to append a result query from one call to mysql_query() to
> the end of another if the specified fields are identical?
>
> Something like that would accomplish ths?
> $r1 = mysql_query('some sql');
> $r2 = mysql_query('some sql');
>
> $r3 = $r1.$r2;
>
> I suppose they could be read into an array then output that way, but I was
> hoping to more easily just append the result sets.
Best place to do this is in the SQL query with a UNION.
http://dev.mysql.com/doc/refman/5.0/en/union.html
-Stuart
--
http://stut.net/
--- End Message ---
--- Begin Message ---
At 12:37 PM -0600 2/8/09, Skip Evans wrote:
Ashley Sheridan wrote:
Can you not take this to the SQL itself, like maybe using some form of
join on the query.
I've been trying that, and frankly gave up, being whipped into
submission and having to admin I'm not an expert DBA, but I
hesitated to post the queries lest I be flamed for posting off-topic.
Who does that?
We post all sorts of stuff here.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Skip Evans wrote:
> Oh, yeah, that's fine. I knew I could od it with arrays, but
> also looked to see if there was any way to just do an append,
> and I also need to sort them as well, so maybe I better get
> back to figuring out a join.
Just add asort() to what Ashley suggested.
The thing to keep in mind - what mysql_query() returns is NOT a
result-set, but a handle or an oblique reference to one. The only way
to access it is with mysql_fetch_*().
/Per
--
Per Jessen, Zürich (-0.32°C)
--- End Message ---
--- Begin Message ---
I've read the docs about class constants and found some inconsistency (at
least according to my knowledge), namely in the following statement:
"The value must be a constant expression, not (for example) a variable, a
class member, result of a mathematical operation or a function call."
Questions:
Can't result of a mathematical operation be a constant expression? What is
the answer of 1 + (2 - 3) * 4 / 5? Does it depend on a value that can't be
determined immediately (i.e. variable)?
In the name of maintainability, we do need mathematical operation as
constant expression (based on true story). For example, see the following
code:
// constants used to add log entry
// authentication related
const action_login = 1;
const action_logout = action_login + 1;
// sco related
const action_create_sco = action_logout + 1;
const action_search_sco = action_create_sco + 1;
const action_list_sco = action_create_sco + 2;
const action_edit_sco = action_create_sco + 3;
const action_delete_sco = action_create_sco + 4;
// eLesson related
const action_create_lesson = action_delete_sco + 1;
const action_search_lesson = action_create_lesson + 1;
const action_list_lesson = action_create_lesson + 2;
const action_edit_lesson = action_create_lesson + 3;
const action_delete_lesson = action_create_lesson + 4;
const action_export_lesson = action_create_lesson + 5;
const action_import_lesson = action_create_lesson + 6;
// eCourse related
const action_create_course = action_import_lesson + 1;
const action_search_course = action_create_course + 2;
const action_list_course = action_create_course + 3;
const action_edit_course = action_create_course + 4;
const action_delete_course = action_create_course + 5;
const action_export_course = action_create_course + 6;
const action_import_course = action_create_course + 7;
const action_play_course = action_create_course + 8;
// profile related
const action_edit_profile = action_play_course + 1;
const action_edit_password = action_edit_profile + 1;
Does any of them results in a non-constant expression? Well, I can easily
subtitute each value by hand. But what if I forget to add one (enough to get
you frustrated) that should be inserted as the second entry? I need to
adjust the other 23 (there are 24 of them) by hand! Using above code, I only
need to adjust action_logout to action_login + 2 and everyone's happy.
In case anybody has a solution without altering the implementation, please
tell me. I'm not a PHP master so I might be coding it in the wrong way.
Please don't suggest define() since it has global scope (i.e. no
encapsulation).
P.S.: I think this should work also for other constant expression (e.g.
string), like: "Hello " . "World"
--
View this message in context:
http://www.nabble.com/Class-constant-inconsistency-tp21906832p21906832.html
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---