Harlequin wrote:
OK, so here's my conundrum...
After verifying the user and pulling all fields from the record I declare
two variables (just testing here):
$_SESSION['UserID'] = UserID;
now contains the string / constant UserID
$_SESSION['FurtherComments'] = FurtherComments;
now contains the
Harlequin wrote:
So If I needed say 10 session variables all based on field values in the
database I'd have to execute 10 separate queries and assign each variable
separately...?
If that's the case then fine - as I only need do it once I know, but it does
seem a rather long winded way of doing
Harlequin wrote:
Jason
Would there be anything wrong with using an include statement at the top of
every page and the include page could then start a session, execute queries
etc or would the session not start as it's not the first line in the
page...?
That's completely fine. The main thing is,
Jason Barnett wrote:
Harlequin wrote:
Jason
Would there be anything wrong with using an include statement at the
top of
every page and the include page could then start a session, execute
queries
etc or would the session not start as it's not the first line in the
page...?
That's completely
if (empty($_REQUEST['formfieldname'])) {
//do something
} else {
//do something else
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I'm a bit confused as to what you mean by posting the list into a text field (do
you want to print_r the list?). But an easy, efficient (I think) way to do this
is strrpos().
?php
function sort_extensions($a, $b) {
$apos = ($pos = strrpos($a, '.')) ? (strlen($a) - $pos) : 0;
$bpos = ($pos
If someone has access to the source then yes, you're screwed. But you can put
your class library outside of the document root and keep the login information
inside the class instead of keeping that information in your web pages.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe,
This should work... enjoy!
## code, using PEAR DB ##
while ($q-fetchInto($row)) {
print (
tr
td width=90 align=center .$row[0]. /td
tda href=FILES/ .$row[1]. .$row[1]. /a/td
tda href=FILES/ .rawurlencode($row[1]). .$row[1]. /a/td
td .$row[2]. /td
/tr
);
};
## end
Ligaya Turmelle wrote:
if they are all coming from the same query can't you assign them using the
fetch_assoc?
Sure!
Ex:
$data = mysql_fetch_assoc($result);
$_SESSION['column1'] = $data['column1'];
$_SESSION['column2'] = $data['column2'];
$_SESSION['column3'] = $data['column3'];
...
Or am I
Louie Miranda wrote:
Hello,
i had been working the whole day thingking about how to expire a
login? Using dates.
I have with me the ff fields:
1. regdate (-MM-DD)
2. expired (1=(Yes) or 0=(No))
Can you give me some tips, how to write this on php? The problem is, i
could not figure out how to
Did the error actually say Unexpected $end ? That would mean that PHP hit the
end of the script before it expected to, and could be caused by an unclosed string.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
But the error (line 40) is actually the last line...! :|
You had a missing brace. When the error line is the last line (and especially
if error is Undefined $end) then you likely have a missing ending brace or
ending quote. Not trying to start a flame war here, but if you try a different
Markus Stobbs wrote:
I'm changing my HTTP POST variable declarations from $variablename to
$_POST['variablename'] to make my code more compliant with current best
practices.
However, I find that I cannot mix these new variable declarations into
big variable strings like I used to. For example,
Brian Krausz wrote:
While I know there are many scripts out there, and have spent many hours
looking through them, I am having trouble finding a login script that
fits my needs. I am looking for the following:
A MySQL-based login system that doesn't use Pear :: DB. All I would
like is for it
Eric Marden wrote:
I recently heard of a product called XL2Web (www.xl2web.com) and
wanted to know if there is a php variant out there, perferably open
source. It's going to be used for one or two excel files (our budget
spread sheets) so i can't see spending the money on the commercial
product.
if I die(sizeof($objDBI-Fetch_Array($objDBI-getResultID( within the
DBI method, it return the correct value, however if I do
$retval = $objDBI-Fetch_Array($objDBI-getResultID());
die(sizeof($retVal));
$retval != $retVal
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
I was working on something else tonight when I literally stumbled across another
solution that works here... pick your poison:
?php
$heredoc = XML
?xml version=1.0 encoding=iso-8859-1 ?
root
node attribute=I am an attribute
textI am a text node./text
/node
dynamic
Narender wrote:
I want to start the execution of a script in the background at the time of user login. In the script there is infinite loop which is checking something after every 10 seconds and if it get true value the it open a popup window on the brower and if the user session expires then it
Justin French wrote:
I've got some weirdness with files included via a symbolic link. Is
there any way I can find out what directory PHP is currently trying
include from?
---
Justin French
http://indent.com.au
echo getcwd();
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe,
I should have probably added this to my last note, but if I find I'm having
weirdness with relative includes I do something like this:
include_once dirname(__FILE__) . ../relative/path/to/script.php;
The __FILE__ constant will resolve to the name of the file it's located in, so
you can rely on
Everyone read closely... this is a nice error report that shows a) he's done his
homework and b) what he tried that didn't work.
Chris Hunt wrote:
All,
I'm a newbie trying to learn PHP and MySQL (following examples in a book PHP and MySQL by
Larry Ullman. I am running:
Windows XP SP1
Norton
DON'T REPLY TO A MESSAGE WHEN YOU NEED TO START A NEW THREAD!
Marv Cook wrote:
I have PHP 4 installed and tried to install 5. No luck.
Both at the same time? Do you *really* need this? It's generally much easier
to have only one installation at a time.
I unzipped over the current folder
Hey John, maybe you should ask him how his script picks the winning lottery
numbers :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Ee wrote:
Dears,
In one of the tutorials I read about templates, the writer is diving the
code into multiple files. He put the menu, main, left, right, footer
each in a separate file. He is using foreach to go through an array and
reads all these files.
Is this a good practice?
I use a lot of
Scott Fletcher wrote:
I would like to use the file_exists() or something similar to check for the
existance of any of the xml files regardless of what filename it use. Like
file_exist(*.xml) for example. Anyone know??
FletchSOD
fnmatch()
--
PHP General Mailing List (http://www.php.net/)
To
To find the number of nodes in a DomNodeList you need to access the length
property... sample code to do this:
?php
$xml = XML
music
artist id=1
nameThe Rolling Stones/name
albums
titleExile On Main Street/title
/albums
/artist
artist id=2
nameAimee Mann/name
The Object is being created perfectly, I've checked.
The collection's Add() method is something like:
Since you know you're adding MyObject objects, first of all check for that:
public function Add(MyObject $object)
public function Add($object)
{
: Scott Hyndman [EMAIL PROTECTED]
To: Jason Barnett [EMAIL PROTECTED]
Overwriting at that index is intended.
Object (Really called Amenity) is defined as such:
class Amenity
{
public $position;
public $name;
public $description;
public $context;
public $state
Andreas Goetz wrote:
I'm trying to use theh reflection API but can't seem to start:
$func= new Reflection_Function('counter');
This was changed, manuals haven't caught up yet. This should be
$func = new ReflectionFunction('counter');
You can also just use the static method export, if you intend
Philip Olson wrote:
Can someone advise me of a very good PHP-5 book.
Hands down the best:
Advanced PHP Programming
by George Schlossnagle
Regards,
Philip
I've also read this book (*almost* cover to cover) and it is quite excellent.
However, it definitely assumes that you understand the basics
this doesn't work yet in DOM. The returned value has to be a nodeset.
Will be fixed some day ;)
see victors answer for the work around
chregu
I was wondering about that. So is there someplace online where we can find out
what does / does not yet work for XPath? I've been looking but google
Is the compiler cache a function of the my web host or my code?
You can cache the PHP bytecode on the server (which is more what I meant
originally), and you can also cache in your code. For an easy example of
caching with your code you could check out PEAR's package Cache_lite.
--
PHP
Hey guys, I'm getting some unexpected results when trying to use ArrayIterator -
but since it's undocumented this might be correct. When I use a
DirectoryIterator to traverse a directory I can't seem to create an array
containing all of the directory elements. I've tried using references as
See:
http://www.php.net/manual/en/language.oop5.reflection.php
Curt
Oops, hadn't seen that yet. Great!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
The easiest way I can think of to prevent static method calls is to use the
$this pseudo variable in your method. A method *cannot* be used statically if
the method requires use of $this.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
If you need a copy of an object (like the default in PHP4), you can explicitly
do that with clone.
$cErrorHandler = new testErrors();
$clone = clone $cErrorHandler;
If you do this you shouldn't need zend engine 1 compatibility (unless you need
that for other reasons).
--
PHP General Mailing
Give us the exact error as it is displayed in your browser. Also did you try to
print_r on every Add as was suggested to you earlier?
To be honest, I'm starting to wonder if we haven't stumbled on a bug. I have
had similar problems (in an entirely different context) and improper cloning may
Hmmm... this may be difficult to implement. For simple include/require trees it
could be done quite easily... but __autoload opens up a whole other bag of
worms. But now that I think of it I suppose you could create Reflections and
get the location of class defintions from that. This might
Jules wrote:
Jason,
I need it for other reasons. This is not a new application that is causing
this. It was built on PHP 4 and therefore has lots of non PHP 5 elements.
So I'm pretty sure I need than on, unless someone has another idea...
Thanks,
Jules...
Not sure what all your classes do, but
Frank Munch wrote:
Hi,
thanks for your comment. Right, and similarly, it struck me that in case
there are variable-names in the path, like in
require_once $my_lib_dir . some_funcs.php;
the variable $my_lib_dir could only be known at run-time and not by any
simple script just scanning the
Jason Barnett wrote:
Hey guys, I'm getting some unexpected results when trying to use
ArrayIterator - but since it's undocumented this might be correct. When
Typo... I actually got ArrayIterator to work... should have said
DirectoryIterator which doesn't inherit from ArrayIterator. Life would
Since I can't have a class inherit from two parent classes, does anyone know how
I could aggregate class methods / properties together? I thought of using
__call, __get and __set but I'm having a tough time wrapping my mind around that
one - mostly potential problems with $this.
--
PHP
Scrumpy wrote:
Sorry for the repeated posts. I didn't know that they got queued awaiting
confirmation of my email address :)
Yeah, I was wondering about the reposts. Well you are right that if you used
the old DOMXML functions in PHP4 that there is no clean way to move that code
forward
Francis Chang wrote:
Hi,
I would like to install Php5 over an existing Php4.3.6 installation on
Linux. What is the proper procedure? Do I need to uninstall the previous
version first, if so, how? Can I install Php5 into the same location as the
previous installation or should I install it into
However, there are a few variables I need changed. For example, the
people I'm sending it to need $rate_1m which is a mortgage rate but in
$_POST there is $rate_1m1 (the whole number) and $rate_1m2 (the two
numbers after the decimal). How do I get those two together and then
discard the two
Depends on the project. Generally I try to use something more like the first
code block unless I really need to optimize for the server. Getting another
server is usually cheaper than the extra time (read: money) spent debugging.
Robb Kerr wrote:
Just a quick question. Does it really matter
Then, once I have determined there are more than one dot, how can I
remove all the dots but the right most one?
You can replace a limited number of matches using preg_replace().
?php
$number = '123.456.789.10';
$count = substr_count($number, '.');
$number = preg_replace('/\./', '', $number,
Comex wrote:
but there isn't any archive..
Let's see I shake my magic 8-ball and it says... PEAR?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
When I run phpinfo() the include_path points to .;c:\php\PEAR but that
is incorrect the correct path is c:\inetpub\php5\PEAR.
Are you *certain* you're looking at the correct ini file? phpinfo() should show
the settings currently in use for your server (assuming you're calling the
phpinfo in a
This helped me get started with Perl-compatible regular expressions:
http://www.weitz.de/regex-coach/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Wudi wrote:
This script can replace links:
$text = ereg_replace([[:alpha:]]+://[^[:space:]]+[[:alnum:]/], a
href=\\\0\\\0/a, $text);
But it cannot get the links.
Magic 8-ball says... go read ereg() in your manual.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Lester Caine wrote:
D_angle wrote:
This is taken right out of the download of PHP 5 zip file
php-5.0.0-Win32.zip. Opening the php.ini-recommended it states the
following configuration
php.ini-recommended is probably not the one being used... if you want to use
this you most likely just need to
No offense intended, but I'm not going to read through all of that. Narrow down
the code block that gives you problems and then post that one block here... not
the entire class.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Shawn McKenzie wrote:
O.K. So I've written my application and debugged it, and now I want to
try and optimize the speed. I have written a little test script to test
Several profilers / debuggers will help you optimize on speed... by telling you
how much time the parser spends inside a
Hey Jason,
No offense at all taken, am happy you read part of my
help-email.
Problem is, like I said, I dont have a clue about the
workings of a class and all the pointing like this
$this- blah
(-) means blah is a property of the class. ($this) means an instance of the
class.
gets me totally
Since you're using cookies, are you remembering to destroy the cookie as well?
Check your web browser to see if the cookie is still there - then do your logout
script - and then immediately check to see if the cookie is still there.
Firefox makes this easy... just another reason why I love that
phpfreaks.com and codewalkers.com
Or check the mailing list archives, others have been mentioned before.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
One of the new options that I am playing with is the __autoload() handler. If
you keep each of your main classes in a separate file then it will try to load
the class file the first time you try to create an instance of an undefined class.
There is a little bit of documentation out there about
I *believe* that include_once will be all that is necessary. However if that
doesn't stop the problem, you can use a DEFINE and at the top of each script:
if (!defined(FILE1)) {
include_once 'file1.php';
}
-- file1.php -
define ('FILE1', TRUE);
--
PHP General Mailing List
[EMAIL PROTECTED] wrote:
please give me a command line to startup
MySQL using safe_mysqld
C:\
---John Holmes...
HAHAHA How'd you guess they would have a drive letter for their prompt :)
Oh, us poor, poor windows users. Microsoft has protected us from it for so
long that we've forgotten what
I'm working on a project that makes use of the DOMXPath class in PHP5. I have
some test xml documents / queries, but it would be good to test my project with
other people's documents / xpath queries that do things mine don't. Please
reply off list though, since I doubt most of the people here
[EMAIL PROTECTED] wrote:
Hi Matt (et al),
I've added the c:\www\pear path to both the windows path and also the path in
the php.ini file. However it's still coming up with the same error. Is there
a way of putting in a temporary path in the go-pear.php file?
Yes... ini_set('include_path',
[EMAIL PROTECTED] wrote:
Hello Everyone,
I'm building a hotel management system and I can't seem to figure out why my
for() loop doesn't work the way it should. I'm using patTemplate to create
the HTML Template (I like using it and I don't want to start a pro/con
template war). Here is the script:
Something like this is probably better handled by a class. Then you can access
class properties to do what you want.
Class yourclass
{
function foo()
{
$this-my_foo_local = 10;
}
function bar($var_bar)
{
return $this-my_foo_local+$var_bar+1;
}
}
$object = new yourclass();
Because === and !== check the type as well. Of you set $string =
'blah' you'll still get the same result.
If you were using != and == both would print.
strpos() returns an int, so comparing it to false with === is always
false. The same would be true for true.
That's half right. strpos actually
Heck, even I got it wrong ;) True check below should always fail...
Jason Barnett wrote:
Because === and !== check the type as well. Of you set $string =
'blah' you'll still get the same result.
If you were using != and == both would print.
strpos() returns an int, so comparing it to false
Harlequin wrote:
Afternoon...
I have a table generated by some code that returns certain field values and
drops them into a table. On of these values is ID and I'd like to convert it
I wouldn't let users create their own primary key for any type of inserts, if
that's what you're using ID for.
Funny... for the short time I've been on the list, it seems like our most
popular topics are the ones that involve flaming. I guess I need to get some
charcoal for my barbecue pit, lest I be the one on the end of the fork ;)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe,
Is there a question here? Or is this a resolution?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
As far as I know, no one has done that yet. Although all of the PHP manual
pages are written in XML so if you were so inclined you could do it yourself.
And I'm sure others would appreciate it if you shared it :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
I assume you are using PHP4's DOMXML functions? If that's the case then you
have a bit of a problem. XML support changed between 4.0 and 5.0, we use
libxml2 (which supports UTF-8), but the object model / methods changed to better
conform with the DOM standard. Also AFAIK the experimental tag
It's only a minor nuisance, but in order to use __CLASS__ with instanceof I have
to assign __CLASS__ to a variable first. Should I bother submitting a bug
report for this? Or am I perhaps missing something...
?php
class Test {
function checkObj2()
{
//workaround
$class =
I've been able to use md5 / md5_file to verify file integrity. However when I
try to check crc32's I'm running into some problems. As an example I download
and extract the PHP package for Windows, then when I try to crc32() the file
contents I get a totally different value from what I think I
Harlequin wrote:
Hi all.
Having a problem echoing a broken date. Here's where I'm at:
$DateAdvertisedBroken = explode(-, $DateAdvertised);
So this contains an array of (year, month, day) or something similar? You
should be able to grab the values here if that's the case.
later, in a table, I
I hate when this happens all I needed was dechex(). *sigh*
I could have sworn I'd tried that already, ah well.
Jason Barnett wrote:
I've been able to use md5 / md5_file to verify file integrity. However
when I try to check crc32's I'm running into some problems. As an
example I download
Greg Beaver wrote:
Hi,
I'm not sure I understand why you would use instanceof on $this. Try
this code:
Kind of complicated (so probably not the best way) but I have objects I'm
creating with a factory method - and all of these objects *should* be extending
a parent class. It's in the parent
601 - 676 of 676 matches
Mail list logo