[PHP] Re: PHP+MySQL -> Excel ?

2002-05-17 Thread Evan

Thanks to all :-)

Bye,
Evan

"Evan" <[EMAIL PROTECTED]> ha scritto nel messaggio
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Is it possible to create an excel file with some data from mySQL, using
PHP
> ?
>
> Thanks,
> Evan
>
>



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




RE: [PHP] PHP+MySQL -> Excel ?

2002-05-17 Thread Jay Blanchard

[snip]
Is it possible to create an excel file with some data from mySQL, using PHP
?
[/snip]

Evan,

I'll send you the article I recently wrote for evolt.org, it details all of
the things you need to know. Excel will honor all HTML table formatting
issues, except color. Colors need to be stated as RGB values. I have
intended to produce a chart of these that are valid in Excel, but time
runneth away

HTH!

Jay



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




Re: [PHP] forms into database and visa versa

2002-05-17 Thread Dennis Gearon

Thank you for reply,
I don't understand what your answer has to do with taking input from
users in forms and putting it into a database safely. If you could
explain that, I could learn from your much appreciated reply.

Geoff Hankerson wrote:
> 
> depending on your needs you could just create a .csv file (comma seperated
> text) that excel can read easily
> - Original Message -
> From: "Dennis Gearon" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, May 17, 2002 11:13 AM
> Subject: [PHP] forms into database and visa versa
> 
> > ***_PLEASE CC me as I am on digest_***
> >
> > Anyone have a link or links to how to definitively make safe inserts to
> > databases with form information?
> >
> > I'm thinking this has to do with add/remove slashes. BUT, I also think
> > that it might be a good idea to write a function that adds slashes to
> > all SQL words, (and make its converse function as well)
> >
> > Maybe a pointer to all the possible exploits would be a way to learn
> > what to do to avoid them? :-)
> > --
> >
> > If You want to buy computer parts, see the reviews at:
> > http://www.cnet.com/
> > **OR EVEN BETTER COMPILATIONS**!!
> > http://sysopt.earthweb.com/userreviews/products/
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

-- 

If You want to buy computer parts, see the reviews at:
http://www.cnet.com/
**OR EVEN BETTER COMPILATIONS**!!
http://sysopt.earthweb.com/userreviews/products/

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




Re: [PHP] PHP+MySQL -> Excel ?

2002-05-17 Thread Rasmus Lerdorf

It is also possible to connect directly to MySQL from Excel via MyODBC.

-Rasmus

On Fri, 17 May 2002, Chris Boget wrote:

> > > 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:
>
>   header("Content-Disposition: inline; filename=myfile.xls");
>   header("Content-Description: PHP3 Generated Data");
>   header("Content-type: application/vnd.ms-excel; name='excel'");
>
> The browser will take that to mean that an excel document is coming through
> and will open it up as such.  Since excel understands HTML, your data will be
> displayed correctly.  Usually.
> It's been working fine for us for years.
>
> Chris
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] Confused about which function to use with forms/database

2002-05-17 Thread Don

Hi,

I have forms that retrieve date from mysql databases and send (for storage) data to 
same databases.  I note many functions to make sure that the data is correct in 
appearance when it comes to special characters.

addslashes()
stripslashes()
htmlspecialchars()
htmlentities()
get_html_translation_table(HTML_ENTITIES)

I've read the documentation but am still confused about what to use when.

When passing data from forms to database, which do I use?
When retrieving data from database to display in forms, which do I use?

Thanks,
Don


Re: [PHP] PHP+MySQL -> Excel ?

2002-05-17 Thread Chris Boget

> 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




Re: [PHP] PHP+MySQL -> Excel ?

2002-05-17 Thread Rasmus Lerdorf

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.

-Rasmus

On Fri, 17 May 2002, Chris Boget wrote:

> > 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
>


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




RE: [PHP] PHP+MySQL -> Excel ?

2002-05-17 Thread Jay Blanchard

[snip]
> 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?
[/snip]

Nope, no PHP, just the ODBC driver would have to live on Windows

Jay


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




Re: [PHP] PHP+MySQL -> Excel ?

2002-05-17 Thread Chris Boget

> 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 illustrate how this can be done?  I'm not very
interested in looking into this alternative.

thnx,
Chris


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




Re: [PHP] PHP+MySQL -> Excel ?

2002-05-17 Thread Rasmus Lerdorf

> 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?  Just read the MyODBC
docs at mysql.com.

-Rasmus


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




[PHP] Q:Anybody using PHP directly on Mac-OSX???

2002-05-17 Thread Marcus James Christian

Hello,

I love PHP but I haven't gotten deep into it because of the issue of
needed to upload it to my hosts server to test it.

I'd love to get REALLY good with PHP, advanced shopping cart stuff, DB
etc.  but I just know the way my mind works and unless its a simple one
click to test it on my desktop,  well you know.

So, anybody out there have PHP installed on their local home desktop Mac
OSX box able to test by a quick "preview in browser" from say an app
like BBedit?

-Marcus

--
|||

Marcus Unlimited
http://marcusunlimited.com
Multimedia Internet Design and Education
|||

--
| Limited Time Offer!
| Download the Recordings of Chromaticus
| FREE! @ http://ampcast.com/chromaticus
| Complete song files and Sci-Fi Loops for
| programs like Reason, Flash, Premiere
| Logic, Cubase, Recycle, Acid, FruityLoops,
| and many, many, more!!!



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




[PHP] accessing mysql_fetch_array more than once?

2002-05-17 Thread Chris Knipe

Hi all,

Howcome, when I do a SQL lookup, I can only access the array once?

Say, I have... 







--
me




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




Re: [PHP] accessing mysql_fetch_array more than once?

2002-05-17 Thread Rasmus Lerdorf

reset()

On Fri, 17 May 2002, Chris Knipe wrote:

> Hi all,
>
> Howcome, when I do a SQL lookup, I can only access the array once?
>
> Say, I have...
>
>  $SQL = mysql_query("SOME SELECT STATEMENT");
> while ($var = mysql_fetch_array($SQL)) {
>   echo $var['columbname'];
> }
>
> // that works, and prints out the rows in the table
> // my codes continues.
>
> ?>
>
> 
>
>  while ($var = mysql_fetch_array($SQL)) {
>   echo $var['columbname'];
> }
> // Now, the array doesn't print anything...
> ?>
>
> --
> me
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] PHP+MySQL -> Excel ?

2002-05-17 Thread Chris Boget

> > 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 much!

Chris


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




[PHP] Re: PHP+MySQL -> Excel ?

2002-05-17 Thread Manuel Lemos

Hello,

On 05/17/2002 01:18 PM, Evan wrote:
> Is it possible to create an excel file with some data from mySQL, using PHP
> ?

Sure, you can use this class to generate Excel files on fly on even in 
non-Windows platforms.

http://www.phpclasses.org/biffwriter

-- 

Regards,
Manuel Lemos


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




Re: [PHP] Re: PHP+MySQL -> Excel ?

2002-05-17 Thread Glenn Sieb

At 02:13 PM 5/17/2002 -0300, Manuel Lemos posted the following...
>Hello,
>
>On 05/17/2002 01:18 PM, Evan wrote:
>>Is it possible to create an excel file with some data from mySQL, using PHP
>>?
>
>Sure, you can use this class to generate Excel files on fly on even in 
>non-Windows platforms.

Heck, outputting a tab-delimited file with a mime type of 
application/msexcel works too.. :)

Glenn


---
The original portions of this message are the copyright of the author
(c)1998-2002 Glenn E. Sieb.ICQ UIN: 300395IRC Nick: Rainbear
"All acts of Love and Pleasure are Her rituals"-Charge of the Goddess



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




[PHP] what does this mean in plain english?

2002-05-17 Thread Jeff Field

Hi. I'm fairly new to PHP and programming in general.  I'm learning mostly
by deconstructing what others have written...but even though I have plenty
of PHP books and have searched the Internet high and low, I'm stumped by the
exact meaning in the following function of what the question mark's ("?")
and colon's (":"), mean and do?

BTW, I'm not looking for an explanation of the function; just what the
question mark's and colon's mean in plain english, so I'll know how to use
them in other places.  Thanks!

Jeff

--
function GetSQLValueString($theValue, $theType)
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
case "text":
  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  break;
case "int":
  $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  break;
  }
  return $theValue;
}
--


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




Re: [PHP] forms into database and visa versa

2002-05-17 Thread Analysis & Solutions

> Anyone have a link or links to how to definitively make safe inserts to
> databases with form information?

It's a good idea to validate all data you're sticking in before you do.
For example, if you have a numeric field, you don't want the person to
be able to submit letters in that field.  So, always check that the data
is formatted the way you want it to be before sending it to the
database.

I usually use preg_replace() to remove undesireable characters.

If you want text to go into a field and want people to be able to have 
quotes and other such items in there, then use addslashes().

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




Re: [PHP] Comon guys, please help.

2002-05-17 Thread Jerome Houston

This isn't a php question, which is why you aren't getting any answers...
there are many ways to go about this.  with cybercash and payflow, and all 
other payment gateways, you DO need a merchant account.  specifically, a 
merchant account that is compatible with the payment gateway you're trying 
to use.  Some services will accept credit cards for you, but charge you a 
more hefty percentage of sales (or some other fee system, like a 
per-transaction fee) to make it worth their while to write the software that 
does the credit card processing real-time for your website (like 
www.ezcharge.net).  most important is that you find somebody who gives a 
good deal on what THEY charge YOU, and who you can connect to in a way that 
you have available to you.  Lots of payment gateways just need you to have a 
utility that can send a HTTPS (!note the S !) POST or GET - which PHP by 
itself can't do yet - wait for 4.3 (and even then you'll need OpenSSL 
support compiled in).

maybe that will help, maybe it will further confuse you.  i leave it to the 
gods to decide.
-jerome


Original Message Follows
From: "r" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: [PHP] Comon guys, please help.
Date: Fri, 17 May 2002 19:42:04 -0700

  Hi Guys,
  Special greetings to all of you who have helped me in the past.

  As some of you know i just bought a PHP book called "Php Blackbook" which 
i
  heard is really good.
  Anyway, In chapter 4 it talks about credit cardsand then CyberCash
which
  is owned by verisign and payflow which too is owned by verisign. The book
  also gave me some url and RFCs to look up.
  I dont know if its coz i'm a newbie to PHP or just dumb but I just cant
  understand this...its too damn high funda for me,
  I know google is my pal so I went there, read up on differient RFCs and 
got
  even more confused!

  I just want to know have any of you worked on these systems? eg CyberCash
  and PayFlow?
  Does this mean that if i want to start accepting credit cards on my site i
  wont have to pay for a credit card merchant account?

  PLEASE HELP if you know the answer or can offer any suggestions,comments
  ANYTHING.

  Have a great day,
  -Ryan.

  /*If you see me getting beated up by the cops, put down the camera and 
come
and help me! */



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



_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




[PHP] looking for training course in london

2002-05-17 Thread Adrian Murphy

Hi,
anyone know/done good php training courses in london
thx
adrian



Re: [PHP] what does this mean in plain english?

2002-05-17 Thread Stuart Dallas

On 17 May 2002 at 12:23, Jeff Field wrote:
>   $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

