?
Thanks,
Rick Fletcher
Reproduce code:
---
?php
$dbh = new PDO( 'sqlite::memory:' );
$dbh-query( 'CREATE TABLE things ( name VARCHAR NOT NULL )');
$dbh-query( 'INSERT INTO things VALUES ( thing one )');
foreach( $dbh-query( 'SELECT * FROM things' ) as $row ) {
print_r( $row
Thanks to anyone who entertained my previous email, but I've solved my
own problem.
It looks like the bug is in PDO_SQLITE 1.0.1. I've just compiled from
that extension from CVS, changing nothing else, and the bug is gone.
--rick
Rick Fletcher wrote:
I've just upgraded to Fedora Core 6
Chances are it's not your fault.
The initial release of 5.0.4 was missing the RunTest.php file. The end
result of which is that pear isn't installed. It was noticed a day
after the initial release, and I believe the 5.0.4 that's on php.net now
has been fixed.
--Rick
mbneto wrote:
Hi,
I've
Brian Dunning wrote:
On Mar 7, 2005, at 7:40 AM, M. Sokolewicz wrote:
array_rand()
But that's likely to give me the same element more than once. I want to
output the entire array but in a random order, like a shuffled deck of
cards.
like a shuffled deck of cards?
http://www.php.net/shuffle
--
Robin Vickery wrote:
On Thu, 27 Jan 2005 16:56:05 +0100, Zouari Fourat [EMAIL PROTECTED] wrote:
this is working fine :
if (eregi(^-?([1-3])+$,$x)
echo x is 1 or 2 or 3;
i forgot to say that doesnt work with 1-20 :(
how to do it ?
if (preg_match('/^(20|1[0-9]|1-9])$/', $candidate)) {
//
Matt Babineau wrote:
Ahh so the regex gods are pissed at me. This is simple (I think), but I need
to figure out how to strip out everything in a string that is not a number.
Any takers?
I appear to have written that last snippet without really even looking
at it. This one works.
?php
$string =
Matt Babineau wrote:
Ahh so the regex gods are pissed at me. This is simple (I think), but I need
to figure out how to strip out everything in a string that is not a number.
Any takers?
?php
$string = asd98.a98asd/7987asd;
$numberless = preg_replace_all( /[^0-9]/, , $string );
?
--
PHP General
Ben Edwards wrote:
The format I am
interested in is DD-MM- which is the way dates are specified in
the UK, strtodate() cant handle this.
Ben, there is no (built in) string-timestamp function that takes a
format. strtotime() is pretty smart about interpreting your input, but
it's limited to
I had been using Zend Studio, but I've just about made the switch to
Eclipse with the TruStudio PHP plugin.
Eclipse: http://www.eclipse.org
TruStudio: http://www.xored.com/trustudio/
Mostly running it in Linux (Fedora Core 3), but I've used that
combination in Windows and OSX, too.
--Rick
--
I have a server on which Apache2 and PHP5 are functioning well, but I
also want to build in support for PHP4 because the webmail package I use
isn't compatible with PHP5... So, I need to install PHP4 next to PHP5,
and make my Directory in httpd.include use PHP4 for my webmail
directory...
I've
[EMAIL PROTECTED] wrote:
All I want to do is capture the keyword (array, break, echo, etc) and color
it.
$txt = this is an array('test');
$pattern = /(array|break|echo|continue)([\(.|\s.|\;.])/;
echo preg_replace($pattern, 'font color=red$0/font', $txt);
This captures array( though and I just
[snip]
when using print_r on a SimpleXML object that has
attributes, the attributes are not shown.
I would propose that this is not the desired response. When using
print_r on an object, it should display all available information
(even, as the manual indicates, private and/or protected
Alexander Kleshchevnikov wrote:
Can I get the information about paly time of the RM file by PHP?
IIRC, the getID3 library has support for reading RealAudio/Video. You
can find it here: http://getid3.sourceforge.net/
--Rick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
is it possible to have a solution that works like an autoloader... for
example:
$myclass = new class();
but if this class wasn't loaded yet, it loads by itself... egg:
if(class_exists(class))
{
$myclass = new class();
}
else
{
require_once(PATH_DIR.'class.class.php');
$myclass =
db( $defined[0], $defined[1], $defined[2], $defined[3] );
which tells me that the $db handle is not being returned when called
from the db() function from within the logs() function and I am not
sure why?
it's being returned, you've just forgotten to assign it. add a $db =
to the beginning
I have a dynamically created image labeled:
stories critiques.jpg
I have use url encode on it when saving it, and it is stored on the server
as:
stories+%26+crtitiques.jpg
[snip]
If I just put the path into the browser directly it also 404's
If I rename the file in any way that removes the % it
function db( $host, $user, $pass, $dbnam ) {
$db = @mysql_pconnect( $host, $user, $pass )or die( mysql_error( $db ));
@mysql_select_db( $dbnam )or die( mysql_error( $db ) );
return $db;
}
function logs() {
global $defined;
db( $defined[9], $defined[1], $defined[2], $defined[3] );
...
You might want to look at webthumb http://www.boutell.com/webthumb/
It is a linux command line utility that creates thumbnails of webpages.
or khtml2png: http://www.babysimon.co.uk/khtml2png/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ApexEleven wrote:
I've googled the question and found no answer that has fixed my
problem. I also searched this list to try and find the answer to no
avail.
My problem is that after my form submits data to another script the
$_FILES global returns nothing but array() when I try to print_r()
it.
Mag wrote:
Hi,
I got a pretty good code snippet from Zend to grap a
remote image and save it to disk, the problem is, when
it saves to my disk i am unable to open the
images...they are blank and the file matches the
remote images filesize...
[snip]
ob_start();
readfile($url);
$img =
Ricardo Cezar wrote:
I have some invitations too! If you wants one, ask me off list.
Limited supply, first requests, etc, like Greg said!
Greg Donald [EMAIL PROTECTED] escreveu na mensagem
news:[EMAIL PROTECTED]
I have some gmail accounts of anyone wants one. Email me off list.
Limited supply,
Greg Donald wrote:
On Mon, 20 Sep 2004 12:15:18 -0700, Rick Fletcher [EMAIL PROTECTED] wrote:
Please stop talking about gmail invites on the list. Anyone who wants
one, or who has some to give away, just do a google search for a place
to get or give them.
Sites like this one (the 3rd result
Greg Donald wrote:
I didn't reply to your email. The email I replied to mentioned nothing
related to PHP.
Exactly.. you probably don't use a threaded email client, else you
might have noticed the thread was on-topic when I started it. The
recursion is killing me here. Need a GMail account?
I do
Diana Castillo wrote:
Anyone know of any function to replace letters with accents with just the
regular letter, for instance replace with a,
with c, with n ?
found this on the strtr() manual page (http://php.net/strtr):
?php
function removeaccents($string){
return strtr(
strtr( $string,
Ed Lazor wrote:
How come the output to this script is World Trade Center instead of Pizza
Delivery?
Thanks,
Ed
?php
class test {
private $var1;
function __construct() {
$this-var1 = World
I'm looking for a program that will run through a directory tree and parse
all the files (ideally by extension, like *.php, *.js, *.html, *.c) and give
me a formatted output (or HTML table or something useful).
It should include the //TODO of course, the path/file, the line(s), and
perhaps other
This recursively gets you file path/name, line number, the matching
line and the 2 that follow it.
$ grep -HrnA 2 TODO: /path/to/code/root
I get a parse error when I put that in my PHP file...
That's not PHP code. It's the syntax for using a program called grep
on the command line which would
Daniel Schierbeck wrote:
I am having some problems with the XML features (I use the fancy new
SimpleXML). It works like a dream when I'm retrieving information from
an XML document, but when I want to insert new tags it screws up. I'm
trying to create a function that saves error logs in an XML
is it possible to use an actuall Oracle-Client (Version = 9)
with PHP ??
Dose anyone habe experiences here ?
It's absolutely possible, and where most of my work lies day to day. Our
DBA has chosen to hold off upgrading to 10g until it's better tested, so we
still use 9i. (He cites a past
on RedHat with PHP 4.3.6 the following code produces 'test' -
I'm expecting
'test2':
class test {
function printClass() {
echo __CLASS__;
}
}
class test2 extends test {
}
test2::printClass();
I would like to get/echo the name of the class calling the
method
I've forgotten how to assign something like this...
$someStr = EOF
bunch of raw non-echo'd html
EOF;
But can't seem to get the right syntax. Tried looking in the
manual, but
don't even know what I'm looking for!
You're looking for a heredoc.
Has anyone done any PHP unit testing? I've been looking around for a unit
testing library to try out. Below are the ones I've found so far:
SimpleTest: http://www.lastcraft.com/simple_test.php
PHPUnit (dead?): http://phpunit.sourceforge.net/
Pear PHPUnit: http://pear.php.net/package/PHPUnit
When you pasted that PHP code firefox did a google I'm feeling lucky
search on it. If you go to google and manually do the I'm feeling lucky
search you should end up at the same place.
Yet another reason firefox deserves the top of the heap.
--Rick
-Original Message-
From: John
How do I check for the presence of an optional $_GET param without
throwing a Notice: Undefined index when the param is not present?
Tried all three of these, they all produce the Notice when
the param
is not passed:
if ($_GET['id'])
if ($_GET['id'] != )
if (isset $_GET['id'])
Hi,
a file called a.php prints hello to the browser then calls
b.php which prints goodbye to the browser.
the output looks like this:
hello
goodbye
how do I clear the screen so the end results looks like this:
a.php:
echo 'hello';
header('location: b.php'); exit;
hi, i need some code to find out the ip address of a server.
just a simple dns query.
how do i do that? i'm a beginner, please help.
$ip = gethostbyname( www.php.net );
http://www.php.net/manual/en/function.gethostbyname.php
--Rick
--
PHP General Mailing List (http://www.php.net/)
To
Below is string let's name it A.
ttPhiladelphiaFirstadate05Oct2004ttt
ttt
I want to get string B. That looks like
PhiladelphiaFirstadate05Oct2004
No characters before Philadelphia and after 20004
Is the character you want to remove ('t')
For this example I would have suggested:
?php
$str = PhiladelphiaFirstadate05Oct2004;
$str = trim( $str, t );
print( $str ); // outputs PhiladelphiaFirstadate05Oct2004
?
Cheers,
Rick
t is not static character. My example isn't correct
Correct
on most servers ini_set will be the best you can hope for
security settings won't allow alternative php.ini file reads
If we're talking about Apache, you can place php config commands in an
.htaccess or httpd.conf file. Those files can easily be associated with a
particular VirtualHost.
Is there anyway that i can get a url relative to my server
for a script that is being run??
The script is being included in mulitple files and
$_SERVER['SCRIPT_NAME'] just gives me the name of the file
that is including the other scripts.
Also $_SERVER['SCRIPT_FILENAME'] is returning
The problem is when the query does not succeed it outputs this:
Warning: fclose(): supplied argument is not a valid stream
resource in c:\php\www\test-scripts\index.php on line 42
is there any way to block just this warning while keeping
all other error handling as is?
Yes, the error
My peoblem is that i have something like the following xml...
~section
~namefoo/name
~contentfoo/content
~ignore /
~/section
Any ideas on how i can check to see it the ignore node
exists or not?
You
Ok here's the deal, I cut out the middle man, went straight
to the script, assigned my variable a string, and loaded the
rtf page, NADA, ZIP, ZILCH!!
At least as far as this test is concerned, I hope you have a nice soft desk
to bang your head on. Check your assignment operator one more
There's a good php POP3 class available here:
http://www.thewebmasters.net/php/POP3.phtml
That will enable you to log into your mail server and retrieve a mail
message from it.
-Original Message-
From: Chris Aitken [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 04, 2001 2:54 PM
44 matches
Mail list logo