One trick that one of my friends has taught me is to only use double
quotes s where needed as they are parsed by PHP and instead use single
quotes 's
i.e.
$fred['john'] = 10;
is better than
$fred[john] = 10;
or
echo 'This is some text' . \n;
instead of
echo This is some text\n;
He told me
2007. 10. 3, szerda keltezéssel 16.07-kor Cameron Just ezt írta:
One trick that one of my friends has taught me is to only use double
quotes s where needed as they are parsed by PHP and instead use single
quotes 's
i.e.
$fred['john'] = 10;
is better than
$fred[john] = 10;
or
echo
I have a company table and a contacts table. In the contacts table, there
is a field called companyID which is a link to a row in the company table.
What is the easiest way to query the company table for all the company rows
whose ID is NOT linked to in the contact table? Basically, the
hi Wolf and Jim, thanks for the answer! Very useful.
Now It would be wondeful if I can pick up the values from a CSV file
(coordinates) and apply a postGIS/postgreSQL function (Select ...) to this
data and add the resulting values as a new filed in the CSV !
Is that possible?
Thanks,
2007. 10. 3, szerda keltezéssel 05.21-kor [EMAIL PROTECTED] ezt írta:
I have a company table and a contacts table. In the contacts table, there
is a field called companyID which is a link to a row in the company table.
What is the easiest way to query the company table for all the
Actually you still want to use a join, just an OUTER join instead of an INNER
one.
With an OUTER join, you can get all the rows that match as well as rows where
it doesn't match:
http://en.wikipedia.org/wiki/Join_(SQL)#Left_outer_join
In the example there, DepartmentID 36 is present in the
- Original Message -
From: Zoltán Németh [EMAIL PROTECTED]
it's not very efficient, but I don't have any better idea. someone else?
Indeed, that sort of query is one of the worst and there is little you can
do to improve it save making sure you have an index on the field of the
Zoltán Németh wrote:
and anyway, the microseconds you could win with this really don't
count that much to be worth the effort... find real bottlenecks and
optimize against those.
And finally, if you're worried about microseconds, why are you using an
interpreted language?
/Per Jessen,
Hi J,
Checkout this,
SELECT * FROM tbl_company where id not in (SELECT companyID from
tbl_contacts)
Regards,
Lasitha Alawatta
Application Developer
Destinations of the World Holding Establishment
P O Box: 19950
Dubai, United Arab Emirates
( Ph +971 4 295 8510 (Board) / 1464 (Ext.)
7
Sure, just use the code I/we provided as the basis for what you need.
When you get stuck, post your code and we'll be happy to look at it for you.
Wolf
pere roca [EMAIL PROTECTED] wrote:
hi Wolf and Jim, thanks for the answer! Very useful.
Now It would be wondeful if I can pick
there is no way to create an abstract class in php4.
in an abstract class definition subclasses are forced to implement those
methods
that have been declared abstract. or they are allowed to declare the method
as abstract themselves and force their children to provide a concrete
definition.
the
On 10/3/07, ashish.sharma [EMAIL PROTECTED] wrote:
Hello All,
I am working on PHP from quite some time. I am pretty much comfortable in
writing PHP code but I always want that I should write good, quality code.
For this I always look for the best practices which other developers uses
and
On Wed, 2007-10-03 at 09:52 -0400, Nathan Nobbe wrote:
one nice trick you can easily implement is to compress your code before
pushing it to production.
the php cli exposes a method for stripping out the whitespace and comments.
php -w
Do it right, use a compile cache like Eaccelerator or
On 10/3/07, Robert Cummings [EMAIL PROTECTED] wrote:
On Wed, 2007-10-03 at 09:52 -0400, Nathan Nobbe wrote:
one nice trick you can easily implement is to compress your code before
pushing it to production.
the php cli exposes a method for stripping out the whitespace and
comments.
On Wed, 2007-10-03 at 10:22 -0400, Nathan Nobbe wrote:
On 10/3/07, Robert Cummings [EMAIL PROTECTED] wrote:
On Wed, 2007-10-03 at 09:52 -0400, Nathan Nobbe wrote:
one nice trick you can easily implement is to compress your code before
pushing it to production.
the php cli exposes
All,
I am attempting to perform multiple prepared queries using mysqli. I
want to pull information out of one table based on the information in
another. I do not receive any errors and the rest of the page seems to
load correctly. Below is my code:
foreach ($uniqueids as $entryid) {
Nathan Nobbe [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
there is no way to create an abstract class in php4.
Oh yes there is! I knw, because I have done it! The definition of an
abstrract class is one that cannot be instantiated into an object. It can,
however, be extended
On Wed, 3 Oct 2007, Mark wrote:
I'm currently fetching feeds about every hour (automatically in php)
but sometimes there are no new updates in a feed for 2 hours. so no i
wonder if it's possible to check the feed somehow to see if it changed
since i last fetched it and if it's the case than
keeping data private is how encapsulation in facilitated.
here is a really simple way to violate encapsulation in php4
class BreakMe {
// private
var $iWishIWasPrivate;
}
// later on
$instance = new BreakMe();
$instance-iWishIWasPrivate = 'encapsulation violated';
if the member variable
On 10/3/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
I have a company table and a contacts table. In the contacts table, there
is a field called companyID which is a link to a row in the company
table.
What is the easiest way to query the company table for all the company
rows
whose
Hi J,
Checkout this,
SELECT * FROM tbl_company where id not in (SELECT companyID from
tbl_contacts)
Brilliant! This is exactly what I was looking for, and is quite
logical/readable! Thanks to everyone for the ideas!
J
Regards,
Lasitha Alawatta
Nathan Nobbe [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
keeping data private is how encapsulation in facilitated.
Absolute rubbish. Encapsulation is the act of placing data and the
operations that perform on that data in the same class. The data does not
have to be private at
On 10/3/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hi J,
Checkout this,
SELECT * FROM tbl_company where id not in (SELECT companyID from
tbl_contacts)
Brilliant! This is exactly what I was looking for, and is quite
logical/readable! Thanks to everyone for the ideas!
J
On 10/3/07, Tony Marston [EMAIL PROTECTED] wrote:
Encapsulation is NOT data hiding.
I repeat, encapsulation has absolutely nothing to do with data hiding.
http://en.wikipedia.org/wiki/Information_hiding
encapsulation is facilitated via ppp in object oriented programming
languages.
i
I agree with this. Never use a subquery when a join will work. The
optimizer with thank you with performance.
James Ausmus wrote:
On 10/3/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hi J,
Checkout this,
SELECT * FROM tbl_company where id not in (SELECT companyID from
tbl_contacts)
Nathan Nobbe [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On 10/3/07, Tony Marston [EMAIL PROTECTED] wrote:
Encapsulation is NOT data hiding.
I repeat, encapsulation has absolutely nothing to do with data hiding.
http://en.wikipedia.org/wiki/Information_hiding
On 10/3/07, Tony Marston [EMAIL PROTECTED] wrote:
Encapsulation is NOT data hiding. Take a look at
please stop putting words into my mouth. i never once said encapsulation is
data hiding.
I stated PublicPrivateProctected facilitates encapsulation. tonight when i
get home ill post
a snippet
Advanced PHP Programming, Geo. Schlossnagle
Discusses large-scale, optimized websites in great detail
ashish.sharma wrote:
Hello All,
I am working on PHP from quite some time. I am pretty much comfortable in
writing PHP code but I always want that I should write good, quality code.
For this I
Hi Nathaniel,
When your query starts its second loop, the resultset from the first one is
still defined as the resultset in your prepared statement object. Before you
can get another resultset, you need to clear the first one using the
mysqli_stmt_free_result function. It would probably be
Nathan Nobbe [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On 10/3/07, Tony Marston [EMAIL PROTECTED] wrote:
Encapsulation is NOT data hiding. Take a look at
please stop putting words into my mouth. i never once said encapsulation
is
data hiding.
I stated
Well if you have the GD libs installed you could do something with
imagecreatefromjpeg() and just send a header with the following before
the page is displayed. header(Content-Type: image/jpeg);
Kevin Murphy wrote:
Hello all,
Following up with my success last week with putting downloadable
Greetings,
I am attempting to alternate the colors of the container DIV. Anyone know
how to do this?
?php
$study_title = stripslashes($study_title);
$study_title = nl2br($study_title);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
extract ( $row );
On 10/3/07, Greg Donald [EMAIL PROTECTED] wrote:
cat fsockopen.php
#!/usr/bin/env php
?php
$fp = fsockopen( 'destiney.com', 80, $errno, $errstr, 30 );
if( !$fp )
{
echo $errstr ($errno)\n;
}
else
{
$out = GET /rss HTTP/1.1\r\n;
$out .= Host: destiney.com\r\n;
$out .=
On 10/3/07, Steve Marquez [EMAIL PROTECTED] wrote:
Greetings,
I am attempting to alternate the colors of the container DIV. Anyone know
how to do this?
you could always use javascript
we've used something like this with success:
http://www.sitepoint.com/article/background-colors-javascript
Carlton Whitehead wrote:
Hi Nathaniel,
When your query starts its second loop, the resultset from the first
one is still defined as the resultset in your prepared statement
object. Before you can get another resultset, you need to clear the
first one using the mysqli_stmt_free_result
Steve Marquez wrote:
I am attempting to alternate the colors of the container DIV. Anyone know
how to do this?
I've used variants of this:
?php while ($condition): ?
div style=background-color: #?= ($i++%2) ? 'ff' : 'ee' ?;
?php endwhile ?
jon
--
PHP General Mailing List
thats the key use mod 2 and check if the result is 1 or 0.
-nathan
On 10/3/07, Jon Anderson [EMAIL PROTECTED] wrote:
Steve Marquez wrote:
I am attempting to alternate the colors of the container DIV. Anyone
know
how to do this?
I've used variants of this:
?php while ($condition): ?
[EMAIL PROTECTED] wrote:
I have a company table and a contacts table. In the contacts table, there
is a field called companyID which is a link to a row in the company table.
What is the easiest way to query the company table for all the company rows
whose ID is NOT linked to in the contact
Add this to your default.css file... Or to the page...
style
TR.dataRow1 { background-color: #e8f5f7; } /* light */
TR.dataRow2 { background-color: #dce8ea; } /* dark */
/style
Then just do this:
TR class=?php echo ($r = !$r) ? dataRow1 : dataRow2; ?
Forget all that $i++ and (mod) % stuff...
Martin Marques wrote:
SELECT * FROM company WHERE id NOT IN (SELECT companyID FROM contacts);
Not ideal as has been mentioned else where in this thread.
Col
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I need to retrieve a huge amount of data form a database and do so many
times. To eliminate the overhead of connecting to the database and pulling
down all that info over and over, I'm trying to pull it down only once and
stick it into a session. The problem is I get the first few results and
Dan wrote:
I need to retrieve a huge amount of data form a database and do so
many times. To eliminate the overhead of connecting to the database
and pulling down all that info over and over, I'm trying to pull it
down only once and stick it into a session. The problem is I get the
first
Colin Guthrie wrote:
Martin Marques wrote:
SELECT * FROM company WHERE id NOT IN (SELECT companyID FROM contacts);
Not ideal as has been mentioned else where in this thread.
Col
I think one would have to take into account the DB type being used here.
I can have MySQL and PostgreSQL setup
After thinking about this a while I also thought of making my own cache.
The problem with that is would it be any faster or have any less strain on
the server than having multiple requests/connections to the database?
- Dan
Per Jessen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Does the data change often? If not you could just enable query cache and
cache connection threads and you'd probably be fine.
Dan wrote:
After thinking about this a while I also thought of making my own
cache. The problem with that is would it be any faster or have any
less strain on the
Steve Marquez wrote:
Greetings,
I am attempting to alternate the colors of the container DIV. Anyone know
how to do this?
Thank you very much,
--
Steve M.
?php
$rowColors = array('#EE', '#DD');
$study_title = nl2br(stripslashes($study_title));
$counter = 0;
if ( $result ) {
As you can see, a bunch of different ways to skin this particular cat.
For fun, I wanted to show you something I came up with early in my PHP
career. It's kinda dumb and some of the other ways shown are easier to
understand right off the bat, but here is an alternate way to do it.
My initial
The data doesn't change often but the querys do. Thats why I was
origionally thinking of just storing the entire result in a session and just
use the part of the session I needed. So caching wouldn't really work.
That was something intresting though that I didn't know earlier thanks!
- Dan
stick in in an array in a session
"Dan" [EMAIL PROTECTED] 10/3/2007 2:21 PM
I need to retrieve a huge amount of data form a database and do so many times. To eliminate the overhead of connecting to the database and pulling down all that info over and over, I'm trying to pull it down only
On Wed, 2007-10-03 at 14:49 -0700, Jim Lucas wrote:
This is only from my own personal testing. Mind you that I have only been
using PostgreSQL for a
year or so. But one problem that I have always ran into with MySQL is that
when JOIN'ing tables
that have large data sets is a PITA.
On Wed, 3 Oct 2007, Robert Cummings wrote:
I'd use the left join whenever available.
Similarly, I design for the left join whenever possible.
--
Greg Donald
Cyberfusion Consulting
http://cyberfusionconsulting.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Robert Cummings wrote:
On Wed, 2007-10-03 at 14:49 -0700, Jim Lucas wrote:
This is only from my own personal testing. Mind you that I have only been using PostgreSQL for a
year or so. But one problem that I have always ran into with MySQL is that when JOIN'ing tables
that have large data
I just found a tool called CodeLobster, but the site seems a little funky,
mostly because the owners first language is not English...is anyone using this
tool and is it any good?
Thanks
bastien
_
Be seen when you can't be
In the following example I show a simple OOP example (because I felt
like it) and illustrate why using CSS classes is the most powerful way
to do row style cycling. Hopefully you're using a decent browser (almost
anything other than IE -- I recommend Opera :) but if not then IE7 will
suffice to
On Thu, 2007-10-04 at 11:23 +1000, Chris wrote:
Robert Cummings wrote:
On Wed, 2007-10-03 at 14:49 -0700, Jim Lucas wrote:
This is only from my own personal testing. Mind you that I have only been
using PostgreSQL for a
year or so. But one problem that I have always ran into with
Robert Cummings wrote:
On Thu, 2007-10-04 at 11:23 +1000, Chris wrote:
Robert Cummings wrote:
On Wed, 2007-10-03 at 14:49 -0700, Jim Lucas wrote:
This is only from my own personal testing. Mind you that I have only been using PostgreSQL for a
year or so. But one problem that I have always
On 10/3/07, Robert Cummings [EMAIL PROTECTED] wrote:
Hopefully you're using a decent browser (almost
anything other than IE -- I recommend Opera :)
opera is the best for straight browsing. ive found i could have 40 to 50
tabs open with no noticeable perforrmace hit. firefox bogs badly after
Hi list, good day.
I have a simple script that inserts text on a mysql table, that has a field
named description and the type is text.
Everting works fine, except when I try to insert a text that includes a
simple quote.
For example
Yamil´s car
I send the character string to a
PHP List,
I would like to set up a function within my system that can test a file
that a user has uploaded and determine what kind of file it is. My
intention is to only handle a fairly small number of common file types*,
so I don't think I need to build anything too robust.
Of course, I
There are any number of elements to try
htmlspecialchars
mysql_real_escape_string
addslashes
RTFM and see what works best for your situation
bastien From: [EMAIL PROTECTED] To: php-general@lists.php.net Date: Thu, 4
Oct 2007 11:44:34 +0900 Subject: [PHP] inserting ´ in a db Hi list,
Are there any known security issues/concerns with compiling PHP with
imap/pop3 support? Such as hijacking php pages and relaying spam, etc...?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Yamil Ortega wrote:
Hi list, good day.
I have a simple script that inserts text on a mysql table, that has a field
named description and the type is text.
Everting works fine, except when I try to insert a text that includes a
simple quote.
For example
Yamil´s car
On 10/3/07, Dave M G [EMAIL PROTECTED] wrote:
So, ultimately, what I'm wondering is, what should I be using in order
to determine file MIME types that will be the most commonly installed on
servers with PHP?
I wrote something that does system(file -iNr $file) which gives you
the
Are there any known security issues/concerns with compiling PHP with
imap/pop3 support? Such as hijacking php pages and relaying spam, etc...?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Don O'Neil wrote:
Are there any known security issues/concerns with compiling PHP with
imap/pop3 support? Such as hijacking php pages and relaying spam, etc...?
[ was posting this again a mistake or just impatience? ]
I'm not sure how opening an email inbox can hijack pages but maybe
someone
Robert Cummings wrote:
On Wed, 2007-10-03 at 14:49 -0700, Jim Lucas wrote:
This is only from my own personal testing. Mind you that I have only been using PostgreSQL for a
year or so. But one problem that I have always ran into with MySQL is that when JOIN'ing tables
that have large data
[EMAIL PROTECTED] (Chris) writes:
Everting works fine, except when I try to insert a text that includes a
simple quote.
http://www.php.net/mysql_real_escape_string
I'll see you that and raise you PEAR's database interfaces:
http://pear.php.net/package/DB - especially
I would also suggest to limit yourself to things you actually need not
to select the whole table.
Aleksandar
Jim Lucas wrote:
Colin Guthrie wrote:
Martin Marques wrote:
SELECT * FROM company WHERE id NOT IN (SELECT companyID FROM contacts);
Not ideal as has been mentioned else where in
Aleksandar Vojnovic wrote:
I would also suggest to limit yourself to things you actually need not
to select the whole table.
In this case you can't because you're looking for records that exist in
one table that don't exist in another.
Apart from looking at the whole table in each case how
On Wednesday 03 October 2007, Tom Swiss wrote:
[EMAIL PROTECTED] (Chris) writes:
Everting works fine, except when I try to insert a text that includes a
simple quote.
http://www.php.net/mysql_real_escape_string
I'll see you that and raise you PEAR's database interfaces:
It seems you missed my point :) if you would need all the data then
select them all, but if you need only partial data from the table then
you could limit yourself to that specific columns. I doubt everybody
need everything all the time. True?
Aleksandar
Chris wrote:
Aleksandar Vojnovic
Aleksandar Vojnovic wrote:
It seems you missed my point :) if you would need all the data then
select them all, but if you need only partial data from the table then
you could limit yourself to that specific columns. I doubt everybody
need everything all the time. True?
Ahh - you meant the
[EMAIL PROTECTED] (Jay Blanchard) writes:
In certain cases 0 is the equivalent of FALSE and in other cases a 0 is
just a 0... Exercise care when using 0 to determine if something is FALSE
and understand that 0 has context.
I think context and equivalence are not completely accurate way
73 matches
Mail list logo