php-general Digest 6 Dec 2002 14:18:32 -0000 Issue 1747

Topics (messages 127216 through 127255):

Re: Sending no content-type header?
        127216 by: Chris Wesley
        127217 by: Leif K-Brooks

Need Redirection Trick...
        127218 by: . Nilaab
        127223 by: Jason Wong
        127224 by: Roger Lewis
        127226 by: . Nilaab

Re: PHP includes without access to the default directory
        127219 by: Morgan Hughes
        127225 by: Tom Rogers

Re:
        127220 by: Karl James

empty string parameters to backslashes?
        127221 by: andyw.scroom.com
        127237 by: DL Neil

Re: MySQL ?
        127222 by: Justin French
        127227 by: Tom Rogers

md5 question
        127228 by: conbud
        127229 by: Chris Wesley
        127232 by: Jason Wong

Making random string function function more random?
        127230 by: Leif K-Brooks

$DOCUMENT_ROOT
        127231 by: christopher calicott

HOW GET ALL HTML CONTENT
        127233 by: nice_boy

ezmlm
        127234 by: Randum Ian
        127235 by: Jason Wong

Re: How to create user in mySQL ?
        127236 by: Krzysztof Dziekiewicz

Re: Repeating Decimals
        127238 by: Marek Kilimajer
        127249 by: Tom Rogers

PHP query to javascript array
        127239 by: Christian Ista
        127242 by: Marek Kilimajer

Re: Checking for Overlapping Dates
        127240 by: DL Neil
        127246 by: DL Neil

GD support in PHP 4.1.2
        127241 by: GoodnGo.de \(R\) Zentrale

Cookies help please
        127243 by: Steve Vernon

--with-gd=DIR
        127244 by: GoodnGo.de \(R\) Zentrale
        127245 by: info.t-host.com
        127253 by: Tom Rogers

Output of MySQl sorted query to text or Word file.
        127247 by: ed.home.homes2see.com
        127255 by: Tim Ward

How to loop diplays of 4 column of items, every row?
        127248 by: Wee Keat [Amorphosium]
        127251 by: Chris Boget
        127252 by: Marek Kilimajer

mail function() with MS
        127250 by: Anthony Ritter

Check wheter GD function is working
        127254 by: info.t-host.com

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
On Thu, 5 Dec 2002, Leif K-Brooks wrote:
> I'm running a few simple php scripts from the (windows) command line.
>  Since I'm not using a web browser to view it, the HTTP headers are
> annoying and pointless.  I've turned expose_php off in php.ini, but
> commenting out default_mimetype changes nothing, and setting it to an
> empty string sends a blank content-type header.  Is there any way to do
> this?

php.exe -q

        ~Chris

--- End Message ---
--- Begin Message --- Ok, thanks a lot. For what it's worth, here's my simple .bat file for executing php files:
@ECHO OFF
IF NOT EXIST %1.php goto usage
php.exe -q %1.php
goto end
:usage
echo ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
echo ³ USAGE ³
echo ³Type "php.bat" (without quotes)³
echo ³ followed by the name of a ³
echo ³valid php file without the .php³
echo ³extension. ³
echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
:end

Chris Wesley wrote:

On Thu, 5 Dec 2002, Leif K-Brooks wrote:

I'm running a few simple php scripts from the (windows) command line.
Since I'm not using a web browser to view it, the HTTP headers are
annoying and pointless. I've turned expose_php off in php.ini, but
commenting out default_mimetype changes nothing, and setting it to an
empty string sends a blank content-type header. Is there any way to do
this?

php.exe -q

~Chris



--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.


--- End Message ---
--- Begin Message ---
Hello Everyone,

I have a simple problem that, I think, might require a little trick to be
used. I have a list of products in a database that is organized by
categories and subcategories. Categories can have as many subcategories as
it wants, but some categories don't need to have a subcategory at all.

In the following code "cat" refers to category and "subcat" refers to
subcategory.

cat_data and subcat_data refers to a multi-dimentional array, pulled from
the DB, with values of an id and a name.
example: cat_data[row_number][name_of_category] and
cat_data[row_number][id].

Ok, before I ask the question, here's the code:

[-------------- snip --------------]
<?php
include ("nay_general.php");
include ("$include_path/base_db.class"); // db

$db = new base_db();
$cat_data = $db->get_cat_data();
for ($i=0; $i < count($cat_data); $i++) {
   echo '<a href="' . $PHP_SELF . "?cat_id=" . $cat_data[$i]["id"] . '">' .
$cat_data[$i]["name"] . "</a><br />\n";
   if ($cat_id) {
      $subcat_data = $db->get_subcat_data($cat_id);
      if ($subcat_data != 0 && ($cat_id == $cat_data[$i]["id"])) {
         for ($j=0; $j < count($subcat_data); $j++) {
            echo '&nbsp;&nbsp;&nbsp;&nbsp;- <a href="' . $PHP_SELF .
"?cat_id=$cat_id&subcat_id=" . $subcat_data[$j]["id"] . '">' .
$subcat_data[$j]["name"] . "</a><br />\n";
         }
      }
      elseif ($subcat_data == 0 && ($cat_id == $cat_data[$i]["id"])) {
         $subcat_id = 0;
         header("Location: $PHP_SELF?cat_id=$cat_id&subcat_id=$subcat_id");
      }
   }
}

?>
[-------------- snip --------------]

What this does is it lists all the categories in the database, initially.
When the user clicks on a category, the script will check if the category
has any subcategories associated with it. One of two things should happen
after this.

First, it should list all the subcategories directly below the category it
is associated with, with a little indention to specify that they are
subcategories. The subcategories listed will be a link that passes over the
cat_id and subcat_id GET variables to the same page.

example:        category 1
                category 2
                   - subcategory 1
                   - subcategory 2
                   - subcategory 3
                category 3
                .
                .
                .

This part of the script works fine.

The second thing that should happen is that if there are actually no
subcategories for the selected category then subcat_id should equal 0 and
the script should redirect back to the same page with the GET variables of
cat_id and subcat_id (which is equal to zero at this point). The problem is
that I cannot redirect with a header() function because content is already
sent to the browser at the beginning of the script (the list of categories).
Is there any other way that I can redirect and send the variables of cat_id
and subcat_id to the page in the second situation mentioned earlier?
Register Globals is on.

