Re: [PHP] printing in HTML or PHP

2002-03-18 Thread John Steele

  PHP doesn't have to parse this string (since it contains no PHP variables, why pass 
it through the parser?), and it's easier to read:

echo 'link rel=stylesheet type=text/css href=default.css';

On Monday, March 18, 2002, at 02:57  PM, Daniel Ferreira Castro wrote:

I would like to print the line bellow on my HTML generated by a PHP file.
How can I do it?

The line is:
link rel=stylesheet type=text/css href=default.css

?php

print link rel=\stylesheet\ type=\text/css\ href=\default.css\ /;

?

E

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */


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




[PHP] PHP 4.12 Locally, Deploy to Multiple Versions

2002-03-12 Thread John Steele

Hello,

  I develop locally on win9x, and deploy to everything from 3.0.18 to 4.1.2 remotely 
(Linux/*nix/Raq/Solaris/FreeBSD).  So I need to keep register_globals true on this 
development machine.  But, I've found since 4.0.5 and up, that $PHP_SELF is set, but 
*EMPTY*.

  I just deleted the last 4.1.1 official win install because of this same problem.  
Before I download and install 4.1.2 I figure I'd see if this is still a issue.  Anyone 
have any insight on this?

  I could stick with 4.0.2 (where this still works), but PEAR seems to have some 
syntactical issues with this version, and I'd really like to start 
incorporating/contributing with/to it.

  Hunting down all my code that uses $PHP_SELF is unfortunately not even feasible, 
it's too spread out by now.  I can't take the chance of breaking so many installations.

Thanks in advance for any help/suggestions,
  John

--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */


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




[PHP] Filemaker Pro 5.5

2002-02-25 Thread John Steele

Hello,

  I'm wondering if anyone here has had experience interfacing to FM on an NT box.  Any 
gotcha's to look out for?  They don't want to be stuck with something as closed as ASP 
with several non-MS platforms to support.  It's the Unlimited edition, I *assume* it 
has ODBC support (didn't find that info on their website).

  If it does include ODBC, it should be as simple as this:

1. Install PHP binary on the NT4 SP6 box
2. Configure IIS to use PHP *cgi* on .php pages?
3. Create a system DSN to the appropriate databases
4. PHP odbc_ calls to read/update tables

  I'd appreciate anybody's input on this setup as I also haven't had experience with 
IIS in this manner.

Thanks,
  John

--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

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




Re: [PHP] Using 'Location' and variables

2002-02-20 Thread John Steele

Hi Jim,

  There are several ways to accomplish this such as flat files, database records, 
sessions, and the like.  But I prefer to simply include a file (or have the one file 
do both form display and processing) and then you get all your variables:

if ($REQUEST_METHOD == 'POST') {
  // either do you processing and diplay here, or
  include './destination.php';  // with access to all posted vars
  }
else {
  // display your form
  }

  Remember that header() requires a FULLY QUALIFIED DOMAIN NAME and path:

header(Location: http://www.somehost.com/somescript.php;);

and that it is a GET ($REQUEST_METHOD == 'GET').  The fact that some web servers will 
display the page anyway is no reason to depend on that.

  For PHP4+ of course you can use $_SERVER['REQUEST_METHOD'] instead.

HTH,
  John

I'm sure that this is possible, but I haven't found any info/examples on it
yet,..

What I have is a php script that processes data that been submitted by a
FORM.

That's OK,...

At the end of my script, depending upon the processing, I want to GOTO
another php script, that's also OK, I can simply use the function

header(Location:destination.php);

However, I have a whole lot of variables that were initially submitted, and
I want to take some of them with me when I go to the new destination.php.

Now, I know I can just tack them on the end like a POST, but I'd prefer to
NOT get them there in the URL, like a GET does,... any ideas ??

Thanks in advance,

Jim.

--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

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




Re: [PHP] Using 'Location' and variables

2002-02-20 Thread John Steele

Hi Jim,

  The header() function call you use below IS doing a GET.  Maybe if you told us why 
you need to redirect to this new page might help.  Simply doing the processing then 
including the new page should work fine, as long as the processing part doesn't do any 
output.  A simple example:

if ($REQUEST_METHOD == 'POST') {
  if (!isset($name))
echo Please enter your name!;  // content here or
  else
require 'http://www.somehost.com/somescript.php'; // $name  $age set
  }

John

Thanks for your reply John.

In fact I'm using the method you describe where the same script is used to
both display and process the form.

However, in the area where I'm doing the processing, I want to redirect at
the end of it and still be able to use some of the variables in the location
I'm going to go to. Now I know I can just whack them on the end of the
location header:

header(Location:
http://www.somehost.com/somescript.php?name=fredage=5;);

But I don't want to use this method, I'd rather something similar to GET.

BTW I'm using PHP4+

Jim.

John Steele [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Jim,

   There are several ways to accomplish this such as flat files, database
records, sessions, and the like.  But I prefer to simply include a file (or
have the one file do both form display and processing) and then you get all
your variables:

 if ($REQUEST_METHOD == 'POST') {
   // either do you processing and diplay here, or
   include './destination.php';  // with access to all posted vars
   }
 else {
   // display your form
   }

   Remember that header() requires a FULLY QUALIFIED DOMAIN NAME and path:

 header(Location: http://www.somehost.com/somescript.php;);

 and that it is a GET ($REQUEST_METHOD == 'GET').  The fact that some web
servers will display the page anyway is no reason to depend on that.

   For PHP4+ of course you can use $_SERVER['REQUEST_METHOD'] instead.

 HTH,
   John

 I'm sure that this is possible, but I haven't found any info/examples on
it
 yet,..
 
 What I have is a php script that processes data that been submitted by a
 FORM.
 
 That's OK,...
 
 At the end of my script, depending upon the processing, I want to GOTO
 another php script, that's also OK, I can simply use the function
 
 header(Location:destination.php);
 
 However, I have a whole lot of variables that were initially submitted,
and
 I want to take some of them with me when I go to the new destination.php.
 
 Now, I know I can just tack them on the end like a POST, but I'd prefer
to
 NOT get them there in the URL, like a GET does,... any ideas ??
 
 Thanks in advance,
 
 Jim.
--
/* SteeleSoft Consulting     John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

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




Re: [PHP] Using 'Location' and variables

2002-02-20 Thread John Steele

Hi Jim,

  Glad that it makes sense now.  In fact, the other page may not even need to exist.  
Instead of including a seperate page, you could simply display the output from within 
this same form script.  I find this extremely useful in combination with a templating 
system.

Happy coding,
  John

John,

I never even thought of just including the page I was wanting to
redirect/switch to. I was always ending my processing portion with a
header(Location : ) thingy in all of my scripts. As no output comes
out during the processing stage it should all work.

It seems so straight forward now, thank you.

Jim.

 Hi Jim,

   The header() function call you use below IS doing a GET.  Maybe if you
told us why you need to redirect to this new page might help.  Simply doing
the processing then including the new page should work fine, as long as the
processing part doesn't do any output.  A simple example:

 if ($REQUEST_METHOD == 'POST') {
   if (!isset($name))
 echo Please enter your name!;  // content here or
   else
 require 'http://www.somehost.com/somescript.php'; // $name  $age set
   }

 John

 Thanks for your reply John.
 
 In fact I'm using the method you describe where the same script is used
to
 both display and process the form.
 
 However, in the area where I'm doing the processing, I want to redirect
at
 the end of it and still be able to use some of the variables in the
location
 I'm going to go to. Now I know I can just whack them on the end of the
 location header:
 
 header(Location:
 http://www.somehost.com/somescript.php?name=fredage=5;);
 
 But I don't want to use this method, I'd rather something similar to GET.
 
 BTW I'm using PHP4+
 
 Jim.
 
  Hi Jim,
 
There are several ways to accomplish this such as flat files,
database
 records, sessions, and the like.  But I prefer to simply include a file
(or
 have the one file do both form display and processing) and then you get
all
 your variables:
 
  if ($REQUEST_METHOD == 'POST') {
// either do you processing and diplay here, or
include './destination.php';  // with access to all posted vars
}
  else {
// display your form
}
 
Remember that header() requires a FULLY QUALIFIED DOMAIN NAME and
path:
 
  header(Location: http://www.somehost.com/somescript.php;);
 
  and that it is a GET ($REQUEST_METHOD == 'GET').  The fact that some
web
 servers will display the page anyway is no reason to depend on that.
 
For PHP4+ of course you can use $_SERVER['REQUEST_METHOD'] instead.
 
  HTH,
John
 
  I'm sure that this is possible, but I haven't found any info/examples
on
 it
  yet,..
  
  What I have is a php script that processes data that been submitted by
a
  FORM.
  
  That's OK,...
  
  At the end of my script, depending upon the processing, I want to GOTO
  another php script, that's also OK, I can simply use the function
  
  header(Location:destination.php);
  
  However, I have a whole lot of variables that were initially
submitted,
 and
  I want to take some of them with me when I go to the new
destination.php.
  
  Now, I know I can just tack them on the end like a POST, but I'd
prefer
 to
  NOT get them there in the URL, like a GET does,... any ideas ??
  
  Thanks in advance,
  
  Jim.
--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

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




RE: [PHP] php.jobs

2002-02-01 Thread John Steele

Hi Boaz,

  Personally, I found the jobs list at weberdev much more useful when you could list 
all jobs by date descending, as opposed to the seperated by country links.  Anyway 
that might be put back someday?

Thanks for a great PHP resource site,
  John

You can check out http://www.weberdev.com.

There is both a Jobs Section and a projects section where people are
looking for developers to do projects for them.

Sincerely

  berber

Visit http://www.weberdev.com Today!!! 
To see where PHP might take you tomorrow.


-Original Message-
From: Brian Williams [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 12:16 AM
To: [EMAIL PROTECTED]
Subject: [PHP] php.jobs


Hi,

Where can I find a list of PHP Jobs (help wanted)?

Thanks,
Brian

--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: getting a LAMP job in this economy

2002-01-24 Thread John Steele

Mike,

  While I sure hope you are right, could you please try to send the message to this 
list only once (i.e. check your To: to make sure you aren't doubling up on the list 
address).

  I might add to your comments the recent security problems with almost every one of 
M$ internet products - not that I'm complaining, it does generate some consulting 
business for me on the client side :)

Thanks,
  John

We're all in a good position right now.  The economy is beginning a strong
rebound, the pretenders have been weeded out, and a lot of companies are now
beginning to see both the technical AND financial benefits of open-source
technology.  No buying licenses for server systems that provide less
stability and a lot more fluff (draw your own conclusions from that :) ).
Open source systems may require a little more configuration and actual
effort to get off the ground, but if done right they will stay where you put
them instead of crashing back down and validating Newton's law of gravity.

Finding a LAMP job (or something including any of those components) will
become easier as the positions become more plentiful.  Come March you'll see
a noticeable change.  Please mark my words :)

Mike Frazer
--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] What version did $PHP_SELF still work?

2001-11-15 Thread John Steele

Hello,

  I'm trying this again with a different header.  After installing PHP4.0.6 $PHP_SELF 
is set (empty), and this is breaking many scripts of mine (and others).  I can't seem 
to find any mention of this in the commented manual, or anywhere else for that matter.

  I can try and install an earlier version, but I'm not sure which one (I'd like to 
use DBG though).  I'd hate to have to go back to 4.0.2!

Any advice welcome!
  John
--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Books for PHP and MySQL Class

2001-11-15 Thread John Steele

Hi Richard,

  _PHP4 A Beginner's Guide_ is geared especially to first-time programmers...

John

Chris Lott wrote:

 I'll be teaching a web development class in the Spring in which I plan to
 focus on PHP and MySQL as primary tools. These will be students who have
 experience with HTML And web design, but most will have no experience with
 programming at all.
 
 I need recommendations for book(s) that will serve as decent primers... I
 expect that the PHP book will have enough of the fundamentals of
 programming to set them on the right path...

I'm biased, but the PHP 4 Bible book is good. :-)

The Luke and Laura book (Welling and Thompson) is probably even better for 
that, given that they teach 200 grad students per quarter at Melbourne 
Royal Institute of Technology...

But none of the PHP books are really geared as Programming 101 
textbooks...  Plan on spending a considerable amount of lecture time off 
the book about programming in general.

Luke and Laura gave a great talk at the San Diego OS Conference about using 
PHP in the classroom, so get those slides if you can, and suck up to them a 
lot since they've been there. :-)

 Any suggestions for a MySQL book would be great. If both were in one book,
 even better!

The New Riders MySQL book by Paul DuBois is the one to go for if you opt 
for a separate MySQL book.

PS  I'm available as a guest lecturer :-)

-- 
Like music?  http://l-i-e.com/artists.htm

--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] What version did $PHP_SELF still work?

2001-11-15 Thread John Steele

Hi Mike and Jim,

  From my earlier message [Re: PHP 4.0.6 $PHP_SELF empty?]:

  No, I updated my php.ini manually (just to change the zend optimizer and
add the DBG debugger.  These two lines from php.ini haven't changed for sure:

variables_order = EGPCS;
register_globals = On;

  According to phpinfo, $PHP_SELF is set, but simply empty!

  I'm fully aware of the scope issues, and $GLOBALS[PHP_SELF] returns the same thing 
as $PHP_SELF (= ''), and these aren't withing classes, functions or anything like 
that.  It's as simple as this not working in somefile.php:

form action=?php echo $PHP_SELF ? method=POST
  input ...
/form

  I've looked over every single line in my php.ini, the only thing changed (checked 
with diff) is adding the debugger info for DBG.  That doesn't do it either, I replaced 
it with my original from PHP4.0.2, no go either.

Help!
  John

$PHP_SELF still works fine, just make sure that register_globals is on.

Also, don't forget that you must define global $PHP_SELF if you need to 
use it within a function, like so:

function foo() {
global $PHP_SELF;
}

Mike

John Steele wrote:

Hello,

  I'm trying this again with a different header.  After installing PHP4.0.6 
$PHP_SELF is set (empty), and this is breaking many scripts of mine (and 
others).  I can't seem to find any mention of this in the commented manual, 
or anywhere else for that matter.

  I can try and install an earlier version, but I'm not sure which one (I'd 
like to use DBG though).  I'd hate to have to go back to 4.0.2!

Any advice welcome!
  John

--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] %20

2001-11-14 Thread John Steele

Hi Oosten,

  I don't think that's a bug in NS 4.7, but part of the spec for URLs.  See the PHP 
manual for the urlencode() encode function.

John

Hello

I just discovered a netscape 4.7 bug when sending a string. The variable
cannot contain a space.  So a string like this does not work in netscape 4.7

objectdetail.php?Bouw=variableObject_type=normalStreet_type=normal
street.

The variable Street_type doesn't get through netscape 4.7, but IE and
Netscape 6 do let the variable through.


Is there a way to automatically let a spacer fill with %20 so it works at
all browsers and i don't have to reprogram my system?


Thanks!



Sjoerd van Oosten 
Digitaal vormgever [EMAIL PROTECTED]
Datamex E-sites B.V. 
http://www.esites.nl
Minervum 7368 Telefoon: (076) 5 730 730 
4817 ZH BREDA Telefax: (076) 5 877 757 
___

--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP 4.0.6 $PHP_SELF empty?

2001-11-14 Thread John Steele

Hello,

  I just updated to v4.0.6 on win9x.  Suddenly all my form-action scripts using 
$PHP_SELF quit working, as it's empty.  Anyone know how to fix this?

Thanks,
  John
--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP 4.0.6 $PHP_SELF empty?

2001-11-14 Thread John Steele

Hi David,

  No, I updated my php.ini manually (just to change the zend optimizer and add the DBG 
debugger.  These two lines from php.ini haven't changed for sure:

variables_order = EGPCS;
register_globals = On;

  According to phpinfo, $PHP_SELF is set, but simply empty!
John

 Hello,

   I just updated to v4.0.6 on win9x.  Suddenly all my form-action
 scripts using $PHP_SELF quit working, as it's empty.  Anyone know how
 to fix this?

 Thanks,
   John

Presumably in the process your php.ini was updated? Check umm, I think it 
is register_globals

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   I flatly deny this, said Tom under pressure.

--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] for loop problem?

2001-11-13 Thread John Steele

Tyler,

  It must be something weird with your NT version of MySQL, you might try asking on 
the MySQL list, or checking the bug list on mysql.com.  I have an even older version 
here on 95, that doesn't display any of those problems.

  Here's the code I used with it's output (no duplicates, I checked).  Notice that I 
did have to change the CREATE TABLE to meet 3.21.29a-gamma restrictions.

  You might try changing the passcode to an int, and tacking the 'P' on the front in 
your application.  Not sure if that's possible...

  John

?php /* testdb.php */

/*
Win95 OSR2, Xitami v2.4d6
PHP Version 4.0.2, Zend Engine v1.0.2, Zend Optimizer v0.99
MySQL Version: MySQL 3.21.29a-gamma
  MyISAM only - Max key length is 256 = 11 + 245

CREATE DATABASE testdb;

CREATE TABLE passcodes (
  id int(11) NOT NULL auto_increment,
  passcode varchar(255) NOT NULL default '',
  PRIMARY KEY (id),
  KEY idpass (id,passcode(245))
  );
*/

error_reporting(E_ALL);
set_time_limit (0);

if (!$connection = mysql_connect('localhost','root','*'))
  die (Can't connect to server: . mysql_error());

if (!$db = mysql_select_db('testdb', $connection))
  die (Can't select database testdb: . mysql_error());

if (!mysql_query(DELETE FROM passcodes))
  die ('Delete Failed: '. mysql_error());

$value1 = 100;
$value2 = 1223109;
for($i=$value1; $i=$value2; $i++) {
  if (!mysql_query(INSERT INTO passcodes (passcode) VALUES ('P$i')))
die (INSERT failed at $i: .mysql_error());
  }
echo 'INSERTs completed.brbr';

if (!$qid = mysql_query(SELECT id,passcode FROM passcodes ORDER BY passcode DESC 
LIMIT 10))
  die (SELECT failed: . mysql_error());

while ($arr = mysql_fetch_array($qid))
  echo $arr[0]: $arr[1]br\n;

if (!mysql_close($connection))
  die (Can't close connection: . mysql_error());
?

And it's output:

INSERTs completed.

223110: P1223109
223109: P1223108
223108: P1223107
223107: P1223106
223106: P1223105
223105: P1223104
223104: P1223103
223103: P1223102
223102: P1223101
223101: P1223100


Hi John,

MySQL Version: MySQL 3.23.44-nt

SQL:
CREATE TABLE passcodes (
  id int(11) NOT NULL auto_increment,
  passcode varchar(255) NOT NULL default '',
  PRIMARY KEY  (id),
  KEY id (id,passcode)
) TYPE=MyISAM;

I'm beginning to think it's a MySQL problem also because this PHP SHOULD
work.

Tyler

- Original Message -
From: John Steele [EMAIL PROTECTED]
To: PHP General List [EMAIL PROTECTED]
Sent: Monday, November 12, 2001 3:33 PM
Subject: Re: [PHP] for loop problem?


 Hi Tyler,

   This doesn't sound like a problem with PHP, but MySQL.  Can you show
your CREATE TABLE and MySQL version?

 John

 Hi Martin,
 
 I just got done doing that, and i got the same thing!  :-(
 
 Here's something interesting though.  There's an id field that's set to
 AUTO_INCREMENT.  I did a SELECT * FROM passcodes WHERE
passcode='P100'
 This gave me this:
 
 id | passcode
 ---
 1   |P100
 82145   |P100
 209398 |P100
 
 Shouldn't the ID's be further apart than that?  Know what I'm saying?
 
 Tyler
 
 - Original Message -
 From: Martin Towell [EMAIL PROTECTED]
 To: 'Tyler Longren' [EMAIL PROTECTED]; Jack Dempsey
 [EMAIL PROTECTED]
 Cc: PHP-General [EMAIL PROTECTED]
 Sent: Monday, November 12, 2001 10:45 PM
 Subject: RE: [PHP] for loop problem?
 
 
  How about changing the logic lightly? try this:
 
  $value1 = 0;
  $value2 = 223109;
  for($i=$value1; $i=$value2; $i++) {
   $tmp = sprintf(1%06d\n, $i);
   mysql_query(INSERT INTO passcodes (passcode) VALUES ('P$tmp'));
 
  basically taking away 1,000,000 from the numbers then adding it back on
  later
 
  Martin T
 
  -Original Message-
  From: Tyler Longren [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, November 13, 2001 3:38 PM
  To: Jack Dempsey
  Cc: PHP-General
  Subject: Re: [PHP] for loop problem?
 
 
  I've ran it a few times without the MySQL code in there.  Runs just
fine
  that way for me too.  After it's run a few times for me (with the MySQL
  code), I start getting duplicate entries of codes in there.  For
example,
  I'll end up with a few 'P100' entries in the 'passcodes' field.
 
  Oh well, here I come perl!
 
  Thanks,
  Tyler
 
  - Original Message -
  From: Jack Dempsey [EMAIL PROTECTED]
  To: Tyler Longren [EMAIL PROTECTED];
[EMAIL PROTECTED]
  Sent: Monday, November 12, 2001 10:43 PM
  Subject: RE: [PHP] for loop problem?
 
 
   ran it (without mysql queries) and worked finereal strange.
   have you tried the loop without the mysql queries?
  
   -Original Message-
   From: Tyler Longren [mailto:[EMAIL PROTECTED]]
   Sent: Monday, November 12, 2001 11:28 PM
   To: Jack Dempsey; [EMAIL PROTECTED]
   Subject: Re: [PHP] for loop problem?
  
  
   Exact code:
   ?
   $connection = mysql_connect(host_here,user_here,pass_here);
   $db = mysql_select_db(db_here, $connection);
   $value1 = 100;
   $value2 = 1223109;
   for($i=$value1; $i=$value2; $i++) {
mysql_query(INSERT

Re: [PHP] Problems with headers in redirect

2001-11-13 Thread John Steele

Hi Richy,

  Try sending the content header before the location header:

header(Content-type: image/jpeg);
header(Location: http://yourhost.com/yourfile.jpg;);

HTH,
  John

Hi, I'm hoping someone can help me with this one...

I'm doing redirects to various types of file (Flash, Office, DWF etc) and 
have found a problem with IE5.

I pass the script a document ID, and it retrieves the document record from 
a database, which stores the location of the file on the web server, and 
redirects the browser to the document.

What happens is that the browser gets redirected, but doesn't get the 
content-type header, and subsequently can't display the document.

Until yesterday I was using javascript redirection, which worked fine. 
However for other reasons (ie that didn't work with IE 5.5 or IE6) I had to 
change to using the header(Location: ) way.

Only work around I can see is to do the redirection based on browser type 
(i.e. one way for IE5, the other for IE5.5/IE6) but thats messy.

Any other ideas???

Richy

--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: $QUERY_STRING

2001-11-13 Thread John Steele

Hi Ernesto,

  Try taking a look at the HTTP_SERVER_VARS array:

test.php?1

HTTP_SERVER_VARS[argc] = 1
HTTP_SERVER_VARS[argv] = array([0] = test)


XPerience the new windows (scary!) :)
  John


Nop. getenv(QUERY_STRING) also returns an empty string.
The crazy thing is that getenv returns an empty string instead of FALSE.
Anyway, if I do index.php?a=1, I get HTTP_GET_VARS['a']==1, but 
$QUERY_STRING is still empty :(


dav wrote:

 Try getenv() function to import the query string from apache ambient.
 This is not a bug, maybe the index.php?1 isn't standard at all.

 Ernesto [EMAIL PROTECTED] ha scritto nel messaggio
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
Hi,

I'm a newbie using Apache 1.3.22 and PHP 4.0.6 on Windows.
I'm trying to access the $QUERY_STRING var, but it's empty even when I
do have a query string. On one server (Win2K), it works ok. On the other
server (WinXP) it's always empty.
If I use index.php?s=1, $HTTP_GET_VARS['s'] is 1, but I need the raw
query string because it's something like index.php?1.

Is this a known bug on PHP/WinXP?

Regards,
Ernesto

--
/* SteeleSoft Consulting     John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] for loop problem?

2001-11-12 Thread John Steele
=Arial size=2.mysql_error()./font;
   exit;
  }
 }
 mysql_close($connection);
 ?

 That should give you some better results.


 On Monday 12 November 2001 07:32 pm, you wrote:
  Hello everyone,
 
  I have a pretty big list of codes that need to be put into a
mysql
  db.
The
  numbers range from 100 to 1223109.  Here's the PHP I wrote
to
  put
these
  codes into a database:
 
  ?
  $connection = mysql_connect(blah,blah,blah);
  $db = mysql_select_db(db_to_use, $connection);
  $value1 = 100;
  $value2 = 1223109;
  for($i=$value1; $i=$value2; $i++) {
   mysql_query(INSERT INTO passcodes (passcode) VALUES ('P$i'));
   if (mysql_error() != ) {
print font face=Arial size=2.mysql_error()./font;
exit;
   }
  }
  mysql_close($connection);
  ?
 
  Everytime I run this from a browser, it just keeps looping.  It
  should
put
  about 223109 entries into the passcodes table.  However, it
just
   keeps
  looping.  I'll end up with 400,000 or so entries before I stop
it.
  I
make
  sure I empty that table before I start running it again.  Why is
  this
  happening?
 
  Thanks everyone,
  Tyler

--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] header(Location: ...) correct implementation

2001-11-04 Thread John Steele

Hello,

  After seeing multiple message concerning the Location response-header using relative 
URI's, and having to change this in multiple open-source projects, I'd like to point 
out that the correct behaviour only allows ABSOLUTE URI's.

  This may work on certain clients with a relative URI, but should NOT be depended on!

As per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14 :

14.30 Location

The Location response-header field is used to redirect the recipient to a location 
other than the Request-URI for completion of the request or identification of a new 
resource.
For 201 (Created) responses, the Location is that of the new resource which was 
created by the request. For 3xx responses, the location SHOULD indicate the server's
preferred URI for automatic redirection to the resource. The field value consists of a 
single absolute URI. 

   Location   = Location : absoluteURI

An example is: 

   Location: http://www.w3.org/pub/WWW/People.html

I.E. header(Location: mypage.php) should not be used...

Just my .02 US dollars,
  John

[Settings]
NoSplashScreen=1
UseDialup=0
UseWinSock=1
OffLine=0
[EMAIL PROTECTED]
PrinterFont=Courier New

LastSettingsCategory=3
RealName=John Steele
MailboxSuperclose=1
EmptyTrashOnQuit=1
PrinterFontSize=8
SavePassword=1
SMTPServer=mail.earthlink.net
TextAsDoc=0
[EMAIL PROTECTED]
CheckForMailEvery=20
MainWindowState=1
SendMIME=1
SendUuencode=0
SendBinHex=0
AutoReceiveAttachmentsDirectory=C:\Download
TabsInBody=0
UseQP=0
MAPIUseEudora=0
CtrlArrows=1
LasOptionsCategory=8
MAPIUseNever=0
FingerDefault=0
ShowProgress=1
URLHelper=E:\PROGRA~1\NETSCAPE\COMMUN~1\PROGRAM\NETSCAPE.EXE
MAPIUseAlways=1
EasyOpen=0
MAPIDeleteNever=1
MAPIDeleteTrash=0
AutoOKTimeout=20
ScreenFontSize=9
Alert=0
NewMailSound=E:\Program Files\Qualcomm\Eudora Mail\Gotmail.wav
AsyncDatabase=0
AsyncWinsock=0
SuccessfulSend=1
ExpandNickname=1
UserSignatures=1
Signature=STANDARD
CheckMailByDefault=1
LeaveMailOnServer=0
MailboxShowLabel=0
WarnQuitWithQueued=1
WarnEmptyTrash=0
AutoExpandNicknames=1
LastOptionsCategory=14
RegistrationFlag=-1
MailboxShowServerStatus=0
GuessParagraphs=0
IncludeHeaders=0
NicknameLastActivePropertyPage=0
WarnDeleteUnread=0
AutoOK=1
RunBefore=1
MailboxShowPriority=1
FilterReport=0
DefaultMailto=1
WarnDefaultMailto=1
AutoAttachedDeleteNever=1
AutoAttachedDeleteTrash=0
WarnDeleteUnsent=0
LoginName=johnsteele
PopServer=mail.earthlink.net
CurrentTipOfTheDay=2
SeenPlugins=x515x
LastWindowMax=0
ReplyToAll=0
CopyPriority=0
ScreenFontBaseSize=1
ShowToolBar=1
MailboxPreviewPane=0
RasCloseAfterDone=0
AutoConnection=1
AutoConnectionName=Earthlink
RasCloseOnExit=0
AutomationEnabled=1
WordWrap=0
ShowMailboxLines=1
ShowCategoryIcons=1
ShowCoolBars=0
UseBidentAlways=0
SendPlainAndStyled=0
SendPlainOnly=1
FixedDateFormat=%2 %1 %4
Commercial32Version=16
NicknameViewByIndex=0
PersonaViewNameWidth=165
PersonaViewAccountWidth=200
TaskStatusStateWidth=118
TaskStatusStatusWidth=249
TaskStatusProgressWidth=293
ShowTipOfTheDay=0
MessageFontBaseSize=1
SenderTimeDisplay=1
LocalTimeDisplay=0
RegistrationFreeFlag=-1
ShowStatusBar=1
ShowMDITaskbar=0
UseProportionalAsDefault=0
TaskWarnOnClose=0
PrinterFontBaseSize=1
WarnQueueStyledText=0
SendStyledOnly=0
ShowStyledTextToolbar=0
OpenInMailbox=0
InlineMapiTextAttachment=1
TaskMgrWaitTime=2
TaskStatusPersonaWidth=83
WarnLaunchProgram=1
Fumlub=0
DragSelectMessages=1
PlainArrows=0
AltArrows=0
DomainQualifier=
ImapDirectoryPrefix=
Stationery=
LeaveOnServerDays=0
BigMessageThreshold=40960
IMAPMaxDownloadSize=0
AuthenticateKerberos=0
AuthenticateAPOP=0
AuthenticateRPA=0
UsesIMAP=0
UsesAOL=0
UsesPOP=1
AuthenticatePassword=1
DeleteMailFromServer=0
ServerDelete=0
SkipBigMessages=0
IMAPMinDownload=1
IMAPOmitAttachments=0
IgnoreMixedCase=1
SuggestPhoneticSpellings=1

[Mappings]
in=txt,,TEXT,text,plain
out=txt,ttxt,TEXT,text,plain
both=vem,,,voice,voice-e-mail
out=mcw,MSWD,WDBN,application,msword
in=xls,XCEL,,,
out=xls,XCEL,XLS4,,
both=xlc,XCEL,XLC3,,
both=xlm,XCEL,XLM3,,
both=xlw,XCEL,XLW,,
both=ppt,PPT3,SLD3,,
both=wav,SCPL,WAVE,audio,microsoft-wave
both=grp,,,application,microsoft-group
both=wri,,,application,microsoft-write
both=cal,,,application,microsoft-calendar
both=zip,pZIP,pZIP,application,zip
both=rtf,MSWD,TEXT,application,rtf
both=pdf,,,application,pdf
both=ps,,,application,postcript
in=eps,,EPSF,,
out=eps,dPro,EPSF,application,postscript
both=jpg,JVWR,JPEG,image,jpeg
out=jpeg,JVWR,JPEG,image,jpeg
both=jfif,JFIF,JPEG,image,jpeg
both=gif,JVWR,GIFf,image,gif
both=tif,JVWR,TIFF,image,tiff
both=mpg,mMPG,MPEG,video,mpeg
both=mpeg,mMPG,MPEG,video,mpeg
both=mov,TVOD,MooV,video,quicktime
both=qt,TVOD,MooV,video,quicktime

out=1st,ttxt,TEXT,text,plain
both=aif,SCPL,AIFF,,
both=arc,arc*,mArc,,
both=arj,DArj,BINA,,
out=asc,ttxt,TEXT,text,plain
out=asm,ttxt,TEXT,text,plain
both=au,SCPL,ULAW,,
out=bas,ttxt,TEXT,text,plain
out=bat,ttxt,TEXT,text,plain
out=bga,JVWR,BMPp,,
both=bmp,JVWR,BMPp,,
out=c,ttxt,TEXT,text,plain
both=cgm,GKON,CGMm,,
out=cmd,ttxt

Re: [PHP] LINE BREAK HELL

2001-11-02 Thread John Steele

Hello René,

  The problem is the implode() function call (you are telling it concatenate all of 
the lines into one).  This is not tested, but try replacing:

 $fcontents_string = implode('', $fcontents);

 $fp = fopen($name..db, w+);
 fwrite($fp,$fcontents_string);

  with:

for ($i=0; $i = count($fcontents); $i++)
  fwrite($fp, $fcontents[$i]);

HTH,
  John

This problem has been driving me insane.  I have a little script that let's
users enter data into a form, which then gets appended to a file (table) as
a line (row).  The adding part of the script works fine--and by remembering
to add a \n at the end of each row, when the file (table) is read, PHP
automagically figures out that each line is actually a row (thanks to the
\n), and organizes the array accordingly (each line becoming an element in
the array).  The file thus displays fine.  So far, so good.

The problem arrises when I try to update a row (line) in the table (file).
The good:  The line break character  \n at the end of row being updated
DOES get written properly.  The bad:  The line break characters for all the
other rows of the table (which I'm not trying to update) disappear and/or
CHANGE to a different, inscrutable character (square) when the whole
array-turn-string gets written to the file.

I realize this is confusing without the example code, so here it is...

THE TABLE (FILE.DB) BEFORE THE UPDATE

19 Oct 2001, 17:56|Movie|War and Peace|800||Ready|redoctober|
19 Oct 2001, 17:56|Movie|Hamlet|500||Ready|redoctober|
19 Oct 2001, 17:56|Movie|Les Miserables|600||Ready|redoctober|
19 Oct 2001, 17:57|Movie|Fahrenheit 451|||Ready|redoctober|


THE USER CHANGES HAMLET TO HENRY V, THEN CLICKS SUBMIT

19 Oct 2001, 17:56|Movie|War and Peace|800||Ready|redoctober| 19 Oct 2001,
17:56|Movie|Henry V|500||Ready|redoctober|
19 Oct 2001, 17:56|Movie|Les Miserables|600||Ready|redoctober| 19 Oct 2001,
17:57|Movie|Fahrenheit 451|||Ready|redoctober|


Notice how the first two and last two lines, where there used to be a line
break, now run together--and only the updated row/line has a line break at
the end?  WHY?!?!?!?!?!?!=:-(O)

And here's my crappy-as-usual code that handles the new/update functions
(thanks to everyone who have helped me get it to even this state):

if (isset($submit)) {

   if (isset($update)) {   // UPDATE
   $affected0 = $started;
   $affected1 = $type;
   $affected2 = $title;
   $affected3 = $size;
   $affected4 = $res;
   $affected5 = $status;
   $affected6 = $by;
   $updatedstring = $affected0 . | . $affected1 . | . $affected2 . | .
$affected3 . | . $affected4 . | . $affected5 . | . $affected6 . | .
\n;

   $fcontents = file($name..db);
   $fcontents[$update] = $updatedstring;
   $fcontents_string = implode('', $fcontents);

   $fp = fopen($name..db, w+);
fwrite($fp,$fcontents_string);
fclose($fp);

   } else { // ADD
$fp = fopen($name..db, a);
$now = date(j M Y, H:i);
$by = $name;
$common=$now . | . $type . | . $title . | . $size . | . $res .
| . $status .|. $by . | . \n;
fwrite($fp,$common);// write to the file
fclose($fp);// close the file
   }
}


A million thanks if you can help me crush this bug!

---
Rene Fournier
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Delete element from an array (PHP3)

2001-10-05 Thread John Steele

  In PHP4, unset($myarray['3']['someindex'}) removes this element (inside a class 
function passed $myarray).  I need to do the same for PHP3 - what is the simplest way 
to accomplish this?

  I guess I'm looking for a function that supports PHP3 or PHP4, say:

function unset_arr ($array) {
  if (phpversion()  4)
// get rid of the array element here...
  else
unset ($array);
  }

  I'm assuming that I will have to do some shuffling of the array, and possibly return 
a new array with that element missing?

Thanks for any help on this,
  John
--
/* SteeleSoft Consulting  John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  PHP/MySQL/Linux/Hosting - [EMAIL PROTECTED]
 *http://www.steelesoftconsulting.com
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Oh and addition to Emailing Files

2001-07-29 Thread John Steele

Kyle,
  http://www.php.net/manual/en/ref.mail.php is the correct URL, but the easiest way to 
access these sort of things is:

http://www.php.net/mail (substitute mail with any function name)

HTH,
  John

ummm... problem

Forbidden
You don't have permission to access /manual/en/function.mail.php on this
server.

Additionally, a 403 Forbidden error was encountered while trying to use an
ErrorDocument to handle the request.

--
/* SteeleSoft Consulting  John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  PHP/MySQL/Linux/Hosting - [EMAIL PROTECTED]
 *http://www.steelesoftconsulting.com
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] error using imagecreate function

2001-07-24 Thread John Steele

  I don't think posting code is required here, the error message tells exactly what is 
going on.  He either needs to have GD support compiled with his version of PHP, or if 
on windows adding a dl() call to the GD library functions before the call to any GD 
functions:

dl('php_gd.dll')

  Even better, a quick look at the User Contributed Notes at 
http://www.php.net/imagecreate

John

It would help if you can post the code you're using, rather than just
the error message.

 Can some one help me
 
 When i try tu use imagecreate i get an  fatal error message 
 (shown below)
 
 br
 bFatal error/b:  Call to undefined function:  
 imagecreate() in bc:\website\draw.php/b on line b4/bbr
 
 does any body know why this error accurs.
 
 Thanx
 
 Venomous

--
/* SteeleSoft Consulting  John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  PHP/MySQL/Linux/Hosting - [EMAIL PROTECTED]
 *http://www.steelesoftconsulting.com
 */

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]