Has anyone written (or know of something) that works
similar to business objects that is written in PHP?
Chris
--
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,
Has anyone written (or know of something) that works
similar to business objects that is written in PHP?
Chris
--
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,
?
$var = this.that;
list( $thisVal, $thatVal ) = each( explode( ., $var ));
echo $thisVal, $thatVal
?
What is getting echo'd out is:
0, this
Why? What am I missing here?
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
change to:
?
$var = this.that;
list( $thisVal, $thatVal ) = explode( ., $var );
echo $thisVal, $thatVal
?
Silly me.
Chris
-all embarrassed now... :p
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
How do I write an array to a file? For example, I need to write just this in
a file:
?php $Company = array(Item 1, Item 2, Item 3, Item 4, Item 5,);
?
I've been hung up for 2 days on this. Any help would be appreciated.
Use serialize prior to writing the data to the file and unserialize
Ok, could someone tell me why this isn't working?
(note, I took out all my error checks. This is just the
relevant code...
$query = Query that does return row(s);
$result = mysql( $dbname, $query );
$macroDataArray = mysql_fetch_array( $result );
for( reset( $macroDataArray ); $elementKey =
$macroDataArray = mysql_fetch_array( $result );
I'm still curious what is going wrong, but I've found a work arround.
One of the things I love about PHP is that you learn something new
just about every day. Instead of fetch_array(), I can use fetch_assoc()
and it'll do just what I need. :)
how would I write it if I wanted to say this:
if $variable == 2 through 4 ???
if(( $variable = 2 ) ( $variable = 4 )) {
echo Equals 2 through 4br\n;
}
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
All variables in PHP are local to the scope in which it is defined. You
cannot declare a variable as global (as such). To use a global variable:
This is true. But I believe that the original question was actually
the other way around... Make a local variable into a global one.
The way to do
The following example that is in the onsite documentation:
?
function list_array ($array) {
while (list ($key, $value) = each ($array)) {
$str .= b$key:/b $valuebr\n;
}
return $str;
}
echo $HTTP_USER_AGENThr\n;
$browser = get_browser();
echo list_array ((array) $browser);
?
Given the following code:
script language=php
function function1() {
global $bob;
echo Bob = $bob\n;
}
function function2() {
$GLOBALS[bob] = Joe Bob Briggs;
function1();
}
function2();
/script
function1() can echo out the value of $bob
The other day, I was reading the docs and I just happened
across something that emulated argc and argv. However,
I just spent 2 hours in the docs and can't find it.
Is there something in PHP that you can use to get this info?
thnx,
Chris
--
PHP General Mailing List (http://www.php.net/)
To
look in the manual under predefined variables:
language.variables.predefined.html
Sorry, I should have specified for a function, not a script.
I found those vars, just couldn't find the same for a function.
Just found it, though:
func_num_args();
func_get_arg();
:)
Chris
--
PHP General
I want to retain some data across my sites, which have different domain names.
I can't use cookies because they rely on the domain name, and I'd rather not
pass the information on every link Any suggestions?
Need to store it server side somehow. Perhaps a global database?
Chris
--
PHP
I could do that, but how would I keep track of the users? I don't think IP
addresses are reliable. I would also prefer to limit my database access.
Are you using sessions? If so, you can keep track of users that way.
I believe this would be the only solution available to you. I am not sure
I'm still kind of new when it comes to dealing with classes.
I'm curious, is it accepted practice for member functions of
your class to:
* access global variables
* use non member, user defined functions
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
How do I find out a next and preview row values by using PHP and MYSQL. For
examples,
Take a look at the function
mysql_result();
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
The solution I have been using is to do three queries similar to the below
SELECT * FROM table WHERE field='ID00025'
SELECT * FROM table WHERE field'ID00025' ORDER BY field DESC LIMIT 0,1
SELECT * FROM table WHERE field'ID00025' ORDER BY field ASC LIMIT 0,1
If you whish more row returned
It seems worst to me because in your case mysql has to retrieve all the
rows. If it's a table with 1 million records or more, this should hurt ;)
As I said, it was pseudo code. Now, imagine that you were just
getting the records for a particular user? a particular application?
Where there
I know you can set up some form elements as array names
so that when the form is submitted, you can access the values
of those form elements, you can iterate through the array. So
you can set up a bunch of form elements with the name
form_elements[]
and then when the form is submitted, you can
I need to pass a variable to Perl from a PHP script. I am somewhat know
PHP but I do NOT know perlI am running my perl script off of the
command line. I tried /path/to/somewhere/script.pl?var=var
but it did not work.
I would love any help you could provide me
it would be
Basically what i want is, that on a results page, i
want that the records
You mean fields
should be placed only 5 on one line.
For example, let's say i have 100 usernames in a table
in my database.
Now on one page, i want to display all these usernames.
But i want that in one line,
?php
# Turning this on will jump this page out of the frames.
# header('Window-target: _top');
?
Can you use this only for the predefined variables? _top,
_parent, etc? Because it isn't working for me. Perhaps I
am misunderstanding something. Here are my sample files:
index.php
script language=php
if( isset( $submit )) {
header( Window-target: content );
header( location: right.php );
exit();
}
/script
The script needs to be in between ?php and ? in order to execute
on your server. Browsers don't execute PHP. What you've written is how
Here's a nice link to Netscape.com describing the basics of frames:
http://www.netscape.com/eng/mozilla/2.0/relnotes/demo/target.html
Ok, I'll have to check it out.
For your particular question though I would consider targeting the action of
the FROM tag:
FORM ACTION=top.php
Here is my situation:
I've got HTML Templates that I'm using to parse and presents
the end result to the user.
Here is my dilemma:
I need to take what is presented to the user (ie, the data less the
HTML tags but maintaining the formatting) and turn it into a PDF
file.
I know I can use PDFLib
Hm. If you can't store the data as XML from the beginning (doesn't it
make more sense to go from XML to HTML than vice versa?),
Yes, it does. However, the people creating these templates don't know
XML, only HTML. As such, that is how they are going to be stored. :|
If your initial
I need to take what is presented to the user (ie, the data less the
HTML tags but maintaining the formatting) and turn it into a PDF
file.
I found the solution with HTMLDoc (http://www.easysw.com/htmldoc/)
It was very easy to set up and use. I heartily recommend it for anyone
who has the
Are there any headers sent to the browser in session_start()?
I ask because I have a script that sends data as a PDF document
to the browser. Before I'm outputting the data, I'm sending the
header:
header( Content-Type: application/pdf );
to tell the browser that it's a PDF and to load as
Ok, I've got to be doing something wrong here. I've been
beating my head up against the wall for some time and I
just cannot figure out what it is. Before I say it's a bug with
list(), could someone tell me what I'm doing wrong?
?
$policy = 1016726726--1--1016643856;
// problematic
list(
Why do you put each(explode()) ? Just list() = explode() is what you
want.
I did that because I thought they were complimentary functions? Just about
every example I've seen of list() uses each(). Just using explode() makes it
work. Obviously I'm going to have to go back and read more
Say I have a string xyz abc def and I want to remove all of the spaces
withing the string to create a new one. What's the best way?
?
$string = xyz abc def;
$stringWithOutSpaces = implode( , explode( , $string ));
?
Or you can use eregi_replace(), but I don't know what the regex would
This is the source, which is to advanced for me to debug!!!
Waiting on their responce and maybe they can help me.Anybody have any
clues
Perhaps if you told us what was going wrong?
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
How can I say php to execute graf.php until it´s finished and then move on
to the rest of the code?
echo img src='graf.php;
...
more code
...
echo img src=';
include( graf.php );
echo ;
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
But IF I still want to use $HTTP_POST_VARS, what then? What about the
warning when checkbox is not checked?
I use empty() to check the for the existence of checkbox variables.
You can also use isset();
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
For security, you can modify your code so that you check
the $_POST elements instead of using the magic globals.
That's all well and good.
However, someone copy and save your HTML to their local
machine, change some values, change the Action page of the
form to be
Is there any way to determine from where the post request came
from w/o using http_referer?
No, nor with it.
I know that http_referer is unviable, that's why I asked if you can find
out that data w/o using it.
Someone who wants to mess with you can supply any HTTP
referer they want to
If you use array_walk with an associative array, the only
arguments that PHP automatically passes to the defined
array are the numerical/element keys. Is there any way
you can force it to pass the associative keys?
For example, I have an array:
$bob = array( this = other );
Instead of passing
To see what I'm working with, go here:
http://www.melancholy.org/test_tree.php
You may want to copy the source and the (mySQL) db structure and
set it up on your system there to test it out. Though, if you don't want
to do that, I show the output at the very bottom of the page.
One note: I
Now, what I'm trying to do is build a tree based on the data in the DB.
It's working relatively ok if I uncomment the code that is on line 48 and
comment out line 49. However, what I really want to do is build a fully
associative array doing this and now** an array that has string keys
Try: $ary[this] = array(that = 1);
That works great until this has 2 children. The second child
overwrites the first. :(
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
In that case, split it up into two-steps, to only init the
array if you need to i'm not really sure how the rest of
your code is -- you could probably do this a nicer way,
but this will work:
if (!is_array($ary[this]))
$ary[this] = array();
$ary[this][that] = 1;
This is all well and
Does anyone have or know of a function that will take an array and
do array_reverse() recursively? I have the following array/structure:
Array
(
[0] = Array
(
[0] = Array
(
[0] = bob
)
)
[1] = Array
There's no way to for PHP to say Yo, let's ride... submit that form
Client-side manipulations must be done client-side, with
javascript or something similar.
But you can use a function/library called PostToHost() (or something
like that). Search on phpbuilder.com for it. This issue has
The problem is that since the link itself has variables being passed,
action is being passed as a separate variable and the full link is getting
cut off.
I tried using htmlspecialchars, and surrounding the link with quotes, but
nothing worked.
You can try urlencode(). The problem with
Most links being passed to clickrate do not have this particular problem.
Is it a problem if I pass all URL through urldecode, for those cases when I
need it, i.e. will it mess up a URL that hasn't been encoded with urlencode?
Run a little test script to see for yourself, but I don't
i made a Registration Form for user to input their Data, but i also had some
Field Check before the data can be insert to the Mysql_Database!
I had a question here, sometime the mysql shows the error :
Duplicate Key for xxx
I know what is this about, reguarding to my Registration Form, it
If someone has any idea, please let me know
I would strongly suggest that you use a PDF class of some sort. There're
quite a few available. I've had good results with pc4p.
Typically, most PDF classes require that it be working from some sort of
static template. If that is fine, then
Dear Lord, where is the admin to boot this guy?
That's exactly what he wants. What would be better
(and great poetic justice) would be for the admin set
it so that all of his emails bounce back to him.
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
He is both, he has been emailed how to get off. For now, I keep just sending
my read receipts :)
What I did was set up a mail rule where every email I get from him I forward
back to him then delete it. So basically he's getting the email that's going
to the list then he's getting my forwarded
You can use either of the following checks to see if
the user is using HTTPS...
$HTTPS == on
$SERVER_PORT == 443
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Like I said, I shudder at the thought of how much this would load the server
(especially on large rows (lots of fields) or large tables (lots of rows =
lots of queries)), but if the layout is imperative, then maybe this is an
option...
No load whatsoever. You just need to think about how
be, but in my head it seems like it would work. Basically, what if the
while() printed multiple tables? In each table it made 5 rows, each row
with one cell in it, so it would then be vertical. I'm just not sure
how to incorporate into the loop (maybe a for() loop is better for
this?)
So I'm creating a details.php page where I'm expecting the url to be
something like:
My question is what command can I use to end the script [inside the
top part of that if statement]?
Ironically enough, exit();
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe,
other than each'ing an array and performing a regex match, is there an easier
way to parse through the values in an array for a value matching
*something*somethingelse*
No, I don't believe so. But I'm sure you can set up something to use with
array_walk().
Chris
--
PHP General Mailing
I have the following question :
I have constructed several pages with PHP which look likes some reports. (I
attached one example to my mail)
Now I need to convert this HTML page to PDF to send it by mail .
Does any one has an idea ?
Check out HTMLDoc. It works wonders for us.
Chris
--
Is it possible to create an excel file with some data from mySQL, using PHP
?
Yes if you know the file format for excel. If not then write your data into a
CSV file.
I just output the data as regular HTML (tabled, usually) but send the following
headers first:
It is also possible to connect directly to MySQL from Excel via MyODBC.
True, but only if you are running PHP on a windows platform, yes?
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
No, this has nothing to do with PHP. You can run MySQL on Windows or
UNIX, doesn't matter, and set up a connection directly from Excel to
MySQL.
PHP can of course run anywhere you want and manipulate the data in MySQL
which will then be reflected in Excel.
Are there examples anywhere that
Are there examples anywhere that illustrate how this can be done? I'm not very
interested in looking into this alternative.
You are not very interested, but you want examples?
eep, sorry. not should have been now.
Just read the MyODBC docs at mysql.com.
Excellent. Thank you very
I need to store equations in a DB for later use. For example,
something like the following might appear in one of the fields:
(( 2 * 3 ) + 7 ) / ( 8 / 4 )
So I want to eval() *only* equations. However, there is nothing
stoping someone from entering in a valid PHP command that
accesses the
You'll have to come up with a regular expression to check for bad
characters. How complex are the equations? If they are like your example,
you can just check that the equation doesn't have any letters and is only
made up of [0-9+*-/()] characters.
It's pretty complex. What I gave was a
Are you sure you have to run it through eval()? It sounds like you're
creating a query. Couldn't you just create the query dynamically, then put
it in a mysql_query() function? (or whatever DB you're using) Then, even if
they try some kung fu on you, it'll just result in a bad query, not some
Does anybody have a clever and efficient way of
getting rid of leading zeroes in a string?
If the string is completely numeric, you can do something
like this:
$string = 005847;
$string = (int)$string;
Apart from that, you'll have to run it through some sort of
regex, I suppose.
Chris
--
If there is no other choice, there is no other choice. But in a
perfect world, there would be a way to locally correct the server
time on a global basis and thus correct ALL applications -- present
and future -- that need to know the local time.
Is there a way to back track an IP address to
In the following article:
http://www.computerwoche.de/index.cfm?pageid=254artid=38819category=84
Zeev says that PHP5 is expected as early as 1stQ next year. Is there anything
anywhere that discusses the new version and any new possible features?
Chris
--
PHP General Mailing List
If someone is going to be using scripts that they grabbed
from a public forum (PHP Builder, PHPClasses, etc) in a
commercial product (that is going to be compiled with the
Zend encoder and released), what is the protocol, if any?
Do you have to get permission from the author or anything?
I've
META HTTP-EQUIV=Refresh CONTENT=0;URL=newpage.php?jscript=off
Pardon my ignorance, but wouldn't this immediately send the browser onto the
next page before it had the opportunity to get to and run this:
SCRIPT
location.href='newpage.php?jscript=on';
/SCRIPT
? If that's the case, wouldn't
Page1 (fill in data)-Page2(write data, instant redirect to p1,
unless dies from php/mysql)
Then the only way to repost, is to push the forward button.
Unless, of course, they hit the Submit button again and I think
that was the point the original poster was getting at. If the user
cannot
I looked in the predefined variable section of the manual and
couldn't find that there was a way to get this information from
that. If there was another way you could get this via PHP, I
couldn't find it anywhere else in the docs.
So, does anyone know of a good method to get the Time Zone
local
Given a date how would you work out number of months elapsed
between DateInPast and DateNow?
( $monthTo - $monthFrom ) + (( $yearTo - $yearFrom ) * 12 )
I believe that's the correct equation for figuring out the number of months.
Chris
--
PHP General Mailing List
Any advice as to which of the above is possible/not possible and if
not any ways to *mimic* anything.
One thing you can look into is HTMLDoc. It turns any (well formed)
HTML into a PDF file. We've been using it for about 6 months and
it works for exactly what we needed it to do.
Chris
--
Is it possible to set the line number and file name to show in error
messages?
__FILE__
__LINE__
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
As far as I know, __LINE__ and __FILE__ are magic constants which
return the current line number and file name.
Sorry, I misunderstood exactly what you were looking for.
whole script. If now an error occurs on line 362 for example, it is
not easy to find the buggy code part, because this
Is there a function that can detect if anyone has closed
the browser?
Not in PHP. You can using JavaScript, however.
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thanks for the prompt response... Would this mean I would
embedd the Java Script in my php Script and alter the php
variable accordingly...
No, because JS is client side and PHP is server side. What
you would need to do is have JS detect when the browser
closed and make one last server
// Note that !== did not exist until 4.0.0-RC2
I took a quick look at the docs to find out what !== meant
(because I'd never seen it before). I'm not sure I understand
what it's use is. Could someone explain why you would use
it and for what purpose?
I couldn't really infer from the example
I am using
substr($f, 0, 1);
to get the first character of a string but what to be able to tell if
the first character is a digit or a letter is there a way to do this?
ereg( ^[0-9], $f )
will let you know if the first character is a digit or not...
Chris
--
PHP General Mailing List
?
$file = LINE ONE\nLINE TWO\rLINE THREE\n\r;
Try this instead and see if it works...
$windowsNewLine = chr(13) . chr(10);
$file = LINE ONE{$windowsNewLine}LINE TWO{$windowsNewLine}LINE
THREE{$windowsNewLine};
Not sure if Notepad will interpret \r\n correctly...
Chris
--
PHP General
Do any of you guys have experience setting PHP up
with the IPlanet webserver? We are trying it out (for
a client) and we can't seem to get to so that PHP
gets the POST or GET variables passed from a form
and would like to talk with someone who's had experience
working with or around this
The above process works, as far as replace the place holders, and printing
the new content (which is an HTML file). However, it will not process PHP
scripts, within the template.
If it's really a template, why does it have PHP scripts within? Why not just
replace those scripts with place
which function divides astring to the pieces accorrding to another string.
for example according to a comma ..
explode();
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Does anyone use VStudio .NET as your IDE in developing
PHP Scripts? If so, have you found a way to make it so
that it understands PHP? In particular color coding and the
understanding of where functions start and end (for the
solution explorer, etc).
I'm starting to get into C# and I'd like to
try jext ... http://jext.org
has a good PHP code browser and can colourise C# and PHP.
I appreciate the suggestion but I wanted to know specifically about
using VStudio .NET as an IDE for PHP.
Don't know what other features you'd want for C# ...
In VStudio .NET, the RAD features, for
If there is no need to return a value then I don't do
so. However, the function is going to process something,
and surely you should check that the processing has
succeeded or failed?
This is precisely the point I was going to make. Unless an argument is
passed in by reference for
Is there anything special you need to do to utilize these functions? The
former says it's available in versions 4 and 5 while the latter states that
it's available in versions = 4.3 and 5 (although is deprecated). I'm
currently running PHP version 4.3.11 on a Windows NT box. Based on both
Sounds like a problem with the installation.
What could go wrong with an installation on a Windows machine that uses
the binaries? Why would it be only these functions (that I can tell) that
would be missing? Is there somewhere I can go and check (possibly using
phpinfo()) to find out if
Sounds like a problem with the installation.
What could go wrong with an installation on a Windows machine that uses the
binaries? Why would it be only these functions (that I can tell) that would
be missing? Is there somewhere I can go and check (possibly using
phpinfo()) to find out if
Oh, I also forgot to ask what do you get when you use stat()?
stat() works, but not if I pass in the actual name of the file. I have to
use fstat() in order to get the proper data. I'll have to check to see if
there are any functions disabled in the php.ini (I don't believe there are
Have you uncommented or added `extension=php_mime_magic.dll` in
your php.ini file for mime_content_type()? What about adding
something like this, as well:
extension=php_mime_magic.dll is commented out in my php.ini. So that
explains why the mime_content_type() isn't working. That's fine.
Does file_get_contents() not work with absolute paths? I'm able to
successfully write data to a file that I create dynamically but when I go
back to actually read the contents of the file, nothing seems to work. Not
file_get_contents(), not file(), not fread() and not fgets();
$mydata =
What's going on?
That's the strangest absolute path I've ever seen... it seems to have
some kind of non-absolute prefix.
This has been a troll :)
Pardon? I'm not sure what you mean?
thnx,
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
We are running PHP 4.3.11 in a Windows Server 2003 environment using
ApacheSSL v1.3. Starting just the other day, we starting seeing the
following error pop up in the windows eventvwr:
Faulting application Apache.exe, version 0.0.0.0, faulting module
php4ts.dll, version 4.3.11.11, fault
PS free milk and cookies and an afternoon nap actually sounds quite good
now I come to think about it.. :p
Almost better than healthcare and retirement benefits... :)
thnx,
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Something like this will get it into a time stamp...and then you can do
your calculations with ease, and reformat...
?php
$str = 20070617T193500;
list($date, $time) = explode(T,$str);
?
Even easier:
$timestamp = strtotime( $str );
This works great tell you get to 8 hours ago
it shows the correct time but it does not change
the date to the day before. 8 hours ago should be
06/16/2007 11:35:00 but what it shows is 06/17/2007
11:35:00
Your code works for me. Though, I had to change the format of $str
slightly to get
I have a integer that is submitted by the user and
i need it to always contain 5 digits.
If the user submitted 45, i need it to be 00045.
If the user submitted 4595, i need it to be 04595.
How can i do this?
Check out printf();
http://us.php.net/manual/en/function.printf.php
thnx,
Chris
I just need a framework for administrating tables in a database. These are
simple add/edit/remove operations from tables.
Can you suggest a framework for this kind of job? Cause there are a lot of
tables and I hope I can find a nice tool to work with.
What database are you working with?
while( TRUE ) {
$actions++;
$words--;
}
$bets = array(1,2,3,4,5);
unset( $bets );
$arr = array( 'this', 'that', 'times' );
$arr[] = 'behind';
for( $i = 0; $i = 6; $i++ ) {
$deep++;
}
for( $i = 0; $i = 5; $i++ ) {
$flies--;
}
thnx,
Chris
--
PHP General Mailing List
Actions speak louder than words.
Yup.
All bets are off.
Indeed.
Behind the times.
Correct.
Deep Six.
Got it.
for( $i = 0; $i = 5; $i++ ) {
$flies--;
}
Time flies backwards? // Not sure on this one.
I wasn't sure if this one was done well enough; I guess it wasn't. The
1 - 100 of 416 matches
Mail list logo