- Nilaab


--- End Message ---
--- Begin Message ---
On Friday 06 December 2002 11:35, [EMAIL PROTECTED] wrote:
> Hello Everyone,

[lots of irrelevant stuff snipped]

> The second thing that should happen is that if there are actually no
> subcategories for the selected category then subcat_id should equal 0 and
> the script should redirect back to the same page with the GET variables of
> cat_id and subcat_id (which is equal to zero at this point). The problem is
> that I cannot redirect with a header() function because content is already
> sent to the browser at the beginning of the script (the list of
> categories). Is there any other way that I can redirect and send the
> variables of cat_id and subcat_id to the page in the second situation
> mentioned earlier? Register Globals is on.

1) BEFORE you output anything make your check whether you need to redirect. 
After all, if you're going to be redirecting, why output anything at all?

or

2) Use the output buffering functions.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Do not drink coffee in early A.M.  It will keep you awake until noon.
*/

--- End Message ---
--- Begin Message ---
Nilaab,

This sounds similar to what I was trying to do recently, i.e creating
dependent dropdown boxes.  Here's a link to a demo of the code that might be
of interest to you.
http://www.onlinetools.org/tools/easyselectdata/index.html

Cheers.

Roger

-----Original Message-----
From: @ Nilaab [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 7:36 PM
To: Php-General
Subject: [PHP] Need Redirection Trick...

Hello Everyone,

I have a simple problem that, I think, might require a little trick to be
used. I have a list of products in a database that is organized by
categories and subcategories. Categories can have as many subcategories as
it wants, but some categories don't need to have a subcategory at all.

In the following code "cat" refers to category and "subcat" refers to
subcategory.

cat_data and subcat_data refers to a multi-dimentional array, pulled from
the DB, with values of an id and a name.
example: cat_data[row_number][name_of_category] and
cat_data[row_number][id].

Ok, before I ask the question, here's the code:

[-------------- snip --------------]
<?php
include ("nay_general.php");
include ("$include_path/base_db.class"); // db

$db = new base_db();
$cat_data = $db->get_cat_data();
for ($i=0; $i < count($cat_data); $i++) {
   echo '<a href="' . $PHP_SELF . "?cat_id=" . $cat_data[$i]["id"] . '">' .
$cat_data[$i]["name"] . "</a><br />\n";
   if ($cat_id) {
      $subcat_data = $db->get_subcat_data($cat_id);
      if ($subcat_data != 0 && ($cat_id == $cat_data[$i]["id"])) {
         for ($j=0; $j < count($subcat_data); $j++) {
            echo '&nbsp;&nbsp;&nbsp;&nbsp;- <a href="' . $PHP_SELF .
"?cat_id=$cat_id&subcat_id=" . $subcat_data[$j]["id"] . '">' .
$subcat_data[$j]["name"] . "</a><br />\n";
         }
      }
      elseif ($subcat_data == 0 && ($cat_id == $cat_data[$i]["id"])) {
         $subcat_id = 0;
         header("Location: $PHP_SELF?cat_id=$cat_id&subcat_id=$subcat_id");
      }
   }
}

?>
[-------------- snip --------------]

What this does is it lists all the categories in the database, initially.
When the user clicks on a category, the script will check if the category
has any subcategories associated with it. One of two things should happen
after this.

First, it should list all the subcategories directly below the category it
is associated with, with a little indention to specify that they are
subcategories. The subcategories listed will be a link that passes over the
cat_id and subcat_id GET variables to the same page.

example:        category 1
                category 2
                   - subcategory 1
                   - subcategory 2
                   - subcategory 3
                category 3
                .
                .
                .

This part of the script works fine.

The second thing that should happen is that if there are actually no
subcategories for the selected category then subcat_id should equal 0 and
the script should redirect back to the same page with the GET variables of
cat_id and subcat_id (which is equal to zero at this point). The problem is
that I cannot redirect with a header() function because content is already
sent to the browser at the beginning of the script (the list of categories).
Is there any other way that I can redirect and send the variables of cat_id
and subcat_id to the page in the second situation mentioned earlier?
Register Globals is on.

- Nilaab



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Great Jason, thanks a lot. I was just looking for some direction and I think
you just helped me find it. Thanks for taking the time to look at my
problem.    :)

- Nilaab

> -----Original Message-----
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 05, 2002 11:46 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Need Redirection Trick...
>
>
> On Friday 06 December 2002 11:35, [EMAIL PROTECTED] wrote:
> > Hello Everyone,
>
> [lots of irrelevant stuff snipped]
>
> > The second thing that should happen is that if there are actually no
> > subcategories for the selected category then subcat_id should
> equal 0 and
> > the script should redirect back to the same page with the GET
> variables of
> > cat_id and subcat_id (which is equal to zero at this point).
> The problem is
> > that I cannot redirect with a header() function because content
> is already
> > sent to the browser at the beginning of the script (the list of
> > categories). Is there any other way that I can redirect and send the
> > variables of cat_id and subcat_id to the page in the second situation
> > mentioned earlier? Register Globals is on.
>
> 1) BEFORE you output anything make your check whether you need to
> redirect.
> After all, if you're going to be redirecting, why output anything at all?
>
> or
>
> 2) Use the output buffering functions.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Do not drink coffee in early A.M.  It will keep you awake until noon.
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
On Thu, 5 Dec 2002, Gundamn wrote:

> I have a hosted account. As such, I am unable to use the default location
> for files when used with the include command. So could somebody tell me how
> I can either make it go to a different directory, or to link to something
> (and how to add the variable as the filename)?
>
> Thank you in advance.

  My usual approach is to have an includes/ directory, at the same level
  as the htdocs/ directory, and thus outside the webspace.  In this
  includes/ directory I put an include.php file which includes any other
  files needed with include_once, like so:

  <?
    include_once INC_DIR . '/config.php';
    include_once INC_DIR . '/functions.php';
  ?>

  In htdocs/ I put another include.php, which basically says:
  <?
    define ('INC_DIR', '../includes');
    include INC_DIR . '/include.php';
  ?>

  In any subdirectories of htdocs/ I put a similar file, except one level
  deeper it'd be:
  <?
    define ('INC_DIR', '../../includes');
    include INC_DIR . '/include.php';
  ?>

  For each subdir level, add a ../ to the define.

  On a hosted account, you may instead have to put your includes/
  directory elsewhere.  In this case, the include.php in htdocs/ would
  just be
  <?
    define ('INC_DIR', '/path/to/includes');
    include INC_DIR . '/include.php';
  ?>

  and the sub-directory scripts just
  <?
    include '../include.php';
  ?>

  Either way, the goal though is to have an include.php file in each
  directory of your webspace that references a single include.php file
  with relative (../) paths.  Coupled with keeping your includes outside
  the webroot, this can make include files a lot less troublesome.

  A bit of overhead, true, but it keeps my configs, db passwords, and
  library code entirely out of the webspace.  I've used it successfully in
  a large site (150 user-accessible scripts, 25 library scripts, totalling
  about 1M of php)

  One big warning about include files... PHP's include functions work
  counter-intuitively in that all relative paths are relative to the
  script that caught the user's request.  Thus if you have a bunch of
  scripts in a lib/ directory, they can't include each other without
  taking into account the path from the calling script...  Thus why I try
  to define INC_DIR as early as possible if it's relative.

  Hope this helps...

-- 
   Morgan Hughes
   C programmer and highly caffeinated mammal.
   [EMAIL PROTECTED]
   ICQ: 79293356



--- End Message ---
--- Begin Message ---
Hi,

Friday, December 6, 2002, 11:06:36 AM, you wrote:
G> I have a hosted account. As such, I am unable to use the default location
G> for files when used with the include command. So could somebody tell me how
G> I can either make it go to a different directory, or to link to something
G> (and how to add the variable as the filename)?

G> Thank you in advance.

If you still need access to the default include directory put this at the top of
each page:

ini_set ("include_path","/path/to/local/includes:"ini_get("include_path"));

Then no matter what directory you are in you can just include("filename");

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
Help need one on one 
I was wondering if anyone would be willing to be a mentor 
While im doing this project.
 
Im using mysql and php
 
To do a login script with username and passwords.
And also to do insert to database from a register form.
 
Then I want to do a online fantasy football league where you 
Can trade players and add/drop players of your roster.
 
Please email me if interested.
 
Thanks 
Karl james
 
--- End Message ---
--- Begin Message ---
Hey all -
I'm trying to track down a problem with someone else's
code. Our hosting service changed PHP versions on us
(up to 4.0.6), and everything broke. I think I have
tracked down at least part of the problem. We have a
function:

   funA($args)
   {
     $file = substr($args[0],0, -1); //file to open from path
     $alt  = $args[1]; //if invalid/no file, use this file
     $name = $args[2]; //the name associated with the tabs
     $size = $args[3]; //size to make the box (optional)

     print "funA START: file: " . $file . ", name: " . $name . ", alt: " . $alt . ", 
size: " . $size . "<BR>";

     . . .
   }

Called like this:
   funA("nameString", " ", " ", "177");

But the output of the print statement looks like this:

funA START: file: productBrief, name: \, alt: \, size: 177\

So where did the darned backslashes come from? Any ideas?

thanks,
andy wallace
[EMAIL PROTECTED]


-- 
Have you been SCROOMed?     http://www.scroom.com
   Andy Wallace, Publisher   [EMAIL PROTECTED]
 Get the Opera Browser!    http://www.opera.com
--- End Message ---
--- Begin Message ---
Hey Andy,

> I'm trying to track down a problem with someone else's
> code. Our hosting service changed PHP versions on us
> (up to 4.0.6), and everything broke. I think I have
> tracked down at least part of the problem. We have a
>...

Ascertain differences by printing out a phpinfo() report for the new config
and comparing with previous (obvious logic flaw noted!). It is as important
for developers (as for installers) to read the ChangeLog
(http://www.php.net/ChangeLog-4.php) to see what's new/different between
versions.


> But the output of the print statement looks like this:
> funA START: file: productBrief, name: \, alt: \, size: 177\
> So where did the darned backslashes come from? Any ideas?

Magic_quotes will do this. Check out manual: LXXIX. PHP
Options&Information - the hosting service may have changed the setting on
you. Follow links to learn how to SET and GET from within scripts.

Regards,
=dn

--- End Message ---
--- Begin Message ---
1. there is a MySQL mailing list, details can be found on mysql.com

2. i just did a really simple search on php net for "mysql table", and got
the following amongst a few results:

mysql_field_table()
mysql_list_tables()
mysql_tablename()

it would be good if you could search the php (and mysql) sites before
posting.


Justin



on 06/12/02 3:08 AM, hacook ([EMAIL PROTECTED]) wrote:

> I am really sorry but i can't find any good mySQL good mailing list...
> 
> How can i make a little php function to check if a table exists ?
> 
> Thanks a lot,
> Hacook
> 
> 

Justin French
--------------------
http://Indent.com.au
Web Development & 
Graphic Design
--------------------

--- End Message ---
--- Begin Message ---
Hi,

Friday, December 6, 2002, 2:08:42 AM, you wrote:
h> I am really sorry but i can't find any good mySQL good mailing list...

h> How can i make a little php function to check if a table exists ?

h> Thanks a lot,
h> Hacook




 function table_exists($table){
          return (@mysql_query('SELECT count(*) FROM '.$table));
 }
 
 //usage
 $con = @mysql_connect("host" , "user" , "password");
 $table = "database.table";
 if(table_exists($table)){
        echo "Table $table exists. <br>";
 }else{
        echo "Table $table does not exist.<br>";
 }



-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
Hey. Is there a way to get the actual word/phrase from the long string that
the md5 hash creates. Lets say, is there a way find out what
b9f6f788d4a1f33a53b2de5d20c338ac
stands for in actuall words ?

Lee


--- End Message ---
--- Begin Message ---
On Fri, 6 Dec 2002, conbud wrote:

> Hey. Is there a way to get the actual word/phrase from the long string that
> the md5 hash creates. Lets say, is there a way find out what
> b9f6f788d4a1f33a53b2de5d20c338ac
> stands for in actuall words ?

In all cases, an md5sum string means, "You've got better things to do
besides trying to figure out what this string means, trust me."  ;)

Check RFC 1321.  http://www.ietf.org/rfc/rfc1321.txt

        ~Chris

--- End Message ---
--- Begin Message ---
On Friday 06 December 2002 15:41, conbud wrote:
> Hey. Is there a way to get the actual word/phrase from the long string that
> the md5 hash creates. Lets say, is there a way find out what
> b9f6f788d4a1f33a53b2de5d20c338ac
> stands for in actuall words ?

Consider this, md5() takes (practically) any size of string as input and 
returns a 32 char string. 

So you give it a 1MB string and in return you get a 32 byte string -- how on 
earth are you going to reverse this process and get your original 1MB string 
from your measly 32 byte string?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
"Ubi non accusator, ibi non judex."

(Where there is no police, there is no speed limit.)
                -- Roman Law, trans. Petr Beckmann (1971)
*/

--- End Message ---
--- Begin Message --- I'm using the following function to generate a random string:

function randstring($minasc = 32,$maxasc = 255,$minlength = 0,$maxlength = 0){
//If maximum length is lower than minimum length, return string representation of false
if($maxlength != 0 and $minlength != 0 and $minlength > $maxlength){
return '';
}
//Initialize $return
$return = '';
//Start infinite while loop, which will be exited with break;
while(true){
//Add another random character to $return
$return = $return.chr(mt_rand($minasc,$maxasc));
//Break out of loop when it's time to
if((strlen($return) == $maxlength) or (mt_rand(1,2) == 2 and (strlen($return) >= $minlength or $minlength == 0) and (strlen($return) <= $maxlength or $maxlength == 0))){
break;
}
}
//Return the value of $return
return $return;
}
But when I run it with:
randstring(65,90,4,4);
and I check how many strings it generates before reaching a certain string, some strings take much longer than others. Is this just a problem with using pseudo-random numbers, or is there a better way to randomize this function?

--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.


--- End Message ---
--- Begin Message ---
> <?
> echo $_SERVER["DOCUMENT_ROOT"];
> ?>


c:/wwwroot

is what I get.  I am convinced the problem I am having is due to some issues
with configuration.  Here is why:


I found the script that is the 'original' one that I had working just as an
image displayer - not as part of a larger html document and it works at the
root of the web server.   I've attached that code.  Here's the thing - the
script is identical, with two exceptions.. a) it is executing from the
server root and b) the is just a regular path without the $DOCUMENT_ROOT in
there.  It looks (and it works) like this:

