You only want to retrieve the news from your table once.
So, pull pull this code:
> $container[] = $message;
> while (list($news, $date) = mysql_fetch_row($newsfetch)) {
> $container[] = '' . $news . '';
> $container[] = '';
> }
> $container[] = '';
outside of (before) this loop:
You won't be able to do that with a regexp alone. Recursively matching
isn't possible. You'll need a little help from some additional code.
\n" . $matches[2] . "\n" );
while( list( $key, $val ) = each( $times ) ){
print( trim( ${val} ) . "\n" );
}
?>
That seems
day. Like I said before, this is just how the
Internet is evolving. As you're doing, the functionality being provided
has to be judged against the practicality of its implementation.
g.luck,
~Chris
> ----- Original Message -
> From: "Christopher William W
On Wed, 20 Feb 2002, Ben Sinclair wrote:
> 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
One way I handle this ... it's a work-around, so it's not all that pretty:
In the doc root on
oi ... typo! see below. sorry :(
~Chris
On Tue, 19 Feb 2002, Christopher William Wesley wrote:
> This may not be what you want to do, but should give you some hints.
> (This is my code which I use to simply dump any SQL table into an HTML
> table I can view in a browse
This may not be what you want to do, but should give you some hints.
(This is my code which I use to simply dump any SQL table into an HTML
table I can view in a browser ... for small tables, of course.)
Using MySQL as an example:
// assuming you ran a query and stored results in $mysql_result_s
Create a script to which you can pass a file namem and calls show_source()
on the file name.
http://www.php.net/manual/en/function.show-source.php
Be very careful to check the input, such that the file name parameter
which eventually gets passed to show_source() cannot be one which you do
not wa
On Wed, 13 Feb 2002, Steven Walker wrote:
>
>
> >
>
>
> In the browser, the name field is only filled with "Steven", and drops
> off everything after the space. If I echo $name outside of the form it
You need to put quotes around the value.
value=""?
g.luck,
~Chris
On Mon, 11 Feb 2002, Matt Moreton wrote:
> I have a script that outputs an image. Using the gd library. But the
...
> the image. Is it possible somehow to request the file as a .jpg?
> www.host.com/displayimage.php
Assuming you're using Apache, you can use a rewrite rule (with
mod_rewrite). h
You really need to do some error checking on the denominator.
$num = 5;
$den = 0;
echo $den != 0 ? $num/$den : "0";
A number divided by zero isn't defined, so you have to circumvent the
situation by making sure it never happens.
~Chris /"\
On Thu, 31 Jan 2002, Benjamin deRuyter wrote:
> I need to generate a random number (range is not crucial) and I have been
> trying to use mt_rand(). However, I am finding that is generates the same
> value EVERY time. This is true whether I supple a range or not. For
> example, the follow line
$myPairs = explode( "/", $PATH_INFO );
while( list( $key, $val ) = each( $myPairs ) ){
if( !empty( $val ) ){
$myVar = explode( "=", $val );
${$myVar[0]} = $myVar[1];
}
}
For you example URI, "index.php/option=contact/step=view"
you would then have $
On Sat, 19 Jan 2002, Shane Wright wrote:
> Maybe this list should be split - kindof into a php-newbies and a
> php-advanced ?
So all the newbies can help all the newbies, and all the advanced people
can help the advanced people? That wouldn't work out. All the newbies
would subscribe to the ad
On Thu, 17 Jan 2002, [EMAIL PROTECTED] wrote:
> I've seen a number of sites for example that didn't have the .inc extension
>registered,
> include() doesn't care about that, but if your includes are under the document root
>of your
> website (that happens a lot too, i don't know why ?) and you
$where_conditions = array();
if( !empty( $lastname ) ){
$where_conditions[] = "lastname like '%${lastname}%'";
}
if( !empty( $firstname ) ){
$where_conditions[] = "firstname like '%${firstname}%'";
}
if( !empty( $age ) ){
$where_conditions[] = "age = ${age}";
}
if( !empty(
On Mon, 7 Jan 2002, Christian Calloway wrote:
> Are there any PHP coded timesheet type web application? And if so, what
> would we be suggested. Thanks,
Take a look at these:
http://freshmeat.net/search/?site=Freshmeat&q=timesheet+php§ion=projects
~Chris /"\
On Fri, 4 Jan 2002, Jason Murray wrote:
> I've seen bookmarks that pop up a javascript input window and then
> use the input in the resulting URL. So, take the manual query via
> javascript input and then append it to the www.php.net url.
There are tips on the php site for making the quick-refer
I think an animal mascot is a beat idea.
Needlenose pliers. Enough said! ;)
~Chris /"\
\ / September 11, 2001
X We Are All New Yorkers
On Mon, 26 Nov 2001, Greg Sidelinger wrote:
> Can someone tell me how to store a class in a session var. I want to
There are several things you need to do.
1) include the class definition before you do anything
2) start the session shortly thereafter
3) register a session variable
4) create y
On Sun, 25 Nov 2001, Miles Thompson wrote:
> Not such a useless explanation at all, in fact a damned good one. Tight &
> concise, and you immediately related the functions to code examples, along
> with an easy-to-visualize object, the chair.
Sweet ... I'm glad you found it useful! TY
> 1. Why
On Sun, 25 Nov 2001, Rudi Ahlers wrote:
> Can anyone explain classes to me please? On many sites have I seen classes,
There are people earning PHD's while explaining classes. I know your
question originates from using PHP, and this is a PHP general mailing list
... but your question is just a ta
I _hate_ echo'n out big batches of HTML, so I never do it. I prefer to
include HTML, or have a class or function write HTML. However, printing
in heredoc style is very handy ... more so than sliced bread.
For example:
The bear is ${name}.
EOF;
print( date() );
?>
PHP code, fo
On Sat, 17 Nov 2001, Mitja Pagon wrote:
> I want to know if there is a way to include(require) a file using a path
> relative to web server root.
I think you'll find the $DOCUMENT_ROOT environment variable handy :)
~Chris /"\
"//","$$1",$curline);
>
> So for the current line I am looking for something like I
> want to replace that with the contents of $copyright.
>
> Can variable variables be used in regular expressions?
>
> Jeff
> - Original Message -
> From: "
On Fri, 16 Nov 2001, Jeff Lewis wrote:
> What I need to do, however, is append a variable portion to a constant prefix. So I
>have a set of variables that are named $MYdog, $MYcat etc. and I need to do
>
> $a = "dog"
> ${"MY$a"} being the same as $MYdog
>
> Can this be done, and if so - how? I
I just ran your code as you pasted earlier, and set up a mysql database
with the table defined below ... and it inserted 223,110 passcodes into
the table.
PHP 4.0.99-3 (Identifies itself as 4.1.0RC1)
MySQL 3.23.43-3
~Chris /"\
try not setting the domain.
~Chris /"\
\ / September 11, 2001
X We Are All New Yorkers
/ \ rm -rf /bin/laden
On Tue, 13 Nov 2
Your problem probably is including the miec.php from the .shtml
document. Does the .shtml document send any output to the browser before
including your .php script? If so, you're not going to be able to send
any cookies from the .php script. Once any standard output makes it to
the browser (inc
If the path doesn't ride along in the _name variable (and I don't know of
a case when it would), Nope. The value of the input element when the type
= file isn't useable, except as an initial file name, so using JavaScript
won't be helpful.
I think the input element is implemented for type = file
On Mon, 12 Nov 2001, Joe Van Meer wrote:
> Thx Christopher for replying. Ok, let me see if I understand you
> correctly...
>
> The user enters username and password on index.php, this is posted to
> login.php. On login.php after I verify the user is who he/she says they are
> I set a cookie calle
Just do your authentication before you send any HTML (including any
whitespace). I actually recommend not sending ANY HTML from your
authentication script. Authenticate them, set your cookie, and redirect
the visitor to an appropriate next page, based on whether or not they've
successfully authe
Name the form element without the brackets ... just "whatdo" instead of
"whatdo[]". When $whatdo[] makes it to your formhandler, it's an array.
(You _could_ access $whatdo[0] ... but that may or may not be more
confusing.)
~Chris /"\
On Fri, 9 Nov 2001, Mike Harvey wrote:
> Is it possible to redirect to an IP address but have the browser address bar
> show an URL?
Assuming that you meant "hostname" instead of "URL" since the browser
address bar will always display a URL ... No.
~Chris /"\
On Fri, 9 Nov 2001, Lara J. Fabans wrote:
> The original form has a table where each row has a set of 3 radio
> buttons name="whatdo[]" where $x is the row counter.
Well, for a set of raido buttons, they should all have the same name.
In your case, all 3 radio buttons should be named "whatdo"
On Tue, 23 Oct 2001, Brian White wrote:
> process ID belongs to Apache. What I was wondering was there any kind
> of ID that was attached to a particular CGI request that I could
> access and use?
Yes. Use the Apache module, mod_unique_id, and then in your environment,
$UNIQUE_ID will be availa
On Sun, 21 Oct 2001, Chip Landwehr wrote:
> if ($T3==""){header ("Location: new_narrative.php?FilledName=No");}
>
> How do I change this to include a Post?
You can put it back on as a query string (kinda dirty, but you can't POST
it back).
~Chris /"\
nt and "hello-" fails with
> the other part, but when I use them together with the OR operator, it
> doesn't pick up either case, "-hello" or "hello-".
>
> I think I'm going to have to resort to evaluating the string with more than
> just the one
use the strip_tags() function to remove HTML tags from strings.
http://www.zend.com/manual/function.strip-tags.php
~Chris /"\
\ / September 11, 2001
X We Are All New York
I'm a bit confused by the logic used (your conditionals are looking for
NOT -, but then the printed statement indicates you were looking for the
-), but anywho ... try these on for size.
if (substr($sString,-1,1)=="-") {
print "You can't have a dash at the end of your string.";
}
if (substr($sSt
On Sun, 21 Oct 2001, Mark Lo wrote:
> I have been asking this for so many times, and I never get a reply
> for this !!! Please help me. I would like to know how to download the
> whole directory using PHP. Can anyone supply me some sources code for this.
I see a few reasons why you w
Splice the array at the point in your result array where "No make
specified" is, for one element, then append it back onto the result array.
Here ...
$noMake = array_splice( $resultArray, array_search( "No make specified",
$resultArray ), 1); // This should be one line, sorry :)
$newResults = a
Just use one argument or the other ... not both.
ibase_commit($myTrans);
OR
ibase_commit($myDB);
g.luck,
~Chris /"\
\ / September 11, 2001
X We Are All
For a process that takes a long time, I usually break the user interaction
& the processing apart.
For instance, when the user makes a submission from the browser interface,
the PHP takes the submitted data and stores it someplace on the file
system or in a database. This being a quick operation
I'm running php 4.0.6.7rc2-3 with freetds 0.52-3 support on a debian linux
server. This is a winning combination to work with MSSQL2000. However
I'm running into some odd behavior when performing multiple queries on the
same connection (link) identifier.
I create a connection to the dbms and se
On Sun, 16 Sep 2001, Luboslav Gabal ml. wrote:
> I have script for getting header of article from NNTP server using sockets:
> output have look so:
> From: "Antonin Mohaupt" <[EMAIL PROTECTED]>
> but it is only
> From: "Antonin Mohaupt"
> What's the problem ? I tried higher raise length of da
On Tue, 11 Sep 2001, Ryan Stephens wrote:
> Im trying to output a list of options, each with a checkbox named "ChkBox"
...
Name each checkbox "ChkBox[]" ... the brackets are the key.
When the form is submitted, you'll have an array called $ChkBox that will
contain the data only from the checked
On Wed, 5 Sep 2001, Johan Vikerskog (EMP) wrote:
> My php script is generating a file that is saved in Unix format.
> I automatically get the "^M" in the end of everyline. Is there a way
> of saving this without getting the "^M" in the end of each line?
The ^M you see is a DOS carriage return/li
On Wed, 5 Sep 2001, nyon wrote:
> I got an error "Maximum execution time of 30 seconds exceeded in C:\... on line 224"
>while
> accessing a PHP page tie to a Mysql database.
>
> 3. How to I set it to 60 seconds ?
This is the default PHP configuration.
In your php.ini file, look for this line:
On Tue, 4 Sep 2001, Boaz Yahav wrote:
> I'm currently using PHP 4 on Solaris on a front end server with MySQL on
> Solaris as a db server.
...
> I want to work with MSSQL Server 2000 instead of MySQL, does anyone have
> experience with working with such
> a combination? PHP4 on Solaris as front an
On Tue, 4 Sep 2001, Jason Murray wrote:
> But then, the right tools make the job easy regardless of
> platform.
For sure! I don't bother with all that clicking ... now you [Unix folk]
don't have to either :)
#!/bin/sh
for PHP3FILE in `find . -type f -name "*.php3" -print`
do
PHP4FILE=`e
On Tue, 4 Sep 2001, Jason Murray wrote:
> Nah, in Illegal Monopoly OS, its just as easy as Apache.
Rather than the web server config, I was referring to renaming all the
.php3 files to have .php extensions, and combing through all the files,
finding all references to .php3 files, and changing th
On Tue, 4 Sep 2001, sagar wrote:
> I have a remote server running my website. I've to make the backup of the mysql db
> i'm using. i can use mysqldump for this. but i'm not sure where the file will be
>created
> on the server and also i want to make that file to .zip and then download it to my
On Mon, 3 Sep 2001, Michelle Marcicki wrote:
> I am NOT running the server. I am using a local ISP (excellent guy but not
> really accessible on this long weekend), so I have no control over what the
OOOH ... Nasty! If the admin can't add the .php3 extension for you, then
you'll be stuck renami
On Mon, 3 Sep 2001, Michelle Marcicki wrote:
> website. It is using PHP3 and MySQL. We had to move it to a new server, that
> as it turns out only supports PHP4. I have been looking through all the FAQs,
Are you running an Apache web server? If so, add this line to your
httpd.conf file and r
On Mon, 3 Sep 2001, Miguel wrote:
> I need to refer these fields like vector in PHP and Javascript mode.
> When I write then I can see values
> in PHP sccript, BUT can't see values in javascript mode, thats to say
> document.form.myfield[index].value doesnt work.
> On the other side, when I make
On Tue, 4 Sep 2001, Seb Frost wrote:
> I have a folder of ~80kb images that are dynamically resized using PHP into
> ~1.4kb thumbnails. Now for each one the PHP server sends an HTTP request
> for the 80kb image, and this is being counted against my 10,000MB.
>
> Should it? Am I in the right in
On Mon, 3 Sep 2001, Bob wrote:
> look. What I am looking for is the cool factor. I know technology needs time
> to improve but what's going to be cool in PHP5??? It's like a race that never
> finishes and who is winning? ASP or PHP?
PHP5 will still run on your Free OS, your CLI OS, your Pay
On Mon, 3 Sep 2001 [EMAIL PROTECTED] wrote:
> I am filling out a form , and submitting it to the next
> page which just prints what I submitted, but it doesnt print any
> returns, i used when i filled out the previous
Try using nl2br() in the output script (page).
http://php.net/nl2br
On Mon, 3 Sep 2001, Dhaval Desai wrote:
> session_encode($dhaval);
...
> when I check out the c:\tmp\ directory and check out
> the session data I can still read the same as
> dhaval=trythisout and it's not encoded...is it coz the
session_encode() returns a string for you to use in a PHP script
On Fri, 31 Aug 2001, Nic Skitt wrote:
> Warning: Cannot add header information - headers already sent by (output
> started at c:\apache\apache\htdocs\client-secure.php:11) in
> c:\apache\apache\htdocs\client-secure.php on line 18
>
> Which would indicate that the line 11 is sending output to the
On Thu, 30 Aug 2001, Joseph Bannon wrote:
> The thing I want to avoid is using my server's bandwidth. Each member gets a
> profile and can have a photo referenced from their homepage. I use to allow
> people to upload photos, but I'm getting close to using my 60GB bandwith
> limit. The people tha
On Thu, 30 Aug 2001, Joseph Bannon wrote:
> What exactly does fpassthru do? Does it download it to my server and then
> shoot it to the browser??
(http://php.net/fpassthru)
For the file pointer on which it operates, it reads the file pointer until
EOF and sends the data to STDOUT. It is very m
On Wed, 29 Aug 2001, Joseph Bannon wrote:
> I want to use fgets to get an image off the server and then print it. Kinda
> like if you call the script picture.php, an image will appear. How do I do
I do this, with fopen() and fpassthru() ...
$im = fopen( "myImage.jpg", "r" );
if(
On Tue, 28 Aug 2001, Hugh Danaher wrote:
> I think at one time I tried using double quotes but didn't get good results.
> If you have time to answer, why the backslash and what the hell is "foo"?
Using the backslash escapes the double quote ... tells php to not use the
double quote (as it does t
64 matches
Mail list logo