3
> Item 1
>
> What I need to have is unique values only.
>
> Item 1
> Item 2
> Item 3
>
> How can I sort out the redundant values in that array?
PHP's 'array_unique' function should help:
http://php.net/array_unique
--
[ joel boonstra | gospelcom.net
SELECT COUNT(whatever) FROM table WHERE MONTH(your_date) = '03';
then your result set will only have one row (the number of matching
rows), and you don't need to do any additional counting work.
However, all of that is for the OP, not for me, so I'm CCing the list
back in.
--
ons.html#IDX1341
[4] This query assumes that end_date is sufficient to determine which
month something is "in". Also, it relies on some potentially
MySQL-specific syntax.
joel
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
their PHP "exam" is
anything like this one, though, the final certification will mean
nothing except that you gave them $10.
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ccess to my variables, but I don't have the danger of
$_POST variables overwriting my existing ones (assuming I don't name
other variables with the p_ prefix, use the proper extract() flags, etc.).
joel
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
gi files through CGI. They will need to fix that, or
he will need to move ganttChart.cgi into a directory that is setup to
handle CGI files -- sometimes you'll have a cgi-bin directory for this
purpose.
joel
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
tual sending.
In addition to a previous suggestion, one way to reliably set that
header is to use phpmailer (http://phpmailer.sourceforge.net/) which has
the option of using an smtp server rather than sendmail directly.
joel
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
itted data, but to make it a little more flexible, maybe
something like this:
To add more valid actions, you can just extend the array of valid
actions, rather than adding clauses to the switch statement.
joel
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
r if the topic has changed
if ($topic != $last_topic) {
print ''.$topic.'';
}
print " $question$answer";
# store the topic for next time around
$last_topic = $topic;
}
print '';
?>
HTH!
[1] http://www.mysql.com/do
at only one instance will be tied to a
vhost (so if one vhost is getting lots of traffic, and one is getting
only a little, there won't be spare servers around to balance things
out). I'm basing that all on what I read at Apache's site, so I may
well be wrong.
joel
--
[ joel boonst
uest, is it?)
and keeping the HTML in the database lets the admin. interface be as
interactive and dynamic as is necessary.
Just my $.02, though -- I'm not going to have to end up maintaining
this, so the best answer is the one that works the best for the OP.
joel
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
iginally entered when they authored
the content. I'm assuming this isn't a 1-to-1 transformation, so that
these:
Some bold text
Some bold text
Some bold text
will all get turned into:
Some bold text
If you turn the text back into , then it's not clear whic
so many parens.
IOW, Adam's is better ;)
[0]: The one I posted was:
'//i'
which didn't require quotes to match each other, didn't allow for
arbitrary whitespace, and didn't allow for XHTML-style tag closing.
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
probably be carried on
offlist. Or, better yet, I bet css-discuss can provide tips for using
CSS to support handheld browsers, without having to duplicate content or
do browser sniffing.
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Fri, Feb 13, 2004 at 02:19:11PM -0500, joel boonstra wrote:
> if (preg_match('//ig', $dah, $matches)) {
> print_r($matches);
> }
Doh! The '/ig' should just be '/i'.
joel
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (htt
h. Compare:
';
$doo[2] = "";
foreach ($doo as $dah) {
if (preg_match('//i', $dah, $matches)) {
print_r($matches);
}
# adding ? after the *
if (preg_match('//ig', $dah, $matches)) {
print_r($matches);
}
}
?>
'Course, it still doesn't
ing designs in this manner is that you are not
coding for browsers or platforms; you are coding for capabilities and
standards. It's pretty clear that browser rendering/standards support
is only getting better, and that the number/variety of browsers is
growing.
> Could you throw in another 2 ce
le to whichever browser accesses your site. IMHO,
browser-sniffing to serve different content is a bad idea.
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
he proper code (including the properly-formed URL mentioned by others)
is something like:
if($foo == 'something'){
header('Location: http://www.example.com/to_another_page.php') ;
exit();
}else
{
do another thing in here
}
h
Permanently), then the redirected URL is indexed.
I have nothing to back this up other than trying it out with some sites,
and watching the results (with Google) over a few months, but it makes
sense to me.
joel
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://w
address, then no, bots can't figure that out. Unless
they switch useragents/IPs and compare the results that they get. Or
unless a human complains that the listing is innacurate. etc...
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Thu, Feb 05, 2004 at 05:42:54PM -0500, joel boonstra wrote:
> # ini_set():
> ini_set('include_path', "{$_SERVER['DOCUMENT_ROOT']}:.");
Replying to myself, it appears that PHP >= 4.3.0 has a family of
functions specifically for tweaking includ
to
contain anything useful. If you set it manually, though, it can contain
whatever you want.
Unless I'm misunderstanding what you're saying...
joel
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
#x27;/');
Why not use php's include_path setting? No need to define constants, no
need to worry about the location of your script relative to the document
root, and it works with more functions than just include() and
require().
I have found it to be the cleanest, most reliable, a
rough
its built-in plugin interface, which is Perl).
joel
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
hings added
or removed as you're coding -- not having to worry about removing a
trailing comma for an element that is now the last one, or adding one to
previous elements when adding items to the list is a small but useful
timesaver.
Perl does this as well. I'm not sure which other langua
E : $code\n\n";
$replace = "Foo";
$code = preg_replace($url,$replace,$code,1);
echo "AFTER: $code\n";
?>
When I run this, the output is:
BEFORE : blah http://www.foo.com/maxbid/Unsubscribe.php?EmailAddress=[MAIL] blah
AFTER: blah Foo blah
Next time, I'll test ou
ged the mime type of the whole document.
I'm guessing that the .css file will be used in the traditional way:
>
>
> My Page
>
>
Now, it's the browser that's fetching the .css file, so the header()
call isn't a problem at all. The browser simply performs a s
rd slashes.
Additionally, if you're only doing a simple string substitution, you
should use str_replace instead:
http://php.net/str_replace
You won't need the "/" delimiters, and it will be faster than using
preg_replace.
joel
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
er generator with srand(). If you are using 4.2.0 or
greater, and still seeing non-random behavior, I don't really have an
answer.
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
"true" and "false". Just negate the result
of your modulus operator, and take advantage of the fact that "0" is
false, and "1" is true:
function isOdd ($value) {
return !((int)$value % 2);
}
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mail
On Tue, Jan 06, 2004 at 05:33:41PM -0500, joel boonstra wrote:
> I would recommend not simply doing a select *, but rather specifying
> which columns you want. That way, if your database schema changes
> (e.g., you add two more columns), your code won't break.
And, respon
{option domain-name-servers
$dns01, $dns02;option routers $rtrs;range $rnge;}";
print $tmp;
$vlans[] = $tmp;
}
?>
I would recommend not simply doing a select *, but rather specifying
which columns you want. That way, if your database schema changes
(e.g., you add two more colu
worry about leap years, number of
days in a month, etc...
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
sers upload a .zip (or .tar.gz)
file over HTTP, and have your server uncompress it and (optionally)
create a directory structure matching the contents of that .zip.
The 'gallery' image gallery software does .zip file uploading, and it's
quite handy.
Just a thought,
joel
--
[
x27;, then a
file matching in the current working directory will take precedence over
the one in your site root. So keep that in mind...
--
[ joel boonstra | gospelcom.net ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
t a maximum of 5 seconds (or whatever) before they see your
new image.
The point is that you can't talk directly to the browser. You have to
talk to the server, and then have the client periodically poll the
server to see what new data it should get.
I think.
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
e between those
clicks, thus making even a temporary id based on the IP address
unreliable, and perhaps frustrating if your site keeps 'forgetting'
things about the user.
Joel
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
27;s going
on. So it requires more documentation.
* you run the risk of stepping on pre-existing variables.
However, the upside, namely, eliminating a *ton* of code, is attractive
enough to me that I use this for most select boxes I do.
Joel
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
heduler, Mac (non-osx) has applescript (I think), and OSX and Linux
have, well, everything.
Otherwise, you could try an online cron service. Like:
http://www.cronservice.com/
I have no idea how reliable they are, etc..., but it's likely cheaper
than hosting with a new place.
J
be at, or this:
http://www.php.net/manual/en/function.array-search.php
if you're not sure what key 'foo' will be at and you want to know what
that key is.
Joel
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
x27;t imagine how
I could deal with variables that didn't have something in front of them
to separate them from barewords.
Oh well.
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
f you can't use perl for the whole thing, perhaps you could have PHP do
all your logic, and then pass the data to a perl script to format and
save it to a file. Or maybe sprintf() does everything you need...
Joel
(more on perl formats:
http://www.perl.com/doc/manual/html/pod/perlform.html)
--
er, it
supports Flash banners, as well as everything else you want to throw at
it, it's free, and it's free. Installation is remarkably easy.
Joel
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ise, have you checked with your hosting company to see if this is
a common issue that their customers have?
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
a useful one, but if you
don't want to call a script directly, I think you'll need a rewrite.
There also may be another way to do it in Apache, but I don't think
there's anything in PHP you can do to accomplish this.
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
txt, .conf, etc...) you might want to come up
with a more general way to add filters besides simply tacking on stuff
with &&. One thought might be to keep an array of patterns, and do a
match on the whole array. When a new file needs to be filtered, simply
add an entry to the array, keeping
ributes, I'm 100% sure you don't want to remove from *all*
of them. Like this:
Removing the quotes from the title attribute will likely break at least
some browsers, if not all. So your regular expression needs to be able
to handle that gracefully.
Good luck!
--
[ joel boo
if you're counting rows just to find out what the next value
for an ID is, then, as you already said, you're doing the wrong thing.
Joel
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
e Return-Path in this manner;
that's out of my area of expertise, so if the above doesn't work, I'm
not much more help...
Joel
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ine your own index-format, and use the 'FROM' token instead of
'FROMORTO'.
More info is available by going to Pine's config screen (m, s, c),
searching for 'index-format' (w index-format ), and hitting
CTRL-G to bring up the help.
HTH!
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
7;ll start using {}
everywhere I embed variables in strings, but I was unaware that stuff
like this:
"This is a $variable embedded in a string"
might no longer work. If you have URLs, I'd love to read up on this.
Thanks!
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
> Try phpadsnews.
phpAdsNew can be found on SourceForge here:
http://sourceforge.net/projects/phpadsnew/
I've been using it in production for over a year now, and have found it
to be quite a handy program.
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing Li
;t a PHP script (it's Perl), but it does exactly what you want:
http://oss.gospelcom.net/staff.php
The first tool listed there is called 'cvsdump' -- it dumps, processes,
and mails a MySQL table in CVS.
HTH!
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (h
, one very similar):
No fuss, no muss. You don't have to worry about what order they were
inserted in, artificially munging your data, or anything else.
HTH!
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
7;w'). Maybe that was just a typo in the email, but that will definitely
be a problem in the code, too.
Of course, all the other advice ('==' instead of '=', '&&' instead of
'and', etc...) should be heeded as well...
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
en be
parsed. Why you would want this, I don't know, since PHP is much more
fully featured than SSI, and can do everything SSI can.
Joel
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
know wordwrap had the
3rd (and 4th) parameters till now.
Joel
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
t's doing what it should.
If you want your HTML to appear wordwrapped, modify your PHP to use the
'nl2br()' function:
This will convert all newlines to tags, and your HTML output will
look just like your text output.
Joel
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP G
tes. No extra modules
required, nothing to compile. Just unzip, and it works (more or less).
The only potential sticky point is that it writes to /tmp when images are
involved, so if that's a problem for whatever reason, you'll need to
change one line. Otherwise, it works great!
--
lines. Here is a
non-syntax-error-ridden version:
http://yourdomain.com/?$prev_year-$prev_month-$prev_day";;
$next_link = "http://yourdomain.com/?$next_year-$next_month-$next_day";;
?>
Sorry!
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://w
;
This doesn't take into account whether or not yesterday or tomorrow's
objects or files or whatever actually exists. Since that is
site-specific, you'll need to add that sort of logic yourself.
Hope that helps!
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General
ontents() {
print $this->get_contents();
}
}
Then you're good. Otherwise, I don't think it's possible...
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-
doesn't seem
like the way things should work.
Am I completely wrong? I seem to recall that this sort of thing should
work in a more strict OO language, like C++.
I'm using PHP 4.0.6, if that's important.
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (htt
I have never used it, but it definitely looks to be worthwhile.
--
[ joel boonstra | [EMAIL PROTECTED] ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
n documents, thus allowing your PHP script to execute and
output SSI, which would then get parsed by the server and be executed,
again.
Why you would need this, I don't know. As people already mentioned, SSI's
very limited capabilities should all be available in PHP.
Joel
--
[ joel boonst
binary data (probably using a
binary-safe read) from the image file you want to display (in $url), and
then print that data out after the content-type header.
Right now, a browser would get sent a content-type header for a gif, and
then the following string:
http://www.mysite.com/myimage.gif
67 matches
Mail list logo