$strRealPath = "images/random_gen/";
//$DOCUMENT_ROOT.dirname($SCRIPT_NAME)."/";


I cloned this script and renamed it, then changed "images/random_gen/" to:
"$DOCUMENT_ROOT/images/random_gen/"

and guess what?   I guess the EXACT same errors.  It has to be something to
do with where apache or php thinks the root of the server is located...
since the script that is integrated into the site is down a level in the
/includes/ subfolder and it points to images in the
DOCUMENT_ROOT/images/random_gen/ subfolder, I really needed the script to
just say 'okay go to the root of the server then go to this subfolder and
look there.'  It ain't working.

SOooooo.... basically I have some sort of configuration issue here. I've
tried modifying httpd.conf - it supposedly wants the documentRoot to be set
to c:/wwwroot instead of the normal c:\wwwroot... I've tried it both ways.
the doc_root= setting in php.ini is set to c:\wwwroot and I've tried it both
ways.

Please help.  I will dance at your wedding. Anybody.... Buehler?  Buehler?

-=- christopher

-=- christopher
--- End Message ---
--- Begin Message ---
hi,

who knows how to get all contents when i use javascript to get bookmark of
IE
ex:

window.external.ImportExportFavoritesfalse,"http://localhost/test.php";);

because  i use $_POST to get that data,but it can't get all data.

if it has 27593 bytes ,then only get 7XXX bytes. that means so many data was
not geted.

i got some informations when use $HTTP_SERVER_VARS, then data is

[key=COMSPEC]=value[C:\\WINDOWS\\COMMAND.COM]
[key=CONTENT_LENGTH]=value[27593]
[key=CONTENT_TYPE]=value[application/x-www-form-urlencoded]
[key=DOCUMENT_ROOT]=value[c:/windows/desktop/web]
[key=HTTP_CACHE_CONTROL]=value[no-cache]
[key=HTTP_CONNECTION]=value[Keep-Alive]
[key=HTTP_HOST]=value[localhost]
[key=HTTP_USER_AGENT]=value[PostFavorites]
[key=PATH]=value[C:\\WINDOWS;C:\\WINDOWS\\COMMAND;C:\\PROGRA~1\\SSHCOM~1\\SS
HSEC~1;C:\\PROGRA~1\\MICROS~4\\80\\TOOLS\\BINN;C:\\PROGRA~1\\ULTRAE~1;C:\\PR
OGRA~1\\BORLAND\\DELPHI5\\BIN;C:\\PROGRA~1\\BORLAND\\VBROKER\\BIN;C:\\PROGRA
~1\\BORLAND\\VBROKER\\JRE\\BIN;C:\\PROGRA~1\\BORLAND\\DELPHI5\\PROJECTS\\BPL
;C:\\PROGRA~1\\ULTRAE~1]
[key=REMOTE_ADDR]=value[127.0.0.1]
[key=REMOTE_PORT]=value[1755]
[key=SCRIPT_FILENAME]=value[c:/windows/desktop/web/test.php]
[key=SERVER_ADDR]=value[127.0.0.1]
[key=SERVER_ADMIN]=value[[EMAIL PROTECTED]]
[key=SERVER_NAME]=value[211.22.80.5]
[key=SERVER_PORT]=value[80]
[key=SERVER_SIGNATURE]=value[<ADDRESS>Apache/1.3.24 Server at 211.22.80.5
Port 80</ADDRESS>
]
[key=SERVER_SOFTWARE]=value[Apache/1.3.24 (Win32) PHP/4.2.2]
[key=WINDIR]=value[C:\\WINDOWS]
[key=GATEWAY_INTERFACE]=value[CGI/1.1]
[key=SERVER_PROTOCOL]=value[HTTP/1.1]
[key=REQUEST_METHOD]=value[POST]
[key=QUERY_STRING]=value[]
[key=REQUEST_URI]=value[/test.php]
[key=SCRIPT_NAME]=value[/test.php]
[key=PATH_TRANSLATED]=value[c:/windows/desktop/web/test.php]
[key=PHP_SELF]=value[/test.php]
[key=argv]=value[Array]
[key=argc]=value[0]