It's a shortened version of the if...else construct. As in...

condition ? this_if_true : this_if_false

-- 
Stuart

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




Re: [PHP] what does this mean in plain english?

2002-05-17 Thread Analysis & Solutions

On Fri, May 17, 2002 at 12:23:45PM -0500, Jeff Field wrote:
> I'm stumped by the
> exact meaning in the following function of what the question mark's ("?")
> and colon's (":"), mean and do?

That's the "ternary" comparison operator.  See 
http://www.php.net/manual/en/language.operators.comparison.php, then 
scroll down under the top table.

> $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

For explanation, allow me to change this a tad...

 $newValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

So, in english...

If magic quotes gpc is off, set $newValue to addslashes($theValue).
If magic quotes gpc is NOT off, set $newValue to plain old $theValue.

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




Re: [PHP] what does this mean in plain english?

2002-05-17 Thread Adrian Murphy

The ? in this senario is called the ternary operator
basically shorthand for an if/else statement e.g

$theValue = ($theValue != "") ? "'" . $theValue . "'" :"NULL";

is the equivalent of

if($theValue != "") {
$theValue =$theValue ;
}
else{
$theValue ="NULL";
}

- Original Message -
From: "Jeff Field" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 17, 2002 6:23 PM
Subject: [PHP] what does this mean in plain english?


> Hi. I'm fairly new to PHP and programming in general.  I'm learning mostly
> by deconstructing what others have written...but even though I have plenty
> of PHP books and have searched the Internet high and low, I'm stumped by
the
> exact meaning in the following function of what the question mark's ("?")
> and colon's (":"), mean and do?
>
> BTW, I'm not looking for an explanation of the function; just what the
> question mark's and colon's mean in plain english, so I'll know how to use
> them in other places.  Thanks!
>
> Jeff
>
> --
> function GetSQLValueString($theValue, $theType)
> {
>   $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) :
$theValue;
>
>   switch ($theType) {
> case "text":
>   $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
>   break;
> case "int":
>   $theValue = ($theValue != "") ? intval($theValue) : "NULL";
>   break;
>   }
>   return $theValue;
> }
> --
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] mysql error

2002-05-17 Thread Randum Ian

Hi all,

I have got this code but I can get it to work, it doesnt make sense!





but I am getting this error - "Warning: Supplied argument is not a valid
MySQL result resource in /usr/home/e/a/eagadmin/public_html/main.php on line
14" but I dont understand why!

Can anyone help?

Regards, Ian.
---
Randum Ian
DJ / Reviewer / Webmaster, DancePortal (UK) Limited
[EMAIL PROTECTED]
http://www.danceportal.co.uk
DancePortal.co.uk - Global dance music media


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




Re: [PHP] upload but restrict

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, r wrote:
> Sorry for the late reply,
> but i have a boss who wants everything done RIGHT NOW!
> 
> Anyway, as an example think a person uploads a .php or .exe file, I just
> dont want it to run on my webserver
> how can i restrict him/her?

Just make sure the uploads are in a directory where Apache has been 
configured not to run anything. How to do that depends on how you told it 
to run things in other directories.

miguel


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




[PHP] a set of *real* random numbers?

2002-05-17 Thread savaidis


I want to show in random way 8 pictures (jpg) from a collection of 20 I have
,  so the users have more interest to visit the page.

I use the follow small code with the help from the manual:
But the random numbers are all accending order  for 1 -> 20 and in cycle, as
the seed comes from computers timming.
So I get always the same sets of 8 numbers. (i.e. 1->8,  3->10,
15-16-17-18-19-20-1-2 ecc)

What can I use for seed for *real* rnd?


(I FOUND IT, I CHANGED  10 to 1000  AND IT WORKS!)


Thanks -    PLEASE DON'T  ANSWER!!! **


Makis Savaidis



=== the code ==>
 ");
  for ($cnt1=1; $cnt1<=$cnt2; $cnt1++) // check for doubles
  {
  if ($arr[$cnt1]==$randval1)  $break=1;

  }
}  while ($break==1);

  $cnt2++; $arr[$cnt2] = $randval1;

echo(" cnt2 $cnt2 arr1 $arr[$cnt2]  ");

} while ($cnt2<8);


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




Re: [PHP] Looking for web based email

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, Martin Wickman wrote:
> Jared Boelens wrote:
>> This is the one my company uses:
>> 
>> http://nocc.sourceforge.net/
>> 
>> I found it very easy to modify, and it fully supports attachments as
>> well as the related RFCs.
> 
> I had problem with it, since it required imap stuff and whatnot. 
> Anyway, I ended up using squirrelmail and we have been using that for 
> some time now. Quite happily I might add.

We used Squirrelmail for a while, but little glitches with folders failing
to update, caching problems, etc., eventually drove our traveling staff to
near-mutiny. Switched to IMP/Horde and they've been happy ever since.

miguel


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




Re: [PHP] mysql error

2002-05-17 Thread Kevin Stone

The mysql_select_db() function is going to return a handle.  You need to
capture that handle and use it as the second parameter in your mysql_query()
function.  Although this is not required in certain cases where the server
automatically knows which database to work with, chances are thats whats
giving you the error.

Use like this..
$db = mysql_select_db();
mysql_query($query, $db);

-Kevin

- Original Message -
From: "Randum Ian" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Friday, May 17, 2002 11:45 AM
Subject: [PHP] mysql error