so i know the content length is 27593........

who can tell me how to get all data but not use $_POST variables.........

thanks a lot......^^


--- End Message ---
--- Begin Message ---
Sorry to be off-topic but has anyone got any good resources on setting up 
exmlm?

--- End Message ---
--- Begin Message ---
On Friday 06 December 2002 18:18, Randum Ian wrote:
> Sorry to be off-topic but has anyone got any good resources on setting up
> exmlm?

google has

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
I used to work in a fire hydrant factory.  You couldn't park anywhere near
the place.
                -- Steven Wright
*/

--- End Message ---
--- Begin Message ---
> Why do people insist on asking MySQL questions on a PHP list?
> search for "flush privileges" on the MySQL website.

Mayby it is the most inteligent newsgroup. ;-)

--- End Message ---
--- Begin Message ---
0.<font style="text-decoration : overline;">3</font>

Stephen wrote:

Hello again,

This is another PHP mathematical question. How can I display a bar over a
number (overline) if it's a repeating decimal? When the user types in 1 by
3, they get 0.333333333333. I want it to display as 0.3 with the 3
overlined. How can I do this keeping in mind that not all numbers will be
repeating decimals?

Thanks,
Stephen Craton
http://www.melchior.us

"What is a dreamer that cannot persevere?" -- http://www.melchior.us



--- End Message ---
--- Begin Message ---
Hi,

Friday, December 6, 2002, 5:00:07 AM, you wrote:
S> Hello again,

S> This is another PHP mathematical question. How can I display a bar over a
S> number (overline) if it's a repeating decimal? When the user types in 1 by
S> 3, they get 0.333333333333. I want it to display as 0.3 with the 3
S> overlined. How can I do this keeping in mind that not all numbers will be
S> repeating decimals?

Did this as an exercise :)

function check_to_end($str,$pat){
        $lp = strlen($pat);
        $ls = strlen($str);
        $x = 0;
        while(true){
                $ls = strlen($str);
                if($ls > $lp){//string bigger than pattern
                        $t = substr($str,0,$lp);
                        if($t != $pat){
                                return false;
                        }
                        $str = substr($str,$lp);
                }else{//pattern too big .. checks tail end
                        $pat = substr($pat,0,strlen($str));
                        if( $pat != $str) return false; //no repeat
                        if($x < 2) return false; //didn't repeat enough
                        return true; //found a pattern
                }
                $x++;
        }
}
function repeat($num){
        $s = substr(number_format($num,16),0,-1); //make a string
        echo $s;
        list($a,$b) = split('\.',$s); //split decimal bit out
        $l = strlen($b);
        for($i=0;$i<$l;$i++){ //loop through string
                $o = 0;
                $k = $b[$i];    //number to find
                for($y = $i+1;$y<$l;$y++){ //loop look for same number
                        $c = ord($b[$y]);
                        if(ord($k) == ord($b[$y])){ //got a match
                                $pat = substr($b,$i,$y-$i); //cut out pattern
                                $str = substr($b,$i); //string to check
                                if(check_to_end($str,$pat)){ //see if pattern runs 
till the end
                                        $o = 1; //yep
                                        if(ord($pat) == ord('0')) $o = 2; //were they 
just '0's
                                        break;
                                }
                        }
                }
                if($o)break; // all done
        }
        if($o == 1){ // a pattern
                $r = $a.'.'.substr($b,0,$i).'<span 
style="text-decoration:overline">'.$pat.'</span>';
        }elseif($o == 2){ // whole bunch of ending 0s
                $r = (substr($b,0,$i) != '')? $a.'.'.substr($b,0,$i):$a;
        }else{ //no repeat
                $r = $s;
        }
        return $r;
}
//usage
for($x = 1;$x < 100;$x++){
        $a = 11/$x;
        $res = repeat($a);
        echo '&nbsp;&nbsp;&nbsp;returned: '.$res.'<br>';
}

The  check_to_end() function could probably be replaced with a regex but those
go in the same basket as vi with my old brain :)

 Regards Tom

--- End Message ---
--- Begin Message ---
Hello,


Could you tell me how to transform a PHP query result to a javascript 
array ?

Same question, if you want to store several field from the query to the 
javascript.

Christian,

--- End Message ---
--- Begin Message ---
for numbers:
jsarray= new Array(<?=  implode(',',$phparray) ?>);

for strings:
jsarray= new Array("<?=  implode('","',$phparray) ?>");

Christian Ista wrote:

Hello,


Could you tell me how to transform a PHP query result to a javascript array ?

Same question, if you want to store several field from the query to the javascript.

Christian,




--- End Message ---
--- Begin Message ---
Hi Thomas,

> SELECT * from $DB_TBLName WHERE
> (Trim(WorkerEmail)='$userReplacementEmail')
> AND AND  OR  OR  OR  OR  OR

This is all a bit complicated, and a simple boy like me gets lost too
easily. KISS principle: Keep it simple...

You have two employees:
A, so named because he Already has Annual leave Approved, and
B, so named because he is Begging to Be allowed to Break out.

Let's imagine we're playing with a wall-chart/wall-planner to assess
requests prior to granting approval. So we mark off which days A will be
away and then view which days B would like to go against existing requests.

    Month A     Month B    Month C   Month etc
A              <------------------->
B                              <........................>

Assuming the email/fonts haven't mucked-up my sketch, you can see that B's
request should be denied, because A has already booked the time-out.

Now let's use the diagram to build an algorithm. How many ways are there
that A and B could overlap? (hint: four) Not overlap? (hint: two) Which is
the easiest to implement in code?

Now you can ask, which language should I code in? Answer: stay as close to
the source as possible, ie use SQL (or in this case pseudo-SQL(!)).

SELECT a AS Colleague, CONCAT( astart - afinish ) AS PermissionDenied
   FROM tbl
   WHERE bstart < afinish
      OR bfinish > astart;

Before this will work, you will need to add another WHERE clause to
establish who is the employee's "replacement". The above lists a reason for
rejection - you can reverse the logic, at your peril.

Trust this assists,
=dn

PS The complicating question I wanted to ask from the word "go" is: what if
one person can have more than one other employee act as his/her
"replacement"?




> Background:
> ================
>
> I've created a vacation-request application for our company's intranet.
> When an employee requests a vacation, he has to list the name of another
> employee who will 'fill in' for him while he is gone.
>
> Before a vacation request can be saved in MySQL, I need to check to make
> sure that the person listed as the employee's replacement during this time
> has not already requested a vacation during the same time period...to
> check to be sure that the two vacation periods do not overlap.
>
> Date Ranges:
> ================
>
> I have fields saved in MySQL called unixStartDate & unixEndDate that are
> unix timestamps for the first day of the employee's vacation and the last
> day of the emplosyee's vacation.
>
> I have tried to do a check using purely SQL, but this doesn't account for
> all possibilities of overlapping dates:
>
> (unixStartDate is the unix timestamp for the replacement, whereas the PHP
> var $unixStartDate is the unix timestamp for the employee who wants to
> post a new vacation request)
>
> $checkSQL = "SELECT * from $DB_TBLName WHERE
> (Trim(WorkerEmail)='$userReplacementEmail')
> AND (Status < 40)
> AND
> (
> (
> ($unixStartDate = unixStartDate)
> )
> OR
> (
> ($unixEndDate = unixEndDate)
> )
> OR
> (
> ($unixStartDate = unixEndDate)
> )
> OR
> (
> ($unixEndDate = unixStartDate)
> )
> OR
> (
> (unixStartDate < $unixStartDate) && (unixEndDate > $unixEndDate)
> )
> OR
> (
> (unixStartDate > $unixStartDate) && (unixEndDate < $unixEndDate)
> )
> )
> ";
>
> So I think what I instead need to do is use PHP code instead of SQL to
> check for overlapping dates in the 2 date ranges I have.
> My two ranges would be like this:
>
> Replacement's Date Range:
> ================
> $unixStartDateReplacementVacation
> ...to...
> $unixEndDateReplacementVacation
>
> Employee's Date Range:
> ================
> $unixStartDateEmployeeVacation
> ...to..
> $unixEndDateEmployeeVacation
>
>
> ================
>
> ...so i need to check that none of the dates occuring in the first date
> range listed above appear in the second date range.
> unfortunately, i have no basic idea of how i should go about doing
> this...should i use arrays of dates, for-loops, or what?
> thanks a whole lot in advance,
>
> Tom

--- End Message ---
--- Begin Message ---
Thomas (and list),

The solution, as previously posted, is flawed/incomplete - mea culpa.
Excuse: I was interrupted three times from typing the word SELECT until
pressing Send, and then rushing to get on to the next call on my time...

>    WHERE bstart < afinish
>       OR bfinish > astart;

Check back with the diagram and you will see that a bstart clause needs to
also check that bstart >= astart to trigger rejection - if the leave starts
AND finishes before the 'replacement's' leave, then all is well - similarly
for second clause.

Now, if you prefer to inform a positive response, eg "leave may be granted",
then when you turn things around, pay special attention to the relationship
and changing ORs and ANDs.

Better if we change the whole logic around and say "when can we grant annual
leave?" because then the answer becomes: if bfinish < astart or fstart >
afinish. This has the additional advantage of 'scaling', if the employee has
more than one potential 'replacement'!

In all approaches beware the special case: that the 'replacement' has no
outstanding request for leave!

Again apologies,
=dn



> > SELECT * from $DB_TBLName WHERE
> > (Trim(WorkerEmail)='$userReplacementEmail')
> > AND AND  OR  OR  OR  OR  OR
>
> This is all a bit complicated, and a simple boy like me gets lost too
> easily. KISS principle: Keep it simple...
>
> You have two employees:
> A, so named because he Already has Annual leave Approved, and
> B, so named because he is Begging to Be allowed to Break out.
>
> Let's imagine we're playing with a wall-chart/wall-planner to assess
> requests prior to granting approval. So we mark off which days A will be
> away and then view which days B would like to go against existing
requests.
>
>     Month A     Month B    Month C   Month etc
> A              <------------------->
> B                              <........................>
>
> Assuming the email/fonts haven't mucked-up my sketch, you can see that B's
> request should be denied, because A has already booked the time-out.
>
> Now let's use the diagram to build an algorithm. How many ways are there
> that A and B could overlap? (hint: four) Not overlap? (hint: two) Which is
> the easiest to implement in code?
>
> Now you can ask, which language should I code in? Answer: stay as close to
> the source as possible, ie use SQL (or in this case pseudo-SQL(!)).
>
> SELECT a AS Colleague, CONCAT( astart - afinish ) AS PermissionDenied
>    FROM tbl
>    WHERE bstart < afinish
>       OR bfinish > astart;
>
> Before this will work, you will need to add another WHERE clause to
> establish who is the employee's "replacement". The above lists a reason
for
> rejection - you can reverse the logic, at your peril.
>
> Trust this assists,
> =dn
>
> PS The complicating question I wanted to ask from the word "go" is: what
if
> one person can have more than one other employee act as his/her
> "replacement"?
>
>
>
>
> > Background:
> > ================
> >
> > I've created a vacation-request application for our company's intranet.
> > When an employee requests a vacation, he has to list the name of another
> > employee who will 'fill in' for him while he is gone.
> >
> > Before a vacation request can be saved in MySQL, I need to check to make
> > sure that the person listed as the employee's replacement during this
time
> > has not already requested a vacation during the same time period...to
> > check to be sure that the two vacation periods do not overlap.
> >
> > Date Ranges:
> > ================
> >
> > I have fields saved in MySQL called unixStartDate & unixEndDate that are
> > unix timestamps for the first day of the employee's vacation and the
last
> > day of the emplosyee's vacation.
> >
> > I have tried to do a check using purely SQL, but this doesn't account
for
> > all possibilities of overlapping dates:
> >
> > (unixStartDate is the unix timestamp for the replacement, whereas the
PHP
> > var $unixStartDate is the unix timestamp for the employee who wants to
> > post a new vacation request)
> >
> > $checkSQL = "SELECT * from $DB_TBLName WHERE
> > (Trim(WorkerEmail)='$userReplacementEmail')
> > AND (Status < 40)
> > AND
> > (
> > (
> > ($unixStartDate = unixStartDate)
> > )
> > OR
> > (
> > ($unixEndDate = unixEndDate)
> > )
> > OR
> > (
> > ($unixStartDate = unixEndDate)
> > )
> > OR
> > (
> > ($unixEndDate = unixStartDate)
> > )
> > OR
> > (
> > (unixStartDate < $unixStartDate) && (unixEndDate > $unixEndDate)
> > )
> > OR
> > (
> > (unixStartDate > $unixStartDate) && (unixEndDate < $unixEndDate)
> > )
> > )
> > ";
> >
> > So I think what I instead need to do is use PHP code instead of SQL to
> > check for overlapping dates in the 2 date ranges I have.
> > My two ranges would be like this:
> >
> > Replacement's Date Range:
> > ================
> > $unixStartDateReplacementVacation
> > ...to...
> > $unixEndDateReplacementVacation
> >
> > Employee's Date Range:
> > ================
> > $unixStartDateEmployeeVacation
> > ...to..
> > $unixEndDateEmployeeVacation
> >
> >
> > ================
> >
> > ...so i need to check that none of the dates occuring in the first date
> > range listed above appear in the second date range.
> > unfortunately, i have no basic idea of how i should go about doing
> > this...should i use arrays of dates, for-loops, or what?
> > thanks a whole lot in advance,
> >
> > Tom
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hello list,