> Hi all,
>
> I have got this code but I can get it to work, it doesnt make sense!
>
> 
> 
>  $host="localhost";
>  $username="user";
>  $password="pass";
>  $database="admin";
>
>  $mysqlconnect = mysql_connect($host, $username, $password) or die
("Cannot
> connect to mySQL server, check it is running");
>
>  mysql_select_db($database, $mysqlconnect) or die ("Cannot connect to the
> database, check it is set right");
>
>  $result = mysql_query("SELECT * FROM user");
>
>  $count = mysql_num_rows($result);
>
>  $counted = number_format($count);
>
>  echo $counted;
>
>  ?>
> 
>
> but I am getting this error - "Warning: Supplied argument is not a valid
> MySQL result resource in /usr/home/e/a/eagadmin/public_html/main.php on
line
> 14" but I dont understand why!
>
> Can anyone help?
>
> Regards, Ian.
> ---
> Randum Ian
> DJ / Reviewer / Webmaster, DancePortal (UK) Limited
> [EMAIL PROTECTED]
> http://www.danceportal.co.uk
> DancePortal.co.uk - Global dance music media
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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




[PHP] Re: mysql error

2002-05-17 Thread Thomas Seifert

also try to:

echo mysql_error();

after the select-query, it will tell you what went wrong.

Thomas

On Fri, 17 May 2002 18:45:07 +0100
[EMAIL PROTECTED] (Randum Ian) wrote:

> Hi all,
> 
> I have got this code but I can get it to work, it doesnt make sense!
> 
> 
>  
>  $host="localhost";
>  $username="user";
>  $password="pass";
>  $database="admin";
> 
>  $mysqlconnect = mysql_connect($host, $username, $password) or die ("Cannot
> connect to mySQL server, check it is running");
> 
>  mysql_select_db($database, $mysqlconnect) or die ("Cannot connect to the
> database, check it is set right");
> 
>  $result = mysql_query("SELECT * FROM user");
> 
>  $count = mysql_num_rows($result);
> 
>  $counted = number_format($count);
> 
>  echo $counted;
> 
>  ?>
> 
> 
> but I am getting this error - "Warning: Supplied argument is not a valid
> MySQL result resource in /usr/home/e/a/eagadmin/public_html/main.php on line
> 14" but I dont understand why!
> 
> Can anyone help?
> 
> Regards, Ian.
> ---
> Randum Ian
> DJ / Reviewer / Webmaster, DancePortal (UK) Limited
> [EMAIL PROTECTED]
> http://www.danceportal.co.uk
> DancePortal.co.uk - Global dance music media
> 

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




RE: [PHP] PHP & PDF

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, James E. Hicks III wrote:
> I do a
> 
>system("html2ps SOME.html > SOME.pd");
> 
> then I do a
> 
>system("ps2pdf SOME.pd");

How about just:

   system('html2ps < some.html | ps2pdf > some.pdf');

?

miguel


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




[PHP] lists of headers

2002-05-17 Thread Joshua E Minnie

Can anybody tell me where I can find a list of all the possible headers that
I can use in the header function? I searched through the manual and can't
seem to find a list of headers.

I need to know what header it is that display an "authorization required" or
"forbidden" when my authentication fails.
--
Joshua E Minnie/CIO
[EMAIL PROTECTED]
"Don't work for recognition, but always do work worthy of recognition."



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




Re: [PHP] lists of headers

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, Joshua E Minnie wrote:
> Can anybody tell me where I can find a list of all the possible headers that
> I can use in the header function? I searched through the manual and can't
> seem to find a list of headers.

Everything's in the RFC.

http://www.w3.org/Protocols/rfc2616/rfc2616.html

miguel


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




Re: [PHP] Confused about which function to use with forms/database

2002-05-17 Thread Analysis & Solutions

Don:

> I have forms that retrieve date from mysql databases and send (for
> storage) data to same databases.  I note many functions to make sure
> that the data is correct in appearance when it comes to special
> characters.
> 
> addslashes()
> stripslashes()
> htmlspecialchars()
> htmlentities()
> get_html_translation_table(HTML_ENTITIES)
>
> When passing data from forms to database, which do I use?
> When retrieving data from database to display in forms, which do I use?

A question similar to this was just asked by Dennis
(Subject: Re: [PHP] forms into database and visa versa)

I'll copy the answer I gave there into here...

> It's a good idea to validate all data you're sticking in before you 
> do. For example, if you have a numeric field, you don't want the 
> person to be able to submit letters in that field.  So, always check 
> that the data is formatted the way you want it to be before sending it 
> to the database.
>
> I usually use preg_replace() to remove undesireable characters.
>
> If you want text to go into a field and want people to be able to 
> have quotes and other such items in there, then use addslashes().

But, it sounds like you're concerned about characters in the database
coming out properly in the HTML you generate.  So, if someone stored "<"
in the database, you want it to show up as "<" in your HTML.  That's 
what htmlspecialchars() is for.  Run your text coming OUT of the 
database through that.

Now, if you're then going to have users edit that data in a form and
resubmit it to the database, you need to convert the HTML entities back 
to standard ascii characters.  Here's a simple way to do that:

$replace['&']  = '&';
$replace['<']   = '<';
$replace['>']   = '>';
$replace['"'] = '"';

$UserInput = strtr($UserInput, $replace);


--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




Re: [PHP] Confused about which function to use with forms/database

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, Don wrote:
> I have forms that retrieve date from mysql databases and send (for
> storage) data to same databases.  I note many functions to make sure
> that the data is correct in appearance when it comes to special
> characters.
> 
> addslashes()
> stripslashes()
> htmlspecialchars()
> htmlentities()
> get_html_translation_table(HTML_ENTITIES)
> 
> I've read the documentation but am still confused about what to use when.
> 
> When passing data from forms to database, which do I use?
> When retrieving data from database to display in forms, which do I use?

The basic goal is that you don't want anything being sent to your 
database's command interpreter that would result in data being taken for 
commands.

So that means that when you're sending textual data, it should be 
surrounded by quotes and any quotes inside there should be escaped 
properly.

There are different ways to make sure this gets done, and to some degree 
it's a matter of preference.

Personally, I turn magic_quotes_runtime OFF because it really creates a 
lot more work than it saves.

Then I use intval() on every integer, floatval() on every floating-point 
number, and addslashes() on every string. Then I build the SQL statement.

htmlentities has nothing to do with database operations, but is
used when sending text to browsers that might contain characters like &, 
<, and >. It escapes those characters so that they'll be shown as intended 
rather than interpreted for their special HTML meanings.

miguel


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




[PHP] Avoiding 'page expired' warnings

2002-05-17 Thread Scott Graham

Hi

I've got a PHP powered site that involves some form submissions for searches

and when using the browser's 'back' button to return to the search results

page I get the horrible 'Page expired' warning due to the page being created

from variables sent in a form.

I know there is a way to avoid this problem because all search enabled

websites seem to manage to avoid it, but I don't know how.

Can anyone help?

I had thought using sessions would help but it makes no difference. Is this

something that can be avoided with PHP or does it require some client-side

stuff?

Thanks

Scott Graham, on behalf of Brian




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




Re: [PHP] Q:Anybody using PHP directly on Mac-OSX???

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, Marcus James Christian wrote:
> I love PHP but I haven't gotten deep into it because of the issue of
> needed to upload it to my hosts server to test it.
> 
> I'd love to get REALLY good with PHP, advanced shopping cart stuff, DB
> etc.  but I just know the way my mind works and unless its a simple one
> click to test it on my desktop,  well you know.
> 
> So, anybody out there have PHP installed on their local home desktop Mac
> OSX box able to test by a quick "preview in browser" from say an app
> like BBedit?

It comes ready-to-go. Just go to System Preferences, turn on Web Sharing 
(under "Sharing"), and you're running. Stick the pages in your Sites 
folder.

miguel


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




Re: [PHP] Avoiding 'page expired' warnings

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, Scott Graham wrote:
> I've got a PHP powered site that involves some form submissions for searches
> and when using the browser's 'back' button to return to the search results
> page I get the horrible 'Page expired' warning due to the page being created
> from variables sent in a form.
> 
> I know there is a way to avoid this problem because all search enabled
> websites seem to manage to avoid it, but I don't know how.
> Can anyone help?
> 
> I had thought using sessions would help but it makes no difference. Is this
> something that can be avoided with PHP or does it require some client-side
> stuff?

The simplest solution is to use GET rather than POST method in your forms.

miguel


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




RE: [PHP] PHP & PDF

2002-05-17 Thread James E. Hicks III

I've gotta be able to do either one. Sometimes the script just stops with the PS
and sends that in the email based on a flag. It depends on what format the
customer prefers his invoices in.

James

-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 2:02 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] PHP & PDF


On Fri, 17 May 2002, James E. Hicks III wrote:
> I do a
>
>system("html2ps SOME.html > SOME.pd");
>
> then I do a
>
>system("ps2pdf SOME.pd");

How about just:

   system('html2ps < some.html | ps2pdf > some.pdf');

?

miguel


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


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




Re: [PHP] apache redirect and request

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, Adrian Murphy wrote:
> my isp has set up an internal redirect that
> resolves  www.mysite.biz to www.mysite.com
> how can i check if the request was for the .biz version.

If it's really a redirect, then I don't think you can; the browser makes a
second request for www.mysite.com and by that time all knowledge of the
.biz request is gone. Have them just alias it instead.

miguel


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




[PHP] ob_start() and ob_gzhandler

2002-05-17 Thread Jason Soza

Just wondering what would cause the following:
I have a 512/128 cable connection through my ISP that I'm hosting my 
sites through. I have a 10gb/mo transfer limit (u/l and d/l) so when I 
saw mention of the ob_gzhandler (and mod_gzip for Apache), that kind of 
got me interested in it.

Anyway, I created a test page, put -just-  at the 
top, then some lines of HTML, and loaded it. I got all the HTML code 
displayed - shouldn't I have gotten a white screen since I had no  tag at the bottom? This isn't making sense. Then I tried 
 and  at the 
bottom - same results.

Am I doing something wrong? Shouldn't the ob_start() by itself just 
load all output into a buffer and not display it until I call ob_flush
()? And how would I know if ob_gzhandler works? I'm running PHP and 
Apache on Windoze, PHP is version 4.2.0 I think, Apache is 
1.3.something.

TIA

Jason Soza



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




Re: [PHP] Listing the contents of a directory in an array

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002 [EMAIL PROTECTED] wrote:
> I am a newbie so be kind
> 
> I have looked into the manual about directory functions etc.
> 
> I want to return all the files from a directory into a array.
> 
> Could some one give me a few pointers or something?
> 
> I keep getting confused but I have used google and the manual.
> 
> I can find functions but I am not sure how I can list the files into an array.

RTFM.

The very first user example in the manual page for readdir is "Here's a 
quick code snippet that will load the directory data into an array".

miguel


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




Re: [PHP] Q:Anybody using PHP directly on Mac-OSX???

2002-05-17 Thread Geoff Hankerson

This will just start Apache if I remember correctly. You still have to alter
the httpd.conf file.

Details for MacOSX php setup are here:
http://www.macdevcenter.com/pub/ct/49

php is covered in part III

- Original Message -
From: "Miguel Cruz" <[EMAIL PROTECTED]>
To: "Marcus James Christian" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, May 17, 2002 1:13 PM
Subject: Re: [PHP] Q:Anybody using PHP directly on Mac-OSX???


> On Fri, 17 May 2002, Marcus James Christian wrote:
> > I love PHP but I haven't gotten deep into it because of the issue of
> > needed to upload it to my hosts server to test it.
> >
> > I'd love to get REALLY good with PHP, advanced shopping cart stuff, DB
> > etc.  but I just know the way my mind works and unless its a simple one
> > click to test it on my desktop,  well you know.
> >
> > So, anybody out there have PHP installed on their local home desktop Mac
> > OSX box able to test by a quick "preview in browser" from say an app
> > like BBedit?
>
> It comes ready-to-go. Just go to System Preferences, turn on Web Sharing
> (under "Sharing"), and you're running. Stick the pages in your Sites
> folder.
>
> miguel
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] Re: Query/Error

2002-05-17 Thread Richard Creech

Anthony,
I find it is useful to write code such that every outcome, however remote, is handled 
by your code:

$query = "INSERT INTO ... blah ";
// pconnect, select and query
if ($link_identifier = mysql_pconnect(DBSERVERHOST, DBUSERNAME, DBPASSWORD)) {
if ( mysql_select_db(DBNAME, $link_identifier)) {
// run the query
$queryResultHandle = mysql_query($query, $link_identifier) or die( 
mysql_error() );
$rows = mysql_affected_rows($link_identifier);
// decide what to do with the results
switch( $rows ) {
case 0:
echo"Count for rows inserted is zero. No data was 
changed.\n";
break;
case 1:
// do something
break;
default:
echo"Process anomaly. Notify the webmaster.\n";
} // switch( $rows ) {
}else{ // select
echo mysql_error();
}
}else{ //pconnect
echo mysql_error();
}

The $rows handling will vary depending on the nature of your query:
mysql_num_rows()
mysql_affected_rows()


Kind Regards,

Richard Creech
[EMAIL PROTECTED]
250.744.3350 Pacific Time Canada
Dreamriver Software Powers the Net
http://www.dreamriver.com

}
Anthony wrote:  
Message-Id: <[EMAIL PROTECTED]>
Date: Fri, 17 May 2002 05:35:51 -0400
To: [EMAIL PROTECTED]
From: Anthony Rodriguez <[EMAIL PROTECTED]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed
Subject: Query/Error



What code can I add to the script to find out the error of the query?


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




Re: [PHP] ob_start() and ob_gzhandler

2002-05-17 Thread Robert Cummings

Jason Soza wrote:
> 
> Just wondering what would cause the following:
> I have a 512/128 cable connection through my ISP that I'm hosting my
> sites through. I have a 10gb/mo transfer limit (u/l and d/l) so when I
> saw mention of the ob_gzhandler (and mod_gzip for Apache), that kind of
> got me interested in it.
> 
> Anyway, I created a test page, put -just-  at the
> top, then some lines of HTML, and loaded it. I got all the HTML code
> displayed - shouldn't I have gotten a white screen since I had no  ob_flush(); ?> tag at the bottom? This isn't making sense. Then I tried
>  and  at the
> bottom - same results.
> 
> Am I doing something wrong? Shouldn't the ob_start() by itself just
> load all output into a buffer and not display it until I call ob_flush
> ()? And how would I know if ob_gzhandler works? I'm running PHP and
> Apache on Windoze, PHP is version 4.2.0 I think, Apache is
> 1.3.something.

If you don't manually flush a buffer I believe it auto flushes
when the preprocessor completes.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




RE: [PHP] Using php as a scripting language within cron jobs?

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, Dan Hardiker wrote:
>> from the cron I would call this command...
>>
>> wget -q -T10 http:/www.mydomain.com/myScript.php -0 /dev/null
> 
> This makes it highly insecure as anyone could execute it (unless you
> locked it down which is silly when you could just run it locally
> yourself). Also the data is going over HTTP which would easily be
> intercepted with ethereal / tcpdump etc. I still *strongly* recommend
> compiling a binary if only for purely security based precautionary
> reasons.

Your point about the script being web-accessible is crucial and sufficient 
reason for not doing things that way.

The tcpdump thing isn't much of a concern, because a connection to a local 
address will be shunted across lo0 (or whatever your loopback interface 
is called), and therefore can only be sniffed by someone with root access 
on that same machine.

miguel


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




Re: [PHP] PHP,CyberCash,Verisign,PayFlow

2002-05-17 Thread Baba Buehler

Analysis & Solutions wrote:
 > On Fri, May 17, 2002 at 10:27:50AM -0400, Analysis & Solutions wrote:
 >
 >>> Does this mean that if i want to start accepting credit cards on my
 >>> site i wont have to pay for a credit card merchant account?
 >>
 >> You betcha.
 >
 > Oh, Dear!  I didn't see the "wont" in there on the second line.  I
 > thought you were asking if you have to get an account.  So, I answered
 > affirmatively.
 >
 > As other have stated, you need to get (and pay for) accounts in order to
 > process cc's online (or anywhere, for that matter).


There are services that let you accept credit cards without going through
the trouble and expense of getting a merchant account.

The one I use is called CCNow (www.ccnow.com).  Their only restriction is 
that you must be selling something physical (eg not weekly access to your 
site or downloadable software).  They take something like 8% to cover their 
costs and mail you checks for the rest.

I had a merchant account and online CC processing service before this, and 
the cost was over $250/month for all the crap.  If you're low to medium 
volume, then commission based services like CCNow (I'm sure there are many 
others) are a viable way to go.


baba


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




[PHP] brain cramp, ouch!

2002-05-17 Thread Kelly Meeks

Ok

Let's say I'm querying a table, and looping thru the results:

$connect=mysql_connect(host,user,pass);
$thedb=mysql_select(database1);
$thequery="select * from foo";
$theresult=mysql_query($thequery) or die (mysql_error())
while ($output=mysql_fetch_assoc($theresult)){


do stuff here..

}

What if while I'm looping, I want to take the information I'm looping thru, and want 
to write it to completely different database, assuming that the same username and 
password info works for both databases?

Would you use multiple mysql_select_db statements, and then make refer. to the result 
of that select in your queries?

I'm getting errors when I do that.

Sorry to be so moronical,

K

Do I define



Re: [PHP] accessing mysql_fetch_array more than once?

2002-05-17 Thread Chris Knipe

Didn't do the trick

But it did point my towards mysql_data_seek, which did the job beautifully
:)

Thanks

--
me


- Original Message -
From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
To: "Chris Knipe" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, May 17, 2002 7:04 PM
Subject: Re: [PHP] accessing mysql_fetch_array more than once?


> reset()
>
> On Fri, 17 May 2002, Chris Knipe wrote:
>
> > Hi all,
> >
> > Howcome, when I do a SQL lookup, I can only access the array once?
> >
> > Say, I have...
> >
> >  > $SQL = mysql_query("SOME SELECT STATEMENT");
> > while ($var = mysql_fetch_array($SQL)) {
> >   echo $var['columbname'];
> > }
> >
> > // that works, and prints out the rows in the table
> > // my codes continues.
> >
> > ?>
> >
> > 
> >
> >  > while ($var = mysql_fetch_array($SQL)) {
> >   echo $var['columbname'];
> > }
> > // Now, the array doesn't print anything...
> > ?>
> >
> > --
> > me
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




Re: [PHP] Re: [PHP-DEV] Console application with PHP

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, D Lau wrote:
>> http://gtk.php.net/ and
>> http://www.php.net/manual/en/features.commandline.php for a
>
> Sorry, I forgot to say my requirement is to make this a browser only
> application.
> Would all these still works?

No, if you want highly interactive apps in a browser environment, you need 
to write for the browser. This means Java or Flash.

You cannot forcibly install PHP on other people's equipment, and in any 
case PHP does not have a browser interface. Other than the fact that 
they're most often used together via standard protocols, PHP and browsers 
have basically nothing to do with each other.

miguel


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




Re: [PHP] brain cramp, ouch!

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, Kelly Meeks wrote:
> Let's say I'm querying a table, and looping thru the results:
> 
> $connect=mysql_connect(host,user,pass);
> $thedb=mysql_select(database1);
> $thequery="select * from foo";
> $theresult=mysql_query($thequery) or die (mysql_error())
> while ($output=mysql_fetch_assoc($theresult)){
>do stuff here..
> }
> 
> What if while I'm looping, I want to take the information I'm looping
> thru, and want to write it to completely different database, assuming
> that the same username and password info works for both databases?
> 
> Would you use multiple mysql_select_db statements, and then make refer.
> to the result of that select in your queries?

You don't need to switch back and forth unless you're actually sending 
queries to a particular database. Your result sets remain valid. Just make 
sure you don't overwrite them by using the same variables!

mysql_select_db($db1);
$result1 = mysql_query($query1);
 .. .. ..
mysql_select_db($db2);
$result2 = mysql_query($query2);
// $result1 and $result2 are both valid here

miguel


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




Re: [PHP] brain cramp, ouch!

2002-05-17 Thread Robert Cummings

Kelly Meeks wrote:
> 
> Ok
> 
> Let's say I'm querying a table, and looping thru the results:
> 
> $connect=mysql_connect(host,user,pass);
> $thedb=mysql_select(database1);
> $thequery="select * from foo";
> $theresult=mysql_query($thequery) or die (mysql_error())
> while ($output=mysql_fetch_assoc($theresult)){
> 
> do stuff here..
> 
> }
> 
> What if while I'm looping, I want to take the information I'm looping thru,
> and want to write it to completely different database, assuming that the
> same username and password info works for both databases?
> 
> Would you use multiple mysql_select_db statements, and then make refer. to
> the result of that select in your queries?
> 
> I'm getting errors when I do that.
> 
> Sorry to be so moronical,

This is not moronical, it gets a lot of coders... what you need to do is
create another connection because the value returned from the mysql_connect
function is a resource identofier, which means if you run two queries on the
same connection the second result set will overwrite the first.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP] brain cramp, ouch!

2002-05-17 Thread Robert Cummings

Robert Cummings wrote:
> 
> Kelly Meeks wrote:
> >
> > Ok
> >
> > Let's say I'm querying a table, and looping thru the results:
> >
> > $connect=mysql_connect(host,user,pass);
> > $thedb=mysql_select(database1);
> > $thequery="select * from foo";
> > $theresult=mysql_query($thequery) or die (mysql_error())
> > while ($output=mysql_fetch_assoc($theresult)){
> >
> > do stuff here..
> >
> > }
> >
> > What if while I'm looping, I want to take the information I'm looping thru,
> > and want to write it to completely different database, assuming that the
> > same username and password info works for both databases?
> >
> > Would you use multiple mysql_select_db statements, and then make refer. to
> > the result of that select in your queries?
> >
> > I'm getting errors when I do that.
> >
> > Sorry to be so moronical,
> 
> This is not moronical, it gets a lot of coders... what you need to do is
> create another connection because the value returned from the mysql_connect
> function is a resource identofier, which means if you run two queries on the
> same connection the second result set will overwrite the first.

Or maybe it's just the result set var that needs to be unique... I don't
clearly remember since I have a pooling system that abstracts all this
mess for me :)

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP] ob_start() and ob_gzhandler

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, Jason Soza wrote:
> Am I doing something wrong? Shouldn't the ob_start() by itself just 
> load all output into a buffer and not display it until I call ob_flush
> ()?

Or when you get to the end of execution...

   http://php.net/ob_implicit_flush

miguel


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




[PHP] Strange behavior with imap, php and apache

2002-05-17 Thread Sergio Tirado


I just installed Red Hat 7.3 with Apache and PHP. I ran a simple script
to test the imap_open function and it doesn't work when using the 
values for servers on my subnet. 

http://www.gym.itesm.mx/imap.php

However, if the mailbox I request to open is on another server outside, it 
does work. 

The strange thing is that a friend of mine has the same script running on 
his server (http://pollux.icon.net.mx/~antonio/imap.php) and he can read
a mailbox from my subnet as well as any other.

When I run the script on my server and try to access a local mailbox I 
get the following error:

Warning: Couldn't open stream {www.gym.itesm.mx:143}INBOX in 
/home/campus/html/imap.php on line 5

I just don't know what could be wrong. Help is appreciated.

The script I'm using (comments added to avoid html rendering):

// ";
// echo "Password incorrecto";
// echo "";
// echo "";
// echo "Mailbox.: $mbx";
// echo "Cuenta..: $uid";
// echo "Password: $pwd";
// echo "Error...: "; echo imap_last_error();
// echo "";
// } else {
// echo "Password correcto: $mbx";
// imap_close($mbox);
// }
// }
// 
// if (!isset($mbx1)) $mbx1 = "{www.gym.itesm.mx:143}INBOX";
// if (!isset($uid1)) $uid1 = "gsoberon";
// if (!isset($pwd1)) $pwd1 = "mypass";
// 
// if (isset($test)) {
// test_imap($mbx1,$uid1,$pwd1);
// }
// 
// ?>
// 
// 
// 
// 
// 
// mailbox: 
// usuario: 
// passwd: 
// 
// 
// 
// 
// 
// 


--
Sergio Tirado 



Re: [PHP] ob_start() and ob_gzhandler

2002-05-17 Thread Jason Soza

Hmmm... So if I -wanted- to buffer the entire page using ob_gzhandler, 
I wouldn't use ob_implicit_flush(), correct? Or would this be 
beneficial in this case? The way I read the manual page on 
ob_implicit_flush() is that it flushes after each output call. Would 
that mean that ob_start("ob_gzhandler") would compress the output, then 
ob_implicit_flush() would display that compressed output at each call?

Either way, is there any way to tell if my output is really being 
compressed by ob_gzhandler?

Jason Soza

- Original Message -
From: Miguel Cruz <[EMAIL PROTECTED]>
Date: Friday, May 17, 2002 10:39 am
Subject: Re: [PHP] ob_start() and ob_gzhandler

> On Fri, 17 May 2002, Jason Soza wrote:
> > Am I doing something wrong? Shouldn't the ob_start() by itself 
> just 
> > load all output into a buffer and not display it until I call 
> ob_flush> ()?
> 
> Or when you get to the end of execution...
> 
>   http://php.net/ob_implicit_flush
> 
> miguel
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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




Re: [PHP] ob_start() and ob_gzhandler

2002-05-17 Thread Rasmus Lerdorf

You can just set output_handler in your php.ini file to automatically
buffer and compress everything.

On Fri, 17 May 2002, Jason Soza wrote:

> Hmmm... So if I -wanted- to buffer the entire page using ob_gzhandler,
> I wouldn't use ob_implicit_flush(), correct? Or would this be
> beneficial in this case? The way I read the manual page on
> ob_implicit_flush() is that it flushes after each output call. Would
> that mean that ob_start("ob_gzhandler") would compress the output, then
> ob_implicit_flush() would display that compressed output at each call?
>
> Either way, is there any way to tell if my output is really being
> compressed by ob_gzhandler?
>
> Jason Soza
>
> - Original Message -
> From: Miguel Cruz <[EMAIL PROTECTED]>
> Date: Friday, May 17, 2002 10:39 am
> Subject: Re: [PHP] ob_start() and ob_gzhandler
>
> > On Fri, 17 May 2002, Jason Soza wrote:
> > > Am I doing something wrong? Shouldn't the ob_start() by itself
> > just
> > > load all output into a buffer and not display it until I call
> > ob_flush> ()?
> >
> > Or when you get to the end of execution...
> >
> >   http://php.net/ob_implicit_flush
> >
> > miguel
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] Problem displaying certain text from a form on to the browser

2002-05-17 Thread Don

Hi,

On my form, I have a text area.  I was doing some testing and on one line, I entered 
the following:



When I looked at the results pages sent to the browser, that line was missing.  I 
think that the "<" character is the culprit. I've tried stripslashes() and 
htmlentities() but I cannot get that line to appear on the browser.  Any ideas?

Thanks,
Don


[PHP] 4.3.0 coming out?

2002-05-17 Thread Thalis A. Kalfigopoulos

Any hint from the developers as to when to expect 4.3.0?

cheers,
thalis


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




Re: [PHP] 4.3.0 coming out?

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, Thalis A. Kalfigopoulos wrote:
> Any hint from the developers as to when to expect 4.3.0?

Check the archives of this list, as it's been hinted at more than once in 
the past week or so.

miguel


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




Re: [PHP] Problem displaying certain text from a form on to the browser

2002-05-17 Thread Kevin Stone

Clearly  is being interpreted by the browser as an HTML tag.
Use htmlspecialchars() to encode these characters in the string.  Or find
and replace "<" with "<" and ">" with ">".
-Kevin

- Original Message -
From: "Don" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Friday, May 17, 2002 1:12 PM
Subject: [PHP] Problem displaying certain text from a form on to the browser


Hi,

On my form, I have a text area.  I was doing some testing and on one line, I
entered the following:



When I looked at the results pages sent to the browser, that line was
missing.  I think that the "<" character is the culprit. I've tried
stripslashes() and htmlentities() but I cannot get that line to appear on
the browser.  Any ideas?

Thanks,
Don



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




[PHP] $_FILES, file upoad and backslashes

2002-05-17 Thread BOb Pardoe

Please can anyone tell me how to cope with IE6 showing files after browsing
with http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Current URL is http or https?

2002-05-17 Thread Steven Walker

Hi,

I'm trying to find a way to determine whether a clients browser current 
url is prefixed by http or https. However, I cannot seem to find the 
right predefined variable to give me this information. Basically, I want 
the same thing that HTTP_REFERER provides, but for the _current_ page.

Any ideas?

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]


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




[PHP] Re: Current URL is http or https?

2002-05-17 Thread Philip Hallstrom

I would guess you want $_SERVER["SERVER_PROTOCOL"] which returns
"HTTP/1.1" for me and probably "HTTPS..." for https connections... also if
you're using apache I think it sets some SSL_* variables that exist only
when using https.

On Fri, 17 May 2002, Steven Walker wrote:

> Hi,
>
> I'm trying to find a way to determine whether a clients browser current
> url is prefixed by http or https. However, I cannot seem to find the
> right predefined variable to give me this information. Basically, I want
> the same thing that HTTP_REFERER provides, but for the _current_ page.
>
> Any ideas?
>
> Steven J. Walker
> Walker Effects
> www.walkereffects.com
> [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] Re: Current URL is http or https?

2002-05-17 Thread Steven Walker

Thanks! I got it:

$_SERVER['HTTPS'] == "on"

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]


On Friday, May 17, 2002, at 01:09  PM, Philip Hallstrom wrote:

> I would guess you want $_SERVER["SERVER_PROTOCOL"] which returns
> "HTTP/1.1" for me and probably "HTTPS..." for https connections... also 
> if
> you're using apache I think it sets some SSL_* variables that exist only
> when using https.
>
> On Fri, 17 May 2002, Steven Walker wrote:
>
>> Hi,
>>
>> I'm trying to find a way to determine whether a clients browser current
>> url is prefixed by http or https. However, I cannot seem to find the
>> right predefined variable to give me this information. Basically, I 
>> want
>> the same thing that HTTP_REFERER provides, but for the _current_ page.
>>
>> Any ideas?
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>



[PHP] Error compiling PHP-4.2.1 on linux

2002-05-17 Thread Scott Hurring

Hello everyone.

I have been using PHP since version 4.0.6 and always
compile from source.  I have not had a single problem
until now.  I'm trying to upgrade from php-4.1.2 to
php-4.2.1, and when i make install php-4.2.1, *any*
PHP page i access throws off a ton of errors that
i've never seen before.

I use the following ./configure options (i used the exact
same opts for 4.1.2 with no prob, and i know my system has
all the necessary libs and headers)

Any help is appreciated... google searches turned up nothing
on this, so i figured "who better to ask?"  :)  Thanks!!

./configure --enable-ftp --enable-memory-limit --enable-discard-path
--enable-wddx --enable-sockets --enable-force-cgi-redirect
--with-mysql=/usr/local/mysql/ --with-zlib --with-zlib-dir=../zlib/
--with-pear --with-openssl

This is what i get when trying to access *any* PHP page
(The specific page that threw these errors was )

Warning: Unexpected character in input: '' (ASCII=4) state=1 in
/usr/local/bin/php on line 3390

Warning: Unexpected character in input: ' in /usr/local/bin/php on line 3391

Warning: Unexpected character in input: '' (ASCII=4) state=1 in
/usr/local/bin/php on line 3391

Warning: Unexpected character in input: '' (ASCII=4) state=1 in
/usr/local/bin/php on line 3392

Warning: Unexpected character in input: '' (ASCII=27) state=1 in
/usr/local/bin/php on line 3393

Parse error: parse error, unexpected T_STRING in /usr/local/bin/php on line
3393

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

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




[PHP] $answers[answer$n]

2002-05-17 Thread Jule

Hey guys,
i'm getting this error whe i try to access this variable. $answers[answer$n]

Parse error: parse error, expecting `']'' in 
/home/blindtheory/web/quiz/add_quiz/add_quiz_process_2.php on line 36

the variable $answer[answers$n] comes from a form on the preceding page in 
which a number of answers has been entered. the number of answers is up to 
the user and can vary from 2 to 15. not the $n comes from a for loop whcih 
enteres the answers into a database since i do not know how many answers each 
user has used.

why am i getting this error?
and is there a way around it?
following is the for() loop in which this story takes place.

thanks
Jule

--SCRIPT--

for ($n = 1; $n <= $quiz[number_answers]; $n++) {
$table = "$quiz[code]_answers";
$value = "$answers[answer$n]";
$query_alter_table = "ALTER table $table ADD answer$n TEXT NUT 
NULL";
$query_add_answers = "INSERT INTO $table (answer$n) 
VALUES($value)";
if (mysql_db_query($database_glob, $query_alter_table, 
$link_glob) AND 
(mysql_db_query($database_glob, $query_add_answer, $link_glob));
echo "Answer $n has successfully been added to the 
Quiz\n";
} else { 
echo mysql_error();
}
echo "Click here to continue";
}

--SCRIPT--

-- 
|\/\__/\/|
|   Jule Slootbeek   |
|   [EMAIL PROTECTED]|
|   http://blindtheory.cjb.net   |
|   __   |
|/\/  \/\|

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




[PHP] passthru()

2002-05-17 Thread gamin

I have a PHP script that computes the URLs  to files that i need to
download. Is it possible to put  passthru() with wget in a while loop and
donwload multiple files at one time ? Or does passthru() complete the shell
command and then proceed.

Any other suggestions ?

thx in advance

gamin.



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




RE: [PHP] $answers[answer$n]

2002-05-17 Thread Scott Hurring

Try $answers["answer".$n]

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -Original Message-
> From: Jule [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 17, 2002 4:41 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] $answers[answer$n]
> 
> 
> Hey guys,
> i'm getting this error whe i try to access this variable. 
> $answers[answer$n]
> 
> Parse error: parse error, expecting `']'' in 
> /home/blindtheory/web/quiz/add_quiz/add_quiz_process_2.php on line 36
> 
> the variable $answer[answers$n] comes from a form on the 
> preceding page in 
> which a number of answers has been entered. the number of 
> answers is up to 
> the user and can vary from 2 to 15. not the $n comes from a 
> for loop whcih 
> enteres the answers into a database since i do not know how 
> many answers each 
> user has used.
> 
> why am i getting this error?
> and is there a way around it?
> following is the for() loop in which this story takes place.
> 
> thanks
> Jule
> 
> --SCRIPT--
> 
> for ($n = 1; $n <= $quiz[number_answers]; $n++) {
>   $table = "$quiz[code]_answers";
>   $value = "$answers[answer$n]";
>   $query_alter_table = "ALTER table 
> $table ADD answer$n TEXT NUT NULL";
>   $query_add_answers = "INSERT INTO 
> $table (answer$n) VALUES($value)";
>   if (mysql_db_query($database_glob, 
> $query_alter_table, $link_glob) AND 
> (mysql_db_query($database_glob, $query_add_answer, $link_glob));
>   echo "Answer $n has 
> successfully been added to the Quiz\n";
>   } else { 
>   echo mysql_error();
>   }
>   echo "Click here to continue";
> }
> 
> --SCRIPT--
> 
> -- 
> |\/\__/\/|
> |   Jule Slootbeek |
> |   [EMAIL PROTECTED]  |
> |   http://blindtheory.cjb.net |
> |   __ |
> |/\/\/\|
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




[PHP] Newbie - create image error URGENT

2002-05-17 Thread Dani

Hi everyone!

I'm still learning PHP and MYSQL using windows98, MYSQL, PHP 4 in my
local hard drive.

I want to learn uploading image and resizing image in my local machine.

when I execute this code:

http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Newbie - create image error URGENT

2002-05-17 Thread Scott Hurring

Probably don't have the GD extension enaabled.

On a win machine, it's easy, look in your php.ini
and set the extensions_dir to where your extensions
are then un-comment php_gd.dll

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -Original Message-
> From: Dani [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 17, 2002 7:40 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Newbie - create image error URGENT
> Importance: High
> 
> 
> Hi everyone!
> 
> I'm still learning PHP and MYSQL using windows98, MYSQL, PHP 4 in my
> local hard drive.
> 
> I want to learn uploading image and resizing image in my 
> local machine.
> 
> when I execute this code:
> 
>  //setup image
> $height = 200;
> $width = 200;
> 
> $im = ImageCreate($width,$height);
> $white = ImageCreateAllocate ($im, 255, 255, 255);
> $black = ImageCreateAllocate ($im, 0, 0, 0);
> 
> //Draw on image
> ImageFill($im, 0, 0, $black);
> ImageLine($im, 0, 0, $width, $height, $white);
> ImageString($im, 4, 50, 150, "Sales", $white);
> 
> //output image
> Header ("Content-type: image/png");
> ImagePng ($im);
> 
> //Clean up
> ImageDestroy($im);
> 
> I get error message: "Fatal error: Call to undefined function:
> imagecreate() in D:\graphic_practise\index.php on line 15"
> 
> What did I do wrong?
> 
> any advice/ help is greatly appriciated.
> 
> Thanks,
> 
> Ardani
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




[PHP] ADODB - whaddya think?

2002-05-17 Thread Jerome Houston

Testimonial time!

Despite ROCK STAR assistance from a PHP developer, I'm having troubles with 
mssql_*() functions.  most of the problems are gone (or being fixed by some 
AWESOME people), but to make use of those fixes, i've got to use php v 
4.3-dev.  and there's other bugs in that (as there should be).  so i've been 
looking for alternatives to using the mssql functions...  and i've found 
something that looks promising: ADODB.  for those of you who don't know, 
some people have just written some code that attempts (and looks as if it 
does a pretty good job) of unifying ODBC calls for lots of different 
databases.  their website: http://php.weblogs.com/ADODB

What i want to know is:  does anyone have experience with these libraries?  
I tested them briefly, and it seemed to work like a charm, but so did the 
mssql_*() functions, until i got into some of the nitty-gritty uses of the 
DB.  Will lots of little bugs come about, the more i use it?  or have they 
ironed most of that out?

thanks for your opinons, and i apologize for possibly spurring another 
loquacious debate amongst smart people :-)

-jerome

_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




RE: [PHP] ADODB - whaddya think?

2002-05-17 Thread Cal Evans

I've been using it for about 4 months and it's very stable.

=C=

*
* Cal Evans
* Journeyman Programmer
* Techno-Mage
* http://www.calevans.com
*


-Original Message-
From: Jerome Houston [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 4:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP] ADODB - whaddya think?


Testimonial time!

Despite ROCK STAR assistance from a PHP developer, I'm having troubles with
mssql_*() functions.  most of the problems are gone (or being fixed by some
AWESOME people), but to make use of those fixes, i've got to use php v
4.3-dev.  and there's other bugs in that (as there should be).  so i've been
looking for alternatives to using the mssql functions...  and i've found
something that looks promising: ADODB.  for those of you who don't know,
some people have just written some code that attempts (and looks as if it
does a pretty good job) of unifying ODBC calls for lots of different
databases.  their website: http://php.weblogs.com/ADODB

What i want to know is:  does anyone have experience with these libraries?
I tested them briefly, and it seemed to work like a charm, but so did the
mssql_*() functions, until i got into some of the nitty-gritty uses of the
DB.  Will lots of little bugs come about, the more i use it?  or have they
ironed most of that out?

thanks for your opinons, and i apologize for possibly spurring another
loquacious debate amongst smart people :-)

-jerome

_
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


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



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




[PHP] Kiev party (fwd)

2002-05-17 Thread Rasmus Lerdorf

Could someone who has a clue about this fill in Serg and the rest of the
folks on this list who might be interested?

-- Forwarded message --
Date: Fri, 17 May 2002 23:32:28 +0300
From: Serg Lysak <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Kiev party

Hello webmaster,

  Sorry for disturbance. But I have just read on your site
  (http://www.php.net/cal.php?id=393&cm=5&cy=2002) that tomorrow will
  be party of PHP developers in Kiev. I am from Kiev, so I am very
  interested in it, but there is no additional information about it on
  your site, so if it is possible, please, provide me with this
  information, or, please, give other contact information to someone
  from here who knows where and when party will take place (Kiev is
  big city ;-)

-- 
Best regards,
 Serg  mailto:[EMAIL PROTECTED]



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




RE: [PHP] Q:Anybody using PHP directly on Mac-OSX???

2002-05-17 Thread David Freeman


 > So, anybody out there have PHP installed on their local home 
 > desktop Mac OSX box able to test by a quick "preview in 
 > browser" from say an app like BBedit?

I went to:

http://www.google.com/

I entered the following into their dinky little search box:

mac osx apache mysql php installer

I got a total of 333 matches.  The first one is an article on
www.faqts.com about how to install php/mysql/apache on Mac OSX, the
thire is a pre-built binary for MySQL.

Google also asked if I actually meant to search for:

mac os x apache mysql php installer

So I clicked on that link and it resulted in 3600 matches.  The first
page of which included more matches which look relevant.

So, yes, it's possible.

A little research, and I feel I must stress the _LITTLE_ part, would
have you your answer.

CYA, Dave



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




RE: [PHP] Confused about which function to use with forms/database

2002-05-17 Thread David Freeman


 > I've read the documentation but am still confused about what 
 > to use when.
 > 
 > When passing data from forms to database, which do I use?
 > When retrieving data from database to display in forms, 
 > which do I use?

Kinda depends on what you're using the data for really.  If you don't
care about preserving formatting or any sort or keeping any html tags
that are included then strip the lot out before you drop it into your
database.  If you want to keep it all then you'll need to be more
selective.

As a general rule, though, you'll need to 'escape' anything that your
database won't like - this is typically the ' and " chars.  Addslashes()
will do that for you.  Anything else you want to do depends on what you
need the data for.

When you suck the data back out you'll obviously need to stripslashes()
to get rid of the 'escape' chars you added above.  Then you'll also need
to do any other processing required - for example, converting \n to 
if you're just displaying data on a page (nl2br()).  If you're actually
sucking that data back out to go into a textarea in a form or something
then you won't do that.

Unless you're particularly careful it's probably worth stripping out all
html tags anyway as they offer the potential to have someone include
scripting.  When displaying to a html page you probably also want to
convert special chars to html entities using htmlspecialchars().

I may have missed some stuff here, didn't bother looking at a manual
while writing this but I hope you'll get the idea.

CYA, Dave



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




RE: [PHP] Confused about which function to use with forms/database

2002-05-17 Thread Miguel Cruz

On Sat, 18 May 2002, David Freeman wrote:
> As a general rule, though, you'll need to 'escape' anything that your
> database won't like - this is typically the ' and " chars.  Addslashes()
> will do that for you.  Anything else you want to do depends on what you
> need the data for.
> 
> When you suck the data back out you'll obviously need to stripslashes()
> to get rid of the 'escape' chars you added above.

Nope, because the escape characters don't actually get added to the 
database.

If you have a string:

Chief O'Brien

and you want to pass it into a database whose command interpreter uses 
single quotes (') as string delimeters, then you need to tell it that the 
' after O is not the end of the string. So you use addslashes() to preface 
it with a backslash (\). This results in the following string:

Chief O\'Brien

When the database's command interpreter sees it, it removes the escape
character (\) before inserting the string into the database. So it's back
to its original form then. When you retrieve it, you'll just get:

Chief O'Brien

miguel


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




RE: [PHP] Confused about which function to use with forms/database

2002-05-17 Thread David Freeman


 > > When you suck the data back out you'll obviously need to 
 > > stripslashes() to get rid of the 'escape' chars you added above.
 > 
 > Nope, because the escape characters don't actually get added to the 
 > database.

 > When the database's command interpreter sees it, it removes 
 > the escape character (\) before inserting the string into 
 > the database. So it's back to its original form then. When 
 > you retrieve it, you'll just get:

Ah, fair enough.  Obviously, I've never actually tested that particular
behaviour.  I'll keep this in mind for future reference though.

CYA, Dave



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




[PHP] Alter table and add cell at a time.

2002-05-17 Thread Jule

a question:

if i have this:

for ($n = 1; $n <= $quiz[number_answers]; $n++) {
$table = $qcode."_answers";
$value = $answers["answer".$n];
$value2 = "answer".$n;

$query_alter_table = "ALTER TABLE $table ADD $value2 TEXT NOT NULL";
$query_add_answers = "INSERT INTO $table ($value2) VALUES('$value')";
if (mysql_db_query($database_glob, $query_alter_table, $link_glob)) {
if (mysql_db_query($database_glob, $query_add_answers, $link_glob)) {
echo "Answer $n: $value has successfully been added to the 
Quiz\n";
} else {
echo mysql_error() ." 1";
}
} else {
echo mysql_error()." 2";
}
}

How do I get the $value to be in the same row as the preceding one?
now it comes like this:
++-+-+-+-+

| id | answer1 | answer2 | answer3 | answer4 |

++-+-+-+-+

|  1 | answer1 | | | |
|  2 | | answer2 | | |
|  3 | | | answer3 | |
|  4 | | | | answer4 |

++-+-+-+-+

so it's like this?
++-+-+-+-+

| id | answer1 | answer2 | answer3 | answer4 |

++-+-+-+-+

|  1 | answer1 | answer2 | answer3 | answer4 |

++-+-+-+-+

thanks,

Jule

On Friday 17 May 2002 19:17, you wrote:
> Hello,
>
> Try using "NOT NULL".  As weird as MySQL can be, don't think it is that
> NUTty.  =)
>
> Harrison
>
> - Original Message -
> From: "Jule" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, May 17, 2002 7:00 PM
> Subject: "ALTER TABLE $table ADD $value2 TEXT NUT NULL"
>
>
> Hey i'm getting this error:
>
> You have an error in your SQL syntax near 'NUT NULL' at line 1
>
> when i run this query,
>
> "ALTER TABLE $table ADD $value2 TEXT NUT NULL"
>
> from the documentation i understood that this was the correct notation.
>
> any ideas?
> thanks
> Jule
> --
>
> |\/\__/\/|
> |   Jule Slootbeek |
> |   [EMAIL PROTECTED] |
> |   http://blindtheory.cjb.net |
> |   __ |
> |/\/   \/\|
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>
>
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]> Trouble
> unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

--

|\/\__/\/|
|   Jule Slootbeek   |
|   [EMAIL PROTECTED]|
|   http://blindtheory.cjb.net   |
|   __   |
|/\/  \/\|

---

-- 
|\/\__/\/|
|   Jule Slootbeek   |
|   [EMAIL PROTECTED]|
|   http://blindtheory.cjb.net   |
|   __   |
|/\/  \/\|

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




[PHP] HTTP_ACCEPT_LANGUAGE

2002-05-17 Thread Gerard Samuel

Im looking to know how to handle it.
HTTP_ACCEPT_LANGUAGE = en-us, en;q=0.75, th;q=0.50, yi;q=0.25
What are the 'q' values for?

Thanks...


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




Re: [PHP] Alter table and add cell at a time.

2002-05-17 Thread Miguel Cruz

update table set answer3=5 where id=2;

miguel

On Fri, 17 May 2002, Jule wrote:
> a question:
> 
> if i have this:
> 
> for ($n = 1; $n <= $quiz[number_answers]; $n++) {
>   $table = $qcode."_answers";
>   $value = $answers["answer".$n];
>   $value2 = "answer".$n;
> 
>   $query_alter_table = "ALTER TABLE $table ADD $value2 TEXT NOT NULL";
>   $query_add_answers = "INSERT INTO $table ($value2) VALUES('$value')";
>   if (mysql_db_query($database_glob, $query_alter_table, $link_glob)) {
>   if (mysql_db_query($database_glob, $query_add_answers, $link_glob)) {
>   echo "Answer $n: $value has successfully been added to the 
>Quiz\n";
>   } else {
>   echo mysql_error() ." 1";
>   }
>   } else {
>   echo mysql_error()." 2";
>   }
> }
> 
> How do I get the $value to be in the same row as the preceding one?
> now it comes like this:
> ++-+-+-+-+
> 
> | id | answer1 | answer2 | answer3 | answer4 |
> 
> ++-+-+-+-+
> 
> |  1 | answer1 | | | |
> |  2 | | answer2 | | |
> |  3 | | | answer3 | |
> |  4 | | | | answer4 |
> 
> ++-+-+-+-+
> 
> so it's like this?
> ++-+-+-+-+
> 
> | id | answer1 | answer2 | answer3 | answer4 |
> 
> ++-+-+-+-+
> 
> |  1 | answer1 | answer2 | answer3 | answer4 |
> 
> ++-+-+-+-+
> 
> thanks,
> 
> Jule
> 
> On Friday 17 May 2002 19:17, you wrote:
> > Hello,
> >
> > Try using "NOT NULL".  As weird as MySQL can be, don't think it is that
> > NUTty.  =)
> >
> > Harrison
> >
> > - Original Message -
> > From: "Jule" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, May 17, 2002 7:00 PM
> > Subject: "ALTER TABLE $table ADD $value2 TEXT NUT NULL"
> >
> >
> > Hey i'm getting this error:
> >
> > You have an error in your SQL syntax near 'NUT NULL' at line 1
> >
> > when i run this query,
> >
> > "ALTER TABLE $table ADD $value2 TEXT NUT NULL"
> >
> > from the documentation i understood that this was the correct notation.
> >
> > any ideas?
> > thanks
> > Jule
> > --
> >
> > |\/\__/\/|
> > |   Jule Slootbeek |
> > |   [EMAIL PROTECTED] |
> > |   http://blindtheory.cjb.net |
> > |   __ |
> > |/\/   \/\|
> >
> > -
> > Before posting, please check:
> >http://www.mysql.com/manual.php   (the manual)
> >http://lists.mysql.com/   (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
> > <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> >
> >
> >
> >
> >
> > -
> > Before posting, please check:
> >http://www.mysql.com/manual.php   (the manual)
> >http://lists.mysql.com/   (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
> > <[EMAIL PROTECTED]> Trouble
> > unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> --
> 
> |\/\__/\/|
> |   Jule Slootbeek |
> |   [EMAIL PROTECTED]  |
> |   http://blindtheory.cjb.net |
> |   __ |
> |/\/\/\|
> 
> ---
> 
> 


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




Re: [PHP] HTTP_ACCEPT_LANGUAGE

2002-05-17 Thread Miguel Cruz

On Fri, 17 May 2002, Gerard Samuel wrote:
> Im looking to know how to handle it.
> HTTP_ACCEPT_LANGUAGE = en-us, en;q=0.75, th;q=0.50, yi;q=0.25
> What are the 'q' values for?

How much they'd like to receive one of those other languages. The closer
the number is to 1, the more excited they are about it.

miguel


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




Re: [PHP] Q:Anybody using PHP directly on Mac-OSX???

2002-05-17 Thread Justin French

I haven't jumped ship to OSX yet (still on OS9), but I believe it's not far
away...  However, I don't know if I'd put my test server on the same box...
time will tell, but I prefer having my old clunker P133 box under the desk
running the same OS / Apache version / PHP version / MySQL version as but
ISP... it makes migrating from the test environment to the live environment
so easy.

If you can't get everything running on OSX, seriously look at an old Pentium
with either a windows or unix based OS.

As far as local testing, I have file-sharing set-up between the mac and the
unix box, so I save my files directly into the doc root (no FTP :)) and
command-tab across to my browser and hit reload.

I'm pretty sure you won't be able to hit "preview in browser" because PHP
has to be parsed by the server (http://localhost/dir/dir/file.php), rather
than as a file (file:///path/to/file.php).


Good luck,

Justin




on 18/05/02 3:03 AM, Marcus James Christian ([EMAIL PROTECTED])
wrote:

> Hello,
> 
> I love PHP but I haven't gotten deep into it because of the issue of
> needed to upload it to my hosts server to test it.
> 
> I'd love to get REALLY good with PHP, advanced shopping cart stuff, DB
> etc.  but I just know the way my mind works and unless its a simple one
> click to test it on my desktop,  well you know.
> 
> So, anybody out there have PHP installed on their local home desktop Mac
> OSX box able to test by a quick "preview in browser" from say an app
> like BBedit?
> 
> -Marcus
> 
> --
> ||
> |
> 
> Marcus Unlimited
> http://marcusunlimited.com
> Multimedia Internet Design and Education
> ||
> |
> 
> --
> | Limited Time Offer!
> | Download the Recordings of Chromaticus
> | FREE! @ http://ampcast.com/chromaticus
> | Complete song files and Sci-Fi Loops for
> | programs like Reason, Flash, Premiere
> | Logic, Cubase, Recycle, Acid, FruityLoops,
> | and many, many, more!!!
> 
> 


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




[PHP] mktime()

2002-05-17 Thread Josh Edwards

After reading the manual Istill can't convert this
09/May/2002 to a timestamp.

Any Pointers



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




Re: [PHP] mktime()

2002-05-17 Thread Rasmus Lerdorf

A couple of ways to do it:

strtotime('09 May 2002');

mktime(12,0,0,5,9,2002);


On Sat, 18 May 2002, Josh Edwards wrote:

> After reading the manual Istill can't convert this
> 09/May/2002 to a timestamp.
>
> Any Pointers
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] character conversion problem

2002-05-17 Thread darcy w . christ

hi,

   i'm in a bit of a bind and i'm hoping someone can help me.  i'm 
working on a project in which some data was saved into a postgresql 
database.  It was copied from quark express and entered through a php 
interface.  Unfortunately some of the records have a strange character 
encoding.  For example, apostrophes were converted to %u2019.  All the 
charactes seenm to begin with %u and have 4 numbers after that.  i've 
seen this kind of thing in word documents.  i don't know what it is, but 
i think it's the extended ascii character set.  Anyway, i'm not sure 
what to do about it.  i would like to find a way to convert this to 
simple ascii permanently or else find a way for it to display correctly 
in html and i'm hoping to do this in php.  i would also like to find a 
way to prevent this from creeping into the system.  i'm sorry i don't 
understand the problem well enough, and i'm sorry if i'm using the wrong 
words to describe this problem.  Anyway i really appreciate the help.


~darcy w. christ
1000camels in a courtyard


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




[PHP] Feelin' dumb...

2002-05-17 Thread Jason Soza

Okay, I'm apologizing right now for this, but I hope it's at least
tolerable. I have this:

for ($i=1; $i<=$num_pages; $i++) {
// print stuff here
}

For each loop, I want to add 20 to $i, so after the first iteration, I have
21, then 41, 61, etc. I've tried $i+20, $i + 20, I've tried looking in the
manual, but I assume this is some C-type function, and I'm not familiar with
C!

Any helpers?

Jason Soza


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




Re: [PHP] Feelin' dumb...

2002-05-17 Thread Jule

try,

for ($i=1; $i<=$num_pages; $i = $i + 20) {
}


or try,

$i = 1;
while ($i<=$num_pages) {
//text here
$i = $i + 20;
}

I got those little problems too all the time..
and the boards/lists always help.
Jule

On Friday 17 May 2002 23:19, you wrote:
> Okay, I'm apologizing right now for this, but I hope it's at least
> tolerable. I have this:
>
> for ($i=1; $i<=$num_pages; $i++) {
>   // print stuff here
>   }
>
> For each loop, I want to add 20 to $i, so after the first iteration, I have
> 21, then 41, 61, etc. I've tried $i+20, $i + 20, I've tried looking in the
> manual, but I assume this is some C-type function, and I'm not familiar
> with C!
>
> Any helpers?
>
> Jason Soza

--

|\/\__/\/|
|   Jule Slootbeek   |
|   [EMAIL PROTECTED]|
|   http://blindtheory.cjb.net   |
|   __   |
|/\/  \/\|

---

-- 
|\/\__/\/|
|   Jule Slootbeek   |
|   [EMAIL PROTECTED]|
|   http://blindtheory.cjb.net   |
|   __   |
|/\/  \/\|

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




Re: [PHP] Feelin' dumb...

2002-05-17 Thread Richard Baskett

Hmm... Wouldn¹t you just do this?:

for ($i=1; $i<=$num_pages; $i+20) {
  // print stuff here
}

Rick

"The vision must be followed by the venture. It is not enough to stare up
the steps - we must step up the stairs." - Vance Havner

> From: "Jason Soza" <[EMAIL PROTECTED]>
> Date: Fri, 17 May 2002 19:19:28 -0800
> To: <[EMAIL PROTECTED]>
> Subject: [PHP] Feelin' dumb...
> 
> Okay, I'm apologizing right now for this, but I hope it's at least
> tolerable. I have this:
> 
> for ($i=1; $i<=$num_pages; $i++) {
> // print stuff here
> }
> 
> For each loop, I want to add 20 to $i, so after the first iteration, I have
> 21, then 41, 61, etc. I've tried $i+20, $i + 20, I've tried looking in the
> manual, but I assume this is some C-type function, and I'm not familiar with
> C!
> 
> Any helpers?
> 
> Jason Soza
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] Feelin' dumb...

2002-05-17 Thread Jule

would that work?

isn't $i++; abbr. for $i = $i + 1;

so now the $i + 20; doens't declare anything.

just like $i += $b; is abbr. $i = $i + $b;

Jule.


On Friday 17 May 2002 23:14, you wrote:
> Hmm... Wouldn¹t you just do this?:
>
> for ($i=1; $i<=$num_pages; $i+20) {
>   // print stuff here
> }
>
> Rick
>
> "The vision must be followed by the venture. It is not enough to stare up
> the steps - we must step up the stairs." - Vance Havner
>
> > From: "Jason Soza" <[EMAIL PROTECTED]>
> > Date: Fri, 17 May 2002 19:19:28 -0800
> > To: <[EMAIL PROTECTED]>
> > Subject: [PHP] Feelin' dumb...
> >
> > Okay, I'm apologizing right now for this, but I hope it's at least
> > tolerable. I have this:
> >
> > for ($i=1; $i<=$num_pages; $i++) {
> > // print stuff here
> > }
> >
> > For each loop, I want to add 20 to $i, so after the first iteration, I
> > have 21, then 41, 61, etc. I've tried $i+20, $i + 20, I've tried looking
> > in the manual, but I assume this is some C-type function, and I'm not
> > familiar with C!
> >
> > Any helpers?
> >
> > Jason Soza
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php

-- 
|\/\__/\/|
|   Jule Slootbeek   |
|   [EMAIL PROTECTED]|
|   http://blindtheory.cjb.net   |
|   __   |
|/\/  \/\|

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




RE: [PHP] Feelin' dumb...

2002-05-17 Thread Jason Soza

Well, I tried that but the page doesn't finish loading... I.e. a script that
normally doesn't take more than a second to load just sits there. With $i++,
everything's fine - with $i+20, the browser says it's loading, but all I
have is a white screen for about 30 seconds... Then it times out.

-Original Message-
From: Richard Baskett [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 7:15 PM
To: Jason Soza; PHP General
Subject: Re: [PHP] Feelin' dumb...


Hmm... Wouldn¹t you just do this?:

for ($i=1; $i<=$num_pages; $i+20) {
  // print stuff here
}

Rick

"The vision must be followed by the venture. It is not enough to stare up
the steps - we must step up the stairs." - Vance Havner

> From: "Jason Soza" <[EMAIL PROTECTED]>
> Date: Fri, 17 May 2002 19:19:28 -0800
> To: <[EMAIL PROTECTED]>
> Subject: [PHP] Feelin' dumb...
>
> Okay, I'm apologizing right now for this, but I hope it's at least
> tolerable. I have this:
>
> for ($i=1; $i<=$num_pages; $i++) {
> // print stuff here
> }
>
> For each loop, I want to add 20 to $i, so after the first iteration, I
have
> 21, then 41, 61, etc. I've tried $i+20, $i + 20, I've tried looking in the
> manual, but I assume this is some C-type function, and I'm not familiar
with
> C!
>
> Any helpers?
>
> Jason Soza
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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


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




Re: [PHP] character conversion problem

2002-05-17 Thread Tom Rogers

Hi
That looks like UTF-8 encoding and I think you will need the iconv 
extension installed to convert it easily.
Tom



At 12:56 PM 18/05/2002, darcy w.christ wrote:
>hi,
>
>   i'm in a bit of a bind and i'm hoping someone can help me.  i'm working 
> on a project in which some data was saved into a postgresql database.  It 
> was copied from quark express and entered through a php 
> interface.  Unfortunately some of the records have a strange character 
> encoding.  For example, apostrophes were converted to %u2019.  All the 
> charactes seenm to begin with %u and have 4 numbers after that.  i've 
> seen this kind of thing in word documents.  i don't know what it is, but 
> i think it's the extended ascii character set.  Anyway, i'm not sure what 
> to do about it.  i would like to find a way to convert this to simple 
> ascii permanently or else find a way for it to display correctly in html 
> and i'm hoping to do this in php.  i would also like to find a way to 
> prevent this from creeping into the system.  i'm sorry i don't understand 
> the problem well enough, and i'm sorry if i'm using the wrong words to 
> describe this problem.  Anyway i really appreciate the help.
>
>
>~darcy w. christ
>1000camels in a courtyard
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>


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




RE: [PHP] Feelin' dumb...

2002-05-17 Thread Craig Vincent

> For each loop, I want to add 20 to $i, so after the first
> iteration, I have
> 21, then 41, 61, etc. I've tried $i+20, $i + 20, I've tried looking in the
> manual, but I assume this is some C-type function, and I'm not
> familiar with
> C!

Well this is a bit of a detour from the other suggestions however since you
haven't gotten a successful solution yet how about

for ($i=1; $i<=$num_pages; $i++) {
$number = ($i * 20) + 1;
// print stuff here
}

The results would be $number = 21 on first run, then 41, then 61 etc (which
I believe is what you are looking for).  Note the parenthesis in the $number
line are not needed however I typically code with them as it makes it easier
to understand the code with less though =)

Sincerely,

Craig Vincent



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




Re: [PHP] Feelin' dumb...

2002-05-17 Thread Richard Baskett

I apologize :)  yes you need to do this:

for ($i=1; $i<=$num_pages; $i=$i+20) {
  echo "$i - is i";
}

Make sure $num_pages is set though.. If not it wont work you'll just get a
blank white page.  Yes I did some testing *hehe*  It worked beautifully when
$num_pages is set though..

Rick

"The human mind is not capable of grasping the Universe. We are like a
little child entering a huge library. The walls are covered to the ceilings
with books in many different tongues. The child knows that someone must have
written these books. It does not know who or how. It does not understand the
languages in which they are written. But the child notes a definite plan in
the arrangement of the books---a mysterious order which it does not
comprehend, but only dimly suspects." - Albert Einstein

> From: Jule <[EMAIL PROTECTED]>
> Date: Fri, 17 May 2002 23:23:25 -0400
> To: Richard Baskett <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> Subject: Re: [PHP] Feelin' dumb...
> 
> for ($i=1; $i<=$num_pages; $i+20) {
>>   // print stuff here
>> }


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




Re: [PHP] Feelin' dumb...

2002-05-17 Thread Tom Rogers

Hi
What you need is
for ($i=1; $i<=$num_pages; $i+=20) {
   // print stuff here
}

Tom

At 01:19 PM 18/05/2002, Jason Soza wrote:
>Okay, I'm apologizing right now for this, but I hope it's at least
>tolerable. I have this:
>
>for ($i=1; $i<=$num_pages; $i++) {
> // print stuff here
> }
>
>For each loop, I want to add 20 to $i, so after the first iteration, I have
>21, then 41, 61, etc. I've tried $i+20, $i + 20, I've tried looking in the
>manual, but I assume this is some C-type function, and I'm not familiar with
>C!
>
>Any helpers?
>
>Jason Soza
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




RE: [PHP] Feelin' dumb...

2002-05-17 Thread Jason Soza

Thanks Craig, that worked!

I wonder why the other suggestions weren't working. They seemed logical
enough, I even tried variations of your suggestion, first I tried:

for ($i=1; $i<=$num_pages; $number = $i + 20) {}

That wasn't working, still was getting the 30 second timeout. Then I tried:

for ($i=1; $i<=$num_pages;) { $number = $i + 20; }

Since the manual says any of the expressions can be left blank. That still
executed beyond the 30 seconds and timed out.

Anyways, your suggestion is MUCH faster! Thanks for everyone's help -

Jason

-Original Message-
From: Craig Vincent [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 7:36 PM
To: Jason Soza; [EMAIL PROTECTED]
Subject: RE: [PHP] Feelin' dumb...


> For each loop, I want to add 20 to $i, so after the first
> iteration, I have
> 21, then 41, 61, etc. I've tried $i+20, $i + 20, I've tried looking in the
> manual, but I assume this is some C-type function, and I'm not
> familiar with
> C!

Well this is a bit of a detour from the other suggestions however since you
haven't gotten a successful solution yet how about

for ($i=1; $i<=$num_pages; $i++) {
$number = ($i * 20) + 1;
// print stuff here
}

The results would be $number = 21 on first run, then 41, then 61 etc (which
I believe is what you are looking for).  Note the parenthesis in the $number
line are not needed however I typically code with them as it makes it easier
to understand the code with less though =)

Sincerely,

Craig Vincent



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


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




RE: [PHP] Feelin' dumb...

2002-05-17 Thread Craig Vincent

> I wonder why the other suggestions weren't working. They seemed logical
> enough, I even tried variations of your suggestion, first I tried:
>
> for ($i=1; $i<=$num_pages; $number = $i + 20) {}
> for ($i=1; $i<=$num_pages;) { $number = $i + 20; }

The problem with these two statements was that the loop would be indefinate.
Without the third option $i is never incremented (unless you manually
increment it from within the loop).  So with your examples $i would always
be 1 and would therefore always be <= $num_pages unless $num_pages was zero
or negative.

Sincerely,

Craig Vincent



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




RE: [PHP] Feelin' dumb...

2002-05-17 Thread Jason Soza

Makes sense. Thanks!

Now... I have this little problem:
if ($num_pages >= 2) {
for ($i=1; $i<=$num_pages; $i++) {
$number = ($i * 20) + 1;
$page = $i+1;
printf("| Page %s | ", $number, $page);
}
}

I want $page to be $i + 1, but when I do $page = $i+1;, $i somehow gets
evaluated into the for() loop and an additional iteration is completed. So
basically if I do it this way, I get I'll get 1, 21, 41, when really only 1
and 21 are valid. If I put in $page = $i++; it works correctly, but $i is 1
when I want it to be two. If I take out $page = and put in $i where $page is
in the printf() statement, I get the extra iteration again. Any ideas?

-Original Message-
From: Craig Vincent [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 7:56 PM
To: Jason Soza; [EMAIL PROTECTED]
Subject: RE: [PHP] Feelin' dumb...


> I wonder why the other suggestions weren't working. They seemed logical
> enough, I even tried variations of your suggestion, first I tried:
>
> for ($i=1; $i<=$num_pages; $number = $i + 20) {}
> for ($i=1; $i<=$num_pages;) { $number = $i + 20; }

The problem with these two statements was that the loop would be indefinate.
Without the third option $i is never incremented (unless you manually
increment it from within the loop).  So with your examples $i would always
be 1 and would therefore always be <= $num_pages unless $num_pages was zero
or negative.

Sincerely,

Craig Vincent



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


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




Re: [PHP] Feelin' dumb...

2002-05-17 Thread Richard Baskett

What do you want the output to look like?  I did this:

$num_pages =120;

if ($num_pages >= 2) {
for ($i=1; $i<=$num_pages; $i+=20) {
 $page = $i+1;
printf("| Page %s | ", $number, $page);
}
}

And got this:

| Page 2 | | Page 22 | | Page 42 | | Page 62 | | Page 82 | | Page 102 |

Rick

"If a man is called to be a streetsweeper, he should sweep streets even as
Michelangelo painted, or Beethoven composed music, or Shakespeare composed
poetry. He should sweep streets so well that all the hosts of heaven and
earth will pause to say, "Here lived a great streetsweeper who did his job
well." - Dr. Martin Luther King, Jr.

> From: "Jason Soza" <[EMAIL PROTECTED]>
> Date: Fri, 17 May 2002 20:09:55 -0800
> To: <[EMAIL PROTECTED]>
> Subject: RE: [PHP] Feelin' dumb...
> 
> Makes sense. Thanks!
> 
> Now... I have this little problem:
> if ($num_pages >= 2) {
> for ($i=1; $i<=$num_pages; $i++) {
> $number = ($i * 20) + 1;
> $page = $i+1;
> printf("| Page %s | ", $number, $page);
> }
> }
> 
> I want $page to be $i + 1, but when I do $page = $i+1;, $i somehow gets
> evaluated into the for() loop and an additional iteration is completed. So
> basically if I do it this way, I get I'll get 1, 21, 41, when really only 1
> and 21 are valid. If I put in $page = $i++; it works correctly, but $i is 1
> when I want it to be two. If I take out $page = and put in $i where $page is
> in the printf() statement, I get the extra iteration again. Any ideas?
> 
> -Original Message-
> From: Craig Vincent [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 17, 2002 7:56 PM
> To: Jason Soza; [EMAIL PROTECTED]
> Subject: RE: [PHP] Feelin' dumb...
> 
> 
>> I wonder why the other suggestions weren't working. They seemed logical
>> enough, I even tried variations of your suggestion, first I tried:
>> 
>> for ($i=1; $i<=$num_pages; $number = $i + 20) {}
>> for ($i=1; $i<=$num_pages;) { $number = $i + 20; }
> 
> The problem with these two statements was that the loop would be indefinate.
> Without the third option $i is never incremented (unless you manually
> increment it from within the loop).  So with your examples $i would always
> be 1 and would therefore always be <= $num_pages unless $num_pages was zero
> or negative.
> 
> Sincerely,
> 
> Craig Vincent
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




RE: [PHP] Feelin' dumb...

2002-05-17 Thread Jason Soza

When I use that, here:

if ($num_pages >= 2) {
for ($i=1; $i<=$num_pages; $i+=20) {
echo "$i";
}
}

I get 1, or whatever I set $i= in the first expression. No other iterations.
When I use Craig's way, it works - kinda. Based on what I'm using this code
in, I should get two iterations. I'm counting the number of rows from my DB,
dividing it by 20, that's the number of pages I have - currently I have 22
records, so 2 pages. Here's what I use for that:

$sql = mysql_query("SELECT * FROM table");
$num_rows = mysql_num_rows($sql);
$num_pages = ceil($num_rows/20);

So why would I only get 1 iteration? 22/20 = 1.2 rounded up to 2. This
satisfies the if ($num_pages >= 2) statement and initiates the loop. $i
starts as 1, then should loop once more. If I set $i=0, I echo 0. What
gives?

I may not be able to answer anymore tonight, have to DJ for 4 hours
beginning in about 35 minutes, so I need to get ready for that, but
certainly anymore ideas would be great. Thanks!

-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 7:40 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Feelin' dumb...


Hi
What you need is
for ($i=1; $i<=$num_pages; $i+=20) {
   // print stuff here
}

Tom

At 01:19 PM 18/05/2002, Jason Soza wrote:
>Okay, I'm apologizing right now for this, but I hope it's at least
>tolerable. I have this:
>
>for ($i=1; $i<=$num_pages; $i++) {
> // print stuff here
> }
>
>For each loop, I want to add 20 to $i, so after the first iteration, I have
>21, then 41, 61, etc. I've tried $i+20, $i + 20, I've tried looking in the
>manual, but I assume this is some C-type function, and I'm not familiar
with
>C!
>
>Any helpers?
>
>Jason Soza
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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


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




Re: [PHP] ob_start() and ob_gzhandler

2002-05-17 Thread Jason Wong

On Saturday 18 May 2002 02:48, Jason Soza wrote:

> Either way, is there any way to tell if my output is really being
> compressed by ob_gzhandler?

If you have NN4.X use view source, if the source is empty then compression is 
active.

If you're using some form of un*x then:

  lynx --mime_header http://www.domain.com/page.php

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

/*
If only God would give me some clear sign!  Like making a large deposit
in my name at a Swiss Bank.
- Woody Allen
*/


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




<    1   2   3   >