I am running a redhat7.3 box and a customer want to get installed php with GD-library 
support

I want to configure php like this:

./configure .... --with-gd= where is this directory?    ....

How can I find the directory where are the correspondent gd-lib/headers-files so that 
I can 
configure php with the correct gd (--with-gd="this I want to know"support?

Oliver Etzel

eu-Domains are coming
www.t-host.com



--- End Message ---
--- Begin Message ---
Hiya,
    Ive got a few websites that use sessions and I thought id upgrade them
now to use cookies. In the main file it calls the session start function,
and then this function is called, but it does not seem to work. I open a new
window and the cookie does not seem to auto log me on.

    Sorry if I have not explained it right, I want a feature like amazon
where you go back to a site and you are still logged in.

    The test member has rememberpassword as y.

    The code below keeps my sessions but the cookie bit dosent work.

    Thanks,

    Steve
    XX

 /* Check a session is valid
  */
 function session_check($db_link)
 {
  //Ok so either want to log on, or have a session or cookie allready
  if(isset($_SESSION['ssun']) || isset($_COKKIE["ssun"]) ||
isset($_POST['ssname']))
  {
   //Attempt to logon. Set the logon form variables to the session
variables.
   if(isset($_POST['sspass'])&&isset($_POST['ssname']))
   {
        $_SESSION['sspw'] =$_POST['sspass'];
        $_SESSION['ssun'] =$_POST['ssname'];

        if(isset($_COOKIE["ssun"]))
       {
            $_COOKIE['ssun']="";
            $_COOKIE["ssun"]="";
        }
   }

   if(isset($_COOKIE["ssun"]))
   {
    $result = mysql_query("SELECT rememberpassword, memberid, title,
lastname, lastnamenow, md5(memberpassword), email FROM members WHERE
md5(memberpassword)='".$_COOKIE['sspw']."' AND
email='".$_COOKIE['ssun']."'", $db_link);
   }
   else
   {
    //Check if the session username and password are correct
    $result = mysql_query("SELECT rememberpassword, memberid, title,
lastname, lastnamenow, md5(memberpassword), email FROM members WHERE
memberpassword='".$_SESSION['sspw']."' AND email='".$_SESSION['ssun']."'",
$db_link);
   }

   if(mysql_num_rows($result)==1)
   {
    $loggedin="yes";
    $userdata = mysql_fetch_row($result);

    if($userdata[0]=="y")
    { //Set up the cookies, store the md5 version of the password
     setcookie ("ssun", $userdata[6],time()+604800);
     setcookie ("sspw", $userdata[5],time()+604800);
    }

    if($userdata[4]=="") //If no last name now
    {
     $_SESSION['title']=$userdata[2];
     $_SESSION['lastname']=$userdata[3];
    }
    else //Use the last name now
    {
     $_SESSION['title']=$userdata[2];
     $_SESSION['lastname']=$userdata[4];
    }
   }
   else
   {
    $loggedin="no";
   }

   if(isset($_GET['logoff']))
   {
    if($_GET['logoff']=="true")
    {
     //Remove the session and cookies
     $loggedin="no";
     $_SESSION['ssun']="";
     $_SESSION['sspw']="";
     $_SESSION['title']="";
     $_SESSION['lastname']="";
     setcookie ("ssun", "",time()-3600);
     setcookie ("sspw", "",time()-3600);
    }
   }
   return $loggedin;
  }
  else
  {
   return "no";
  }
 }

--- End Message ---
--- Begin Message ---
Hello list,

I am running a redhat7.3 box and a customer want to get installed php with GD-library 
support

I want to configure php like this:

./configure .... --with-gd= where is this directory?    ....

How can I find the directory where are the correspondent gd-lib/headers-files so that 
I can 
configure php with the correct gd (--with-gd="this I want to know"support?

Oliver Etzel

eu-Domains are coming
www.t-host.com

--- End Message ---
--- Begin Message ---
Hello list,

I am running a redhat7.3 box and a customer want to get installed php with GD-library 
support

I want to configure php like this:

./configure .... --with-gd= where is this directory?    ....

How can I find the directory where are the correspondent gd-lib/headers-files so that 
I can 
configure php with the correct gd (--with-gd="this I want to know"support?

Oliver Etzel

eu-Domains are coming
www.t-host.com

--- End Message ---
--- Begin Message ---
Hi,

Friday, December 6, 2002, 10:33:43 PM, you wrote:
GdRZ> Hello list,

GdRZ> I am running a redhat7.3 box and a customer want to get installed php with 
GD-library support

GdRZ> I want to configure php like this:

GdRZ> ./configure .... --with-gd= where is this directory?    ....

GdRZ> How can I find the directory where are the correspondent gd-lib/headers-files so 
that I can 
GdRZ> configure php with the correct gd (--with-gd="this I want to know"support?

GdRZ> Oliver Etzel

GdRZ> eu-Domains are coming
GdRZ> www.t-host.com


Try:
locate libgd
locate gd.h
that should tell you where they are hiding

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
I've got a routine that queries a MySQL database and outputs the sorted
results to a web page (script snippet below.) How can I output the exact
same thing to a txt file using this script?

<?

$count = 0;

$result = mysql_query ("SELECT * FROM listings ORDER by a
DESC");

if ($row = mysql_fetch_array($result)) { 

do { ?>


<? echo $row['company_name']; ?>
&nbsp;&nbsp;
<? echo $row['agent_name']; ?>
&nbsp;&nbsp;
<? echo $row['county']; ?>
&nbsp;&nbsp;
<? echo $row['city']; ?>
<br>
<? echo $row['mls']; ?>
&nbsp;&nbsp;
$<? echo number_format($row['price'], ","); ?>
&nbsp;&nbsp;
<? echo $row['area']; ?>
<br>
<? echo $row['copy']; ?>
<br>
<? echo $row['agent_name']; ?>
<p>

<?
$count++;

if ($count == 8) {

echo "<hr><b>Page Break</b><hr><p>";
$count = 0;
}

}

while($row = mysql_fetch_array($result));

mysql_close(); } ?>

Thanks in advance for any ideas

Ed


--- End Message ---
--- Begin Message ---
everything you need is here

http://www.php.net/manual/en/ref.filesystem.php

in particular fopen(), fputs(), fwrite(), etc.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 06, 2002 1:25 PM
Subject: [PHP] Output of MySQl sorted query to text or Word file.


> 
> I've got a routine that queries a MySQL database and outputs the sorted
> results to a web page (script snippet below.) How can I output the exact
> same thing to a txt file using this script?
> 
> <?
> 
> $count = 0;
> 
> $result = mysql_query ("SELECT * FROM listings ORDER by a
> DESC");
> 
> if ($row = mysql_fetch_array($result)) { 
> 
> do { ?>
> 
> 
> <? echo $row['company_name']; ?>
> &nbsp;&nbsp;
> <? echo $row['agent_name']; ?>
> &nbsp;&nbsp;
> <? echo $row['county']; ?>
> &nbsp;&nbsp;
> <? echo $row['city']; ?>
> <br>
> <? echo $row['mls']; ?>
> &nbsp;&nbsp;
> $<? echo number_format($row['price'], ","); ?>
> &nbsp;&nbsp;
> <? echo $row['area']; ?>
> <br>
> <? echo $row['copy']; ?>
> <br>
> <? echo $row['agent_name']; ?>
> <p>
> 
> <?
> $count++;
> 
> if ($count == 8) {
> 
> echo "<hr><b>Page Break</b><hr><p>";
> $count = 0;
> }
> 
> }
> 
> while($row = mysql_fetch_array($result));
> 
> mysql_close(); } ?>
> 
> Thanks in advance for any ideas
> 
> Ed
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Hi all...
 
I've tried to figure this one out but I'm really having a headache now. So, I really need your help.
 
Situation:
 
I have a database of images and its own thumbnails created using GD. It worked wonderfully.
 
Problem:
 
I want to display ONLY thumbnails in table form, incrementing in rows of 4 columns. By this I mean that I want to write a script which loops in a way that it displays 4 pictures withdrawn from the database into a row, and then for the next 4 images, displays them into the next row.
 
If you don't understand see the gif below... a script that displays 4 pictures across first ( arrow 1) , then goes to the next row and displays the next 4 ( arrow 2).
 
I can't work out how can i structure my loop to do this.
 
Question:
 
Can all the gurus out there please give me a pointer? I really can't work out the logic or systematic flow of scripting this one.
 
 
Thank you so much in advance!
 
 
Yours,
 
Wee Keat Chin
 
------------------------------------------
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe." - Albert Einstein
--- End Message ---
--- Begin Message ---
> I want to display ONLY thumbnails in table form, incrementing in rows of
> 4 columns. By this I mean that I want to write a script which loops in a
> way that it displays 4 pictures withdrawn from the database into a row,
> and then for the next 4 images, displays them into the next row.

Inside your loop, keep a counter.  When the counter % 4 = 0, echo out a
"</tr>".  If you want to put more images on a row, just change the "4" to
whatever number you want.

Chris

--- End Message ---
--- Begin Message ---
asuming $res holds your query result:

$col=0;
echo '<table>';
while($img=mysql_fetch_array($res)) {
   if($col==0) echo '<tr>';
   echo "<td> <img src="$img[thumb]"> </td>";
   $col++;
   if($col==4) {
       echo '</tr>';
       $col=0;
   }
}
if($col!=0) str_repeat('<td></td>', 4 - $col);
echo '</table>';

Not tested

Wee Keat [Amorphosium] wrote:

Hi all...
I've tried to figure this one out but I'm really having a headache now. So, I really need your help.

Situation:

I have a database of images and its own thumbnails created using GD. It worked wonderfully.

Problem:

I want to display ONLY thumbnails in table form, incrementing in rows of 4 columns. By this I mean that I want to write a script which loops in a way that it displays 4 pictures withdrawn from the database into a row, and then for the next 4 images, displays them into the next row.

If you don't understand see the gif below... a script that displays 4 pictures across first ( arrow 1) , then goes to the next row and displays the next 4 ( arrow 2).

I can't work out how can i structure my loop to do this.

Question:

Can all the gurus out there please give me a pointer? I really can't work out the logic or systematic flow of scripting this one.


Thank you so much in advance!


Yours,

Wee Keat Chin

------------------------------------------
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe." - Albert Einstein


--- End Message ---
--- Begin Message ---
Hi,
I'm using MS Win 98 and my ISP has PHP installed on a MS server.

I'd like to display a HTML form box on my site for users to type in a
message utilizing the PHP mail() function.

I've tested this using Apache on my drive with a html form and a php script
to receive the data and it works fine - but when the site goes live it will
be hosted with an ISP with a MS server - not Apache.

Is it possible to utilize the PHP mail function under these conditions?

I was led to believe that I could change the configurations in my php.ini
file from:

SMTP: localhost

to

SMTP: mail.yourisp.com

Greatly appreciate your advice.

Thanking all in advance.
Tony Ritter




--- End Message ---
--- Begin Message ---
Hello list,

how can I check wheter GD-function is working and running?

Oliver Etzel
--- End Message ---

Reply via email to