RE: [PHP] can I get at screen size ?

2004-04-06 Thread Tyler Replogle
hey,
yes it would take 2 steps i made a script like this before so i know, i 
stpent much time looking for it, but php doesn't get info like that because 
it is running on the server and not the computer or viewer's computer




From: E.H.Terwiel [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP] can I get at screen size ?
Date: Mon, 05 Apr 2004 16:20:03 +0200
I want to write a Server Side PHP program that generates a HTML page
client side.
How would I get at the clients' screen size, before serving the
generated page ?
Would it be a two-step process: first let the client execute a piece
of JavaScript to generate Height and Width, and then send those values
to the PHP server (FORM, PUT) ?
Or can it be done in only one PHP program ?
frgr
Erik
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
Limited-time offer: Fast, reliable MSN 9 Dial-up Internet access FREE for 2 
months! 
http://join.msn.com/?page=dept/dialuppgmarket=en-usST=1/go/onm00200361ave/direct/01/

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


Re: [PHP] Regular Expressions

2004-04-06 Thread Matt Palermo
What exactly does this do:

 / (?=p|br) [^]+ /x

It may work, I just want to understand what it's looking for.

Thanks,

Matt

Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 * Thus wrote Matt Palermo ([EMAIL PROTECTED]):
  I have a page where I am stripping the html tags down.  Basically, it
will
  allow certain tags, but still strips out ALL attributs of the tag, so it
  works something like this:
 
  $allowed_tags = pbrstrongbiu;
  //  State which tags are allowed
  $info = strip_tags($info, $allowed_tags);
  // Strip all unwanted tags out
  $allowed_tags = p|br|strong|b|i|u;
  // Convert tags for regular expression
  $info = preg_replace(/(?!.$allowed_tags.)[^]*/, '\1', $info);
//
  Strip out all attributes from allowed tags

 You might wont to try a look behind assertion:
   / (?=p|br) [^]+ /x


 Curt
 --
 I used to think I was indecisive, but now I'm not so sure.

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



[PHP] How to...

2004-04-06 Thread Vicente Werner
I've already a php function that outputs a file from a folder outside the www 
path to a page, but I can't find a way to do this and then close the window 
where it was outed. Any 1 can point me in the right direction?

Thanks,

Vicente

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



[PHP] How to Request?

2004-04-06 Thread Labunski
I'll try to explain..

For example I have a link: index.php?fd=car
then the Request part looks like this:

if(isset($_REQUEST['fd'])){
  $dir = ($_REQUEST['fd']);
}

But for example I have a link index.php?fd=carc=green..
How to Request more then one variable if I want to get something like this:

if(isset($_REQUEST['fd','c'])){ // incorrect form. How to write this
correctly?
  $vehicle = ($_REQUEST['fd']);
  $color = ($_REQUEST['c']);
}

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



[PHP] Re: Reusing MySQL Connections - Can it be done?

2004-04-06 Thread Aidan Lister
http://pear.php.net/package/db

Monty [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am trying to use fewer resources and processes when making database
 connections in my scripts, so, upon the first call to make a DB
connection,
 I store the Link Resource ID in a constant variable that can be accessed
by
 all other functions that need a DB connection, like this...

 function connect_db() {

 if (!defined('_CONNECT_DB')) {

 $result = @mysql_pconnect(localhost, Username, Password);
 @mysql_select_db(database_name);
 define('_CONNECT_DB', $result);
 }
 return _CONNECT_DB;

 I call this function this way...

 $query = SELECT * FROM table;
 $connid = connect_db();
 $result = mysql_query($query, $connid);


 What's odd is that this works for the first query, but after that the
 Resource Link ID stored in _CONNECT_DB ceases to work, making MySQL issue
 the error: mysql_query(): 4 is not a valid MySQL-Link resource...

 Is there any reason why this isn't working? Normally I store the Resource
 Link ID in a local variable that I can re-use with no problem, so, I can't
 understand why storing the Resource Link ID in a constant var won't work?
Is
 it not possible to re-use the same connection for multiple queries to
 different tables in the DB? I know I can do this if the Resource Link ID
is
 assigned to a local var, so, maybe it can't be stored in a constant var??

 Only other solution I can think of is to use non-persistent connections
and
 simply make a connection to the DB then immediately disconnect for each
 function that needs DB access, but, I'm wondering if this will create more
 overhead and overload the database with too many connections?

 I've searched and read just about everything I could find about exactly
how
 PHP and MySQL work together, but, if there's anything that explains in
 detail exactly what is happening when you call mysql_connect or
mysql_query,
 please point me in its direction.

 Any input on this is most appreciated!

 Monty

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



Re: [PHP] Re: Reusing MySQL Connections - Can it be done?

2004-04-06 Thread Red Wingate

[...]
  I tried this, but, same results. If I store the Resource ID from a
  mysql_pconnect() in $GLOBALS['_CONNECT_DB'] and then call...
 
  mysql_query($query, $GLOBALS['_CONNECT_DB']);
[...]

 How are you setting the global?

[...]

I guess he said he is using $GLOBALS['_CONNECT_DB'] :-p

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



[PHP] Re: How to Request?

2004-04-06 Thread Pavel Jartsev
Labunski wrote:
...
But for example I have a link index.php?fd=carc=green..
How to Request more then one variable if I want to get something like this:
if(isset($_REQUEST['fd','c'])){ // incorrect form. How to write this
correctly?
  $vehicle = ($_REQUEST['fd']);
  $color = ($_REQUEST['c']);
}
if ( isset( $_REQUEST['fd'] )  isset( $_REQUEST['c'] )) {
 $vehicle = $_REQUEST['fd'];
 $color = $_REQUEST['c'];
}
Hope that helps.

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


Re: [PHP] How to Request?

2004-04-06 Thread Chris Shiflett
--- Labunski [EMAIL PROTECTED] wrote:
 But for example I have a link index.php?fd=carc=green..
 How to Request more then one variable if I want to get something like
 this:
 
 if(isset($_REQUEST['fd','c'])){ // incorrect form. How to write this
 correctly?
   $vehicle = ($_REQUEST['fd']);
   $color = ($_REQUEST['c']);
 }

You answer your own question immediately after you ask it.

Wrong: $_REQUEST['fd','c']

Right: $_REQUEST['fd']
   $_REQUEST['c']

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



[PHP] Executing PHP shell script in PHP

2004-04-06 Thread Brent Clark
Hi

Does anyone know of how to execute a  php shell script in a php file.

Kind Regards
Brent Clark

[PHP] register_globals

2004-04-06 Thread nullevent
Hello.
  
  In my php.ini file register_globals has value Off.
  
  I have script
  ?php
ini_set(register_globals, 0);
echo ini_get(register_globals);
  ?
  Script  echo 1. But if i create .htaccess in this dir which contains
  string
  php_value register_globals 0, my script return 0.
  Why i cann't change register_globals value with ini_set()?

bye, 
 mailto:[EMAIL PROTECTED],
 4:11, 04.04.2004

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



Re: [PHP] register_globals

2004-04-06 Thread Richard Davey
Hello,

Sunday, April 4, 2004, 1:17:53 AM, you wrote:

n   Why i cann't change register_globals value with ini_set()?

Because it's a system level configuration value - you cannot change it
in your scripts.

register_globals supports PHP_INI_PERDIR and PHP_INI_SYSTEM - meaning
it can only be changed in the php.ini file or an htaccess file.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



[PHP] Re: Executing PHP shell script in PHP

2004-04-06 Thread pete M
Brent Clark wrote:

Hi

Does anyone know of how to execute a  php shell script in a php file.

Kind Regards
Brent Clark
assuming *nix

php myscript.php

or stick at the beginning of the file
#!/bin/php
and then run ./myscript.php

hope it helps

pete

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


Re: [PHP] How to...

2004-04-06 Thread Burhan Khalid
Vicente Werner wrote:
I've already a php function that outputs a file from a folder outside the www 
path to a page, but I can't find a way to do this and then close the window 
where it was outed. Any 1 can point me in the right direction?
You cannot close the window from within PHP. You have to use client side 
scripting (Javascript).

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


Re: [PHP] How to...

2004-04-06 Thread Vicente Werner
El Martes, 6 de Abril de 2004 10:13, Burhan Khalid escribió:
 You cannot close the window from within PHP. You have to use client side
 scripting (Javascript).
I've already tried sending :

script language=Javascript
window.close()
/script

Just after echoing the file, but with 0 success.

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



Re: [PHP] How to...

2004-04-06 Thread Pavel Jartsev
Vicente Werner wrote:
El Martes, 6 de Abril de 2004 10:13, Burhan Khalid escribió:

You cannot close the window from within PHP. You have to use client side
scripting (Javascript).
I've already tried sending :

script language=Javascript
window.close()
/script
Just after echoing the file, but with 0 success.


Try onLoad-event of BODY-tag, i.e. send such HTML to browser:

html
body onLoad=window.close();
/body
/html
Hope that helps.

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


Re: [PHP] PHP has a bug...?

2004-04-06 Thread John W. Holmes
From: Stephen Craton [EMAIL PROTECTED]

 I was making a parabola grapher and I was testing out some values. Part of
 the script is to take the variable b and multiply it was negative one,
then
 multiply by 2 times a. I entered a test value where a equals 1, b equals
0,
 and c equals 0. The result told me that -1 times 0 is -0.

 Here's the code I'm using:

 $x = (-1 * $b) / (2 * $a);

What version of PHP and what OS? I don't see this replicated on 4.3.3/Win2k.

---John Holmes...

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



[PHP] php + lynx + grep

2004-04-06 Thread Brian L. Ollom
lynx --source http://weather.noaa.gov/weather/current/KTOL.html |grep -v
'41-35-19N' |grep TOL | head -n 1

I need to get the output of the above command for a web site I'm
working on.  I've tried exec(), system() and neither seems to
work.

It's output should be something like this(it changes hourly):
  TDFONT FACE=Arial,Helvetica  KTOL 031452Z 28013KT
  10SM CLR 10/01 A2977 RMK AO2 SLP086 T0106 58015

Help!


| Brian Ollom  |   |
| NiteHawke.Com|  http://www.nitehawke.com/|
| An Authorized Firefly Dealer |  email  [EMAIL PROTECTED]  |


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



Re: [PHP] assigning NULL to a variable

2004-04-06 Thread Marek Kilimajer
Andy B wrote:
how would you assign NULL to a variable if its original value is ? otherwise leave it with its value...
if($var === '') $var = NULL;

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


[PHP] Max Filesize for PHP copy

2004-04-06 Thread Ashley
I posted this in the Netware PHP newsgroup, but have not gotten a 
response.  Hopefully I will get something here.

I was using a script to copy a file from one location to another.  It 
was working great (but was only testing with small files under 1MB) and 
then when I tried uploading a file that was a little over 4MB the server 
abended with the message Cache memory allocator out of available memory.
I looked in the PHP.ini file and changed the max filesize to 5MB and 
tried to copy the same file.  It worked, but I received the same 
message, but it didn't abend.
I don't think that this is normal and would appreciate any suggestions 
as to a better method or an explanation as to what may be causing this.

Netware 6, PHP 4.2.4 (newest version for Netware), Apache 2.0.48

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


[PHP] php + lynx + grep

2004-04-06 Thread Brian L. Ollom
lynx --source http://weather.noaa.gov/weather/current/KTOL.html
|grep -v '41-35-19N' |grep TOL | head -n 1

I need to get the output of the above command for a web site I'm
working on.  I've tried exec(), system() and neither seems to
work.

It's output should be something like this(it changes hourly):
  TDFONT FACE=Arial,Helvetica  KTOL 061152Z 23004KT 10SM
  CLR 00/M07 A3007 RMK AO2 SLP187 T1072 10017 21033 53005

Help!


| Brian Ollom  |   |
| NiteHawke.Com|  http://www.nitehawke.com/|
| An Authorized Firefly Dealer |  email  [EMAIL PROTECTED]  |


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



[PHP] Re: php + lynx + grep

2004-04-06 Thread Brian L. Ollom
 lynx --source
 http://weather.noaa.gov/weather/current/KTOL.html | grep -v
 '41-35-19N' |grep TOL | head -n 1

 I need to get the output of the above command for a web site
 I'm working on.  I've tried exec(), system() and neither seems
 to work.

 It's output should be something like this(it changes hourly):
   TDFONT FACE=Arial,Helvetica  KTOL 031452Z 28013KT
   10SM CLR 10/01 A2977 RMK AO2 SLP086 T0106 58015

It works fine on the command line, but won't show any info on
the site.


| Brian Ollom  |   |
| NiteHawke.Com|  http://www.nitehawke.com/|
| An Authorized Firefly Dealer |  email  [EMAIL PROTECTED]  |


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



[PHP] php + lynx + grep

2004-04-06 Thread Brian L. Ollom
lynx --source http://weather.noaa.gov/weather/current/KTOL.html
|grep -v '41-35-19N' |grep TOL | head -n 1

I need to get the output of the above command for a web site I'm
working on.  I've tried exec(), system() and neither seems to
work.

It's output should be something like this(it changes hourly):
  TDFONT FACE=Arial,Helvetica  KTOL 031452Z 28013KT
  10SM CLR 10/01 A2977 RMK AO2 SLP086 T0106 58015

Help!


| Brian Ollom  |   |
| NiteHawke.Com|  http://www.nitehawke.com/|
| An Authorized Firefly Dealer |  email  [EMAIL PROTECTED]  |

ForPilot's - Software for your piloting needs!
http://www.forpilots.com/
Great Deals on Great Pilot Supplies!
http://www.acespilotshop.com/cgi-bin/ares.cgi?ID=240400532
Want deals on other great stuff?  Click here!
http://www.dollardays.com/index.asp?affilid=385

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



Re: [PHP] php + lynx + grep

2004-04-06 Thread John Nichel
Brian L. Ollom wrote:
lynx --source http://weather.noaa.gov/weather/current/KTOL.html
|grep -v '41-35-19N' |grep TOL | head -n 1
I need to get the output of the above command for a web site I'm
working on.  I've tried exec(), system() and neither seems to
work.
It's output should be something like this(it changes hourly):
  TDFONT FACE=Arial,Helvetica  KTOL 061152Z 23004KT 10SM
  CLR 00/M07 A3007 RMK AO2 SLP187 T1072 10017 21033 53005
Help!


| Brian Ollom  |   |
| NiteHawke.Com|  http://www.nitehawke.com/|
| An Authorized Firefly Dealer |  email  [EMAIL PROTECTED]  |

Try

$output = `lynx --source 
http://weather.noaa.gov/weather/current/KTOL.html |grep -v '41-35-19N' 
|grep TOL | head -n 1`

Those are backticks, not single quotes surrounding the command.

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


Re: [PHP] php + lynx + grep

2004-04-06 Thread Burhan Khalid
Brian L. Ollom wrote:

lynx --source http://weather.noaa.gov/weather/current/KTOL.html |grep -v
'41-35-19N' |grep TOL | head -n 1
I need to get the output of the above command for a web site I'm
working on.  I've tried exec(), system() and neither seems to
work.
You know, it might be easier if you use the new NOAA XML weather feeds [ 
http://www.nws.noaa.gov/alerts/ ].

Also, did you know that you can FTP into their public server and 
download observation reports? They are cycled every hour, and are 
available via anonymous FTP from 
weather.noaa.gov/data/observations/metar/cycles directory.

Or, you can use snoopy and submit your ICAO code to 
http://www.noaa.gov/weather/metar.shtml and have snoopy return the plain 
text version of the file. You should get your METAR report there.

(yes, I am an avid flight simulator)

Sorry I didn't answer your original question.

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


[PHP] function CreateDate i made doesnt work?

2004-04-06 Thread Andy B
i have the function i made:
function CreateDate($day, $month, $year) {
if(!empty($day)  !empty($month)  !empty($year)){
//convert $day, $month, and $year into a valid timestamp
$time= strtotime($day, mktime(0,0,0,$month,1,$year));
$time=date(YmdHis, $time);
return $time; }
else {
return false; }}
?
now when i try to use itlike this:
//$startingday $startingmonth and $startingyear are all form 
//variables
$_SESSION['add']['start_date']=CreateDate($startingday, $startingmonth, $startingyear);
//now echo the date: assuming lets say we used 10/5/2004 
//in the original form:
Start Date: ?echo date(l F j Y, $_SESSION['add']['start_date']);?
my output ends up being Monday January 18, 2038 no matter what i try to use in the 
forms.


Re: [PHP] function CreateDate i made doesnt work?

2004-04-06 Thread John W. Holmes
From: Andy B [EMAIL PROTECTED]

 i have the function i made:
 function CreateDate($day, $month, $year) {
 if(!empty($day)  !empty($month)  !empty($year)){
 //convert $day, $month, and $year into a valid timestamp

 $time= strtotime($day, mktime(0,0,0,$month,1,$year));
 $time=date(YmdHis, $time);

Replace the above two lines with

$time = date('YmdHis', mktime(0,0,0,$month,$day,$year);

---John Holmes...

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



Re: [PHP] function CreateDate i made doesnt work?

2004-04-06 Thread Richard Davey
Hello Andy,

Tuesday, April 6, 2004, 2:18:45 PM, you wrote:

AB i have the function i made:

AB function CreateDate($day, $month, $year) {
AB if(!empty($day)  !empty($month)  !empty($year)){
AB //convert $day, $month, and $year into a valid timestamp
AB $time= strtotime($day, mktime(0,0,0,$month,1,$year));
AB $time=date(YmdHis, $time);
AB return $time; }
AB else {
AB return false; }}
?

AB my output ends up being Monday January 18, 2038 no matter what i
AB try to use in the forms.

Your function doesn't seem to make any sense to be honest - you're
passing in the $day value to strtotime (a function that ideally
requires English language date formats) and then asking it to
calculate a timestamp based off the offset of the month and year.

So ultimately you're feeding strtotime = 10, timestamp

which means it's going to try and calculate the difference between 10
and the given timestamp (which is going to be a lot!)

What exactly is this function *supposed* to do?

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



[PHP] execute script via email?

2004-04-06 Thread BigMark
Is there a way for me to email this script so it executes the close of a
round instead of doing it from the website administration .

(it is a football tipping script)


?php
include(connect.php);

// Grab variables and insert into database
$x=1;
$Round = $_POST['Round'];

switch ($Round) {
 case QF:
  $y = 5;
  break;
 case SF:
 case PF:
  $y = 3;
  break;
 case GF:
  $y = 2;
  break;
 default:
  $y = 9;
  break;
}

While ($x  $y) {

 $Game = $x;
 $sql = mysql_query(UPDATE Rounds SET Closed = 'Yes' WHERE Round = '$Round'
AND Game = '$Game');
 $x++;

}
?

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



Re: [PHP] function CreateDate i made doesnt work?

2004-04-06 Thread Shimi
by the way
change ur if alittle.. change the  to ||
John W. Holmes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 From: Andy B [EMAIL PROTECTED]

  i have the function i made:
  function CreateDate($day, $month, $year) {
  if(!empty($day)  !empty($month)  !empty($year)){
  //convert $day, $month, and $year into a valid timestamp

  $time= strtotime($day, mktime(0,0,0,$month,1,$year));
  $time=date(YmdHis, $time);

 Replace the above two lines with

 $time = date('YmdHis', mktime(0,0,0,$month,$day,$year);

 ---John Holmes...

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



Re: [PHP] php + lynx + grep

2004-04-06 Thread Red Wingate
Functions like system, exec etc aren't supported by most ISP ( at least over
here in germany ). But you might give 

file_get_contents();
file();
...

a look as they can read the output of HTTP request which might be easier:

$var = file ( 'http://weather.noaa.gov/weather/current/KTOL.html' );
foreach ( $var AS $line ) {
if ( preg_match( 41-35-19N , $var ) )
   ... etc pp
}

good luck,
   red

[...]
 lynx --source http://weather.noaa.gov/weather/current/KTOL.html

 |grep -v '41-35-19N' |grep TOL | head -n 1

 I need to get the output of the above command for a web site I'm
 working on.  I've tried exec(), system() and neither seems to
 work.

 It's output should be something like this(it changes hourly):
   TDFONT FACE=Arial,Helvetica  KTOL 031452Z 28013KT
   10SM CLR 10/01 A2977 RMK AO2 SLP086 T0106 58015

[...]

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



[PHP] GD installation

2004-04-06 Thread Shimi
im having a problem installing the GD library
OS - Windows XP Pro
PHP - 4.3.5
i tried in the PHP.INI get the ; of the line with the GD extension
and im getting an error that the file not found
./php_gd2.dll
i tried to copy the file to main PHP folder and WINDOWS\SYSTEM32
nothing seems to be working
the i tried to change the extension path to th main php folder
and it still didnt work although the file is there

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



[PHP] For your reference, how to validate dynamic form fields.

2004-04-06 Thread Hawkes, Richard
Just spent far too long trying to figure out how to do this, so I thought I'd
pass it on to you great guys, in case you need it for the future.
 
I used PHP to create multiple form rows, each one numbered:

?
for ($i =1; $i = 20; $i++) {
echo(input type=text name=userId$i maxlength=5/br/);
}
?

This creates a number of rows, each with a unique form value name. The problem
I had was that I needed to validate those rows, to make sure they were
numeric... Here's what I did. Have fun!
 
?php
$numRows = 20;
?
html
head
titleUser ID Entry Example/title
script language=JavaScript
function isNumeric(strString)
{
var strValidChars = 0123456789-.;
var strChar;
var blnResult = true;
 
if (strString.length == 0) return false;
 
//  test strString consists of valid characters listed above
for (i = 0; i  strString.length  blnResult == true; i++)
{
strChar = strString.charAt(i);
if (strValidChars.indexOf(strChar) == -1)
{
blnResult = false;
}
}
return blnResult;
}
 
 
function validateForm()
{
for (var i = 1; i = ?= $numRows ?; i++)
{
var fieldName = 'UserId' + i;
var fieldValue =
document.forms.userForm.elements[fieldName].value;
if (fieldValue != ''  ! isNumeric(fieldValue))
{
alert(Field value in row  + i +  ( + fieldValue + ) is
not numeric.);
return false;
}
}
return true;
}
/script
/head
body
form name=userForm action=process_form.php method=post onSubmit=return
validateForm()
?php
  for ($i =1; $i = $numRows; $i++) {
echo(input type=text name=userId$i maxlength=5/br/);
  }
?
/form
/body
/html

==
This message is for the sole use of the intended recipient. If you received
this message in error please delete it and notify us. If this message was
misdirected, CSFB does not waive any confidentiality or privilege. CSFB
retains and monitors electronic communications sent through its network.
Instructions transmitted over this system are not binding on CSFB until they
are confirmed by us. Message transmission is not guaranteed to be secure.
==


Re: [PHP] function CreateDate i made doesnt work?

2004-04-06 Thread Red Wingate
I've seen this type of creating a timestamp quite often now and was even so 
often shaking my head about it. Guess i've seen it somewhere in the PHP 
Documentation's user contributed notes on day. Just google for the term and 
you will find many hits like this:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg136608.html

  -- red

PS: Guess some ppl have never heard about mktime :-)

[...]
 Your function doesn't seem to make any sense to be honest - you're
 passing in the $day value to strtotime (a function that ideally
 requires English language date formats) and then asking it to
 calculate a timestamp based off the offset of the month and year.

 So ultimately you're feeding strtotime = 10, timestamp

 which means it's going to try and calculate the difference between 10
 and the given timestamp (which is going to be a lot!)

 What exactly is this function *supposed* to do?
[...]

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



Re[2]: [PHP] function CreateDate i made doesnt work?

2004-04-06 Thread Richard Davey
Hello Red,

Tuesday, April 6, 2004, 3:40:07 PM, you wrote:

RW I've seen this type of creating a timestamp quite often now and was even so
RW often shaking my head about it. Guess i've seen it somewhere in the PHP
RW Documentation's user contributed notes on day. Just google for the term and
RW you will find many hits like this:

Yeah, I reckon times must be one of the most misunderstood (or just
misused) elements of PHP.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP] Re: Reusing MySQL Connections - Can it be done?

2004-04-06 Thread William Lovaton
This is weird, it works for me, I use Oracle though.

The real application uses ADODB but it should work with the PHP native
resources.

I do this:

1. Define a singleton function, for example: getDBConnection()

function getDBConnection() {
$db = GLOBALS['APP_DB_CONNECTION'];
if (!is_object($db)) {
// Here we make the connection
$db = WHAT_EVER_CONNECTION_FUNCTION_YOU_WANT();

// At this point $db is a valid connection object
GLOBALS['APP_DB_CONNECTION'] = $db;
}
return $db
}


2. From every function that connects to the database you just call the
singleton:

function getActiveCustomers() {
$db = getDBConnection();
$sql = SELECT .;
// Here you execute the sql like you normally would

return $rs;  // This is the resultset
}

Note that in step 1 you can use the resource variable returned by native
PHP functions, in my case I use ADODB so I store the object which isn't
that different because inside that object resides the PHP resource. So
you can change the line 'if (!is_object($db))' for
'if(!is_resource($db))'.

If you look the singleton carefully you'll see that the connection
process is executed just the first time.  For example, if a user
requests executes 10 queries to the database, the connection will be
actually made in the first call to the singleton.  The successive calls
will return the connection stored in the global scope.

I can tell for sure that this approach works very well.  If it doesn't
for you, there might be a more fundamental problem in your configuration
or in your code.


Regards,

-William


El lun, 05-04-2004 a las 17:18, Monty escribió:
  A define is pretty much for strings only, not objects or resources. Try
  using $GLOBALS['_CONNECT_DB'] instead.
 
 I tried this, but, same results. If I store the Resource ID from a
 mysql_pconnect() in $GLOBALS['_CONNECT_DB'] and then call...
 
 mysql_query($query, $GLOBALS['_CONNECT_DB']);
 
 PHP gives me the following error:
 
 4 is not a valid MySQL-Link resource
 
 When I look into this var, here's what I see:
 
 Resource id #4
 
 This is the same that was stored in the constant var, so, it appears that
 whether it's a Global or Constant isn't making a difference.

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



[PHP] Limiting an array to unique values

2004-04-06 Thread Alex Hogan
Hi All,

I have an array that I am using as a parameter for a query in a where
clause.

The array has values that are like this.

Item 1
Item 2
Item 3
Item 1
Item 3
Item 3
Item 1

What I need to have is unique values only.

Item 1
Item 2
Item 3

How can I sort out the redundant values in that array?



alex hogan




** 
The contents of this e-mail and any files transmitted with it are 
confidential and intended solely for the use of the individual or 
entity to whom it is addressed.  The views stated herein do not 
necessarily represent the view of the company.  If you are not the 
intended recipient of this e-mail you may not copy, forward, 
disclose, or otherwise use it or any part of it in any form 
whatsoever.  If you have received this e-mail in error please 
e-mail the sender. 
** 




Re: [PHP] Limiting an array to unique values

2004-04-06 Thread joel boonstra
On Tue, Apr 06, 2004 at 09:27:31AM -0500, Alex Hogan wrote:
 Hi All,
 
 I have an array that I am using as a parameter for a query in a where
 clause.
 
 The array has values that are like this.
 
 Item 1
 Item 2
 Item 3
 Item 1
 Item 3
 Item 3
 Item 1
 
 What I need to have is unique values only.
 
 Item 1
 Item 2
 Item 3
 
 How can I sort out the redundant values in that array?

PHP's 'array_unique' function should help:

  http://php.net/array_unique

-- 
[ joel boonstra | gospelcom.net ]

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



RE: [PHP] Limiting an array to unique values

2004-04-06 Thread Alex Hogan

Thanks...

Exactly what I needed.


alex hogan


 -Original Message-
 From: joel boonstra [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, April 06, 2004 9:30 AM
 To: PHP General list
 Subject: Re: [PHP] Limiting an array to unique values
 
 On Tue, Apr 06, 2004 at 09:27:31AM -0500, Alex Hogan wrote:
  Hi All,
 
  I have an array that I am using as a parameter for a query in a where
  clause.
 
  The array has values that are like this.
 
  Item 1
  Item 2
  Item 3
  Item 1
  Item 3
  Item 3
  Item 1
 
  What I need to have is unique values only.
 
  Item 1
  Item 2
  Item 3
 
  How can I sort out the redundant values in that array?
 
 PHP's 'array_unique' function should help:
 
   http://php.net/array_unique
 
 --
 [ joel boonstra | gospelcom.net ]
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


** 
The contents of this e-mail and any files transmitted with it are 
confidential and intended solely for the use of the individual or 
entity to whom it is addressed.  The views stated herein do not 
necessarily represent the view of the company.  If you are not the 
intended recipient of this e-mail you may not copy, forward, 
disclose, or otherwise use it or any part of it in any form 
whatsoever.  If you have received this e-mail in error please 
e-mail the sender. 
** 




Re: [PHP] Limiting an array to unique values

2004-04-06 Thread John W. Holmes
From: Alex Hogan [EMAIL PROTECTED]
 I have an array that I am using as a parameter for a query in a where
 clause.
 
 The array has values that are like this.
 
 Item 1
 Item 2
 Item 3
 Item 1
 Item 3
 Item 3
 Item 1
 
 What I need to have is unique values only.
 
 Item 1
 Item 2
 Item 3
 
 How can I sort out the redundant values in that array?

array_unique(). Imagine that. :)

---John Holmes...

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



RE: [PHP] Limiting an array to unique values

2004-04-06 Thread Alex Hogan

I guess I deserved that one...



alex hogan


 -Original Message-
 From: John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, April 06, 2004 9:40 AM
 To: Alex Hogan; PHP General list
 Subject: Re: [PHP] Limiting an array to unique values
 
 From: Alex Hogan [EMAIL PROTECTED]
  I have an array that I am using as a parameter for a query in a where
  clause.
 
  The array has values that are like this.
 
  Item 1
  Item 2
  Item 3
  Item 1
  Item 3
  Item 3
  Item 1
 
  What I need to have is unique values only.
 
  Item 1
  Item 2
  Item 3
 
  How can I sort out the redundant values in that array?
 
 array_unique(). Imagine that. :)
 
 ---John Holmes...


** 
The contents of this e-mail and any files transmitted with it are 
confidential and intended solely for the use of the individual or 
entity to whom it is addressed.  The views stated herein do not 
necessarily represent the view of the company.  If you are not the 
intended recipient of this e-mail you may not copy, forward, 
disclose, or otherwise use it or any part of it in any form 
whatsoever.  If you have received this e-mail in error please 
e-mail the sender. 
** 




RE: [PHP] execute script via email?

2004-04-06 Thread jon roig
Sure... You can write a small php script that uses PHP's imap or pop
functions to monitor any email address. (Check out
http://us3.php.net/manual/en/ref.imap.php for details.) Once that's
written, just schedule it as a task using the windows scheduler or cron
in unix/linux.

-- jon

---
jon roig
web developer
email: [EMAIL PROTECTED]
phone: 888.230.7557



-Original Message-
From: BigMark [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 6:27 AM
To: [EMAIL PROTECTED]
Subject: [PHP] execute script via email?


Is there a way for me to email this script so it executes the close of a
round instead of doing it from the website administration .

(it is a football tipping script)


?php
include(connect.php);

// Grab variables and insert into database
$x=1;
$Round = $_POST['Round'];

switch ($Round) {
 case QF:
  $y = 5;
  break;
 case SF:
 case PF:
  $y = 3;
  break;
 case GF:
  $y = 2;
  break;
 default:
  $y = 9;
  break;
}

While ($x  $y) {

 $Game = $x;
 $sql = mysql_query(UPDATE Rounds SET Closed = 'Yes' WHERE Round =
'$Round' AND Game = '$Game');  $x++;

}
?

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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004
 

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



RE: [PHP] Executing PHP shell script in PHP

2004-04-06 Thread jon roig
The shell script is in PHP as well? Presumably, you could either access
it as an include or execute it using exec.

-- jon

---
jon roig
web developer
email: [EMAIL PROTECTED]
phone: 888.230.7557


-Original Message-
From: Brent Clark [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 1:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Executing PHP shell script in PHP


Hi

Does anyone know of how to execute a  php shell script in a php file.

Kind Regards
Brent Clark

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004
 

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



[PHP] Connecting to Databases

2004-04-06 Thread Robb Kerr
I know that this message is more related to MySQL than PHP but I don't know 
of a good MySQL board. This board is VERY active and useful.

As most of us, I use a variety of programs to produce my HTML/PHP/MySQL. I 
have run into this problem several times on a variety of programs so 
thought I'd post and see if anyone had the answer.

I have found that it is not uncommon when trying to connect to a database 
on an Apache server to get a return similar to Access denied for user: 
[EMAIL PROTECTED]. I just ran into this problem because I wanted to use 
SQLyog to manipulate a table that already exists on one of my servers. I 
went to the Connections document that Dreamweaver creates and copied all 
of the connection info (host, db, user, password) exactly into the 
connection dialogue of SQLyog. The error message above was returned when I 
tried to connect although I can connect Dreamweaver to the database without 
problem even though the IPAdress is not listed as part of the username.

What's up?
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

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



[PHP] Help importing a text file via phpmyadmin

2004-04-06 Thread Brian Dunning
Hi all -

I'm trying to use phpmyadmin's Insert data from a textfile into table 
function. I've done this before many times, exactly the same way, and 
never had a problem. But today I'm getting:

  #1148 - The used command is not allowed with this MySQL version

Is there a common cause for this error? I find little helpful info in 
the phpmyadmin documentation. Any ideas appreciated...  :)

- Brian

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


Re: [PHP] Connecting to Databases

2004-04-06 Thread John W. Holmes
From: Robb Kerr [EMAIL PROTECTED]

 I have found that it is not uncommon when trying to connect to a database
 on an Apache server to get a return similar to Access denied for user:
 [EMAIL PROTECTED]. I just ran into this problem because I wanted to use
 SQLyog to manipulate a table that already exists on one of my servers. I
 went to the Connections document that Dreamweaver creates and copied all
 of the connection info (host, db, user, password) exactly into the
 connection dialogue of SQLyog. The error message above was returned when I
 tried to connect although I can connect Dreamweaver to the database
without
 problem even though the IPAdress is not listed as part of the username.

With MySQL, a user is given permission to connect with a specific username
and password _and_ from a specific host. When you run the script from
Dreamweaver, is it on the same machine as SQLYog? You probably just need to
modify your MySQL user to have permission to connect from IPAddress.

---John Holmes...

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



Re: [PHP] Help importing a text file via phpmyadmin

2004-04-06 Thread John W. Holmes
From: Brian Dunning [EMAIL PROTECTED]

 I'm trying to use phpmyadmin's Insert data from a textfile into table
 function. I've done this before many times, exactly the same way, and
 never had a problem. But today I'm getting:

#1148 - The used command is not allowed with this MySQL version

 Is there a common cause for this error? I find little helpful info in
 the phpmyadmin documentation. Any ideas appreciated...  :)

I think you need FILE permission to use LOAD DATA INFILE queries. The user
you're connecting with must not have that permission.

---John Holmes...

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



Re: [PHP] Connecting to Databases

2004-04-06 Thread Robb Kerr
On Tue, 6 Apr 2004 11:18:11 -0400, John W. Holmes wrote:

 From: Robb Kerr [EMAIL PROTECTED]
 
 I have found that it is not uncommon when trying to connect to a database
 on an Apache server to get a return similar to Access denied for user:
 [EMAIL PROTECTED]. I just ran into this problem because I wanted to use
 SQLyog to manipulate a table that already exists on one of my servers. I
 went to the Connections document that Dreamweaver creates and copied all
 of the connection info (host, db, user, password) exactly into the
 connection dialogue of SQLyog. The error message above was returned when I
 tried to connect although I can connect Dreamweaver to the database
 without
 problem even though the IPAdress is not listed as part of the username.
 
 With MySQL, a user is given permission to connect with a specific username
 and password _and_ from a specific host. When you run the script from
 Dreamweaver, is it on the same machine as SQLYog? You probably just need to
 modify your MySQL user to have permission to connect from IPAddress.
 
 ---John Holmes...

Unfortunately, SQLyog and Dreamweaver reside on the same machine. Should I
create a new user for the database which is [EMAIL PROTECTED]? Why would
SQLyog require this while Dreamweaver does not? And, why doesn't identical
connection information work on both applications?
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

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



[PHP] smarty

2004-04-06 Thread Angelo Zanetti
hi all has anyone used smarty before? what do you think of it? I think it's
pretty nice to seperate your script (code) from your design.

i would like to hear your comments and if you have any alternatives let me
know.

Angelo


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



[PHP] function CreateDate i made doesnt work?

2004-04-06 Thread Andy B

 Replace the above two lines with

 $time = date('YmdHis', mktime(0,0,0,$month,$day,$year);


ok the function works now because when i echo the output of
$_SESSION['add']['start_date'] it shows the right 14 digit timestamp for the
date i wanted to create... now the problem is getting it to echo on a page
in a normal standard user readable format... i have the following line i
used to attempt that with but still..no matter what i put in the form for a
date it returns monday january 15 2038..or in one instance of playing with
it even ended up with december 31 1969... even though i put in the date i
wanted ...
say first saturday 9 (september) 2004
here is the line i used: something must be wrong with it
Start Date: ?echo date(l F j Y, $_SESSION['add']['start_date']);?

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



Re: [PHP] Connecting to Databases

2004-04-06 Thread Robb Kerr
On Tue, 6 Apr 2004 10:24:29 -0500, Robb Kerr wrote:

 On Tue, 6 Apr 2004 11:18:11 -0400, John W. Holmes wrote:
 
 From: Robb Kerr [EMAIL PROTECTED]
 
 I have found that it is not uncommon when trying to connect to a database
 on an Apache server to get a return similar to Access denied for user:
 [EMAIL PROTECTED]. I just ran into this problem because I wanted to use
 SQLyog to manipulate a table that already exists on one of my servers. I
 went to the Connections document that Dreamweaver creates and copied all
 of the connection info (host, db, user, password) exactly into the
 connection dialogue of SQLyog. The error message above was returned when I
 tried to connect although I can connect Dreamweaver to the database
 without
 problem even though the IPAdress is not listed as part of the username.
 
 With MySQL, a user is given permission to connect with a specific username
 and password _and_ from a specific host. When you run the script from
 Dreamweaver, is it on the same machine as SQLYog? You probably just need to
 modify your MySQL user to have permission to connect from IPAddress.
 
 ---John Holmes...
 
 Unfortunately, SQLyog and Dreamweaver reside on the same machine. Should I
 create a new user for the database which is [EMAIL PROTECTED]? Why would
 SQLyog require this while Dreamweaver does not? And, why doesn't identical
 connection information work on both applications?

I solved the problem by adding my IP address to the Access Hosts list for
the database. Fortunately I use a cable modem with a static IP address, but
if I were using a dialup with a dynamic IP, would I have to add that IP as
an Access Host every time I dialed up? This seems wrong.
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

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



Re: [PHP] Regular Expressions

2004-04-06 Thread Curt Zirzow
* Thus wrote Matt Palermo ([EMAIL PROTECTED]):
 What exactly does this do:
 

Your original expression:

  / (?!p|br) [^]* /x

Find '' not followed by 'p|br' until the first '' we find.
  
  p class=foo   - matches
  - matches

Its a bit confusing as why the p * matches, perhaps the
documentation at http://php.net/pcre might explain it a little
more. 


  / (?=p|br) [^]+ /x
 

Find '' until, if 'any charcaters' between, '' and be sure that
'p|br' exist before 'any characters'


And perhaps a little more effecient than the one above:

  / (?=p|br) [^]+ /x

Find '', followed by 'p|br' until, if 'any characters' between,
''.


The last one probably is a better one since it will fail quickly
whereas look behinds are a bit expensive since it will have to
match  [^]+  before it considers the 'p|br'.


 It may work, I just want to understand what it's looking for.

HTH,

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] smarty

2004-04-06 Thread Kelly Hallman
Apr 6 at 5:33pm, Angelo Zanetti wrote:
 hi all has anyone used smarty before? what do you think of it? I think
 it's pretty nice to seperate your script (code) from your design.
 i would like to hear your comments and if you have any alternatives

There are a lot of templating systems for PHP, but I chose Smarty because 
it seemed the most feature-laden, and likely to have continued support.
I wanted to standardize on something, so I went for the most ubiquitous.
Really, I couldn't be happier with it in every regard.

At first it may seem like more than you need, but continue working with it
and you'll find new design strategies that take you further than you ever
thought you'd go. It's one of those things you start using and never look
back. I use it on almost every project now, even small ones.

There are the naysayers who complain it's too bloated for basic work,
but I think the powerful benefits far outweigh any performance issues.
I've never felt like it was slow or too much for a given task.

Get yo' template on!
--Kelly (another Smarty fan)

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



[PHP] Keyword Search

2004-04-06 Thread Robb Kerr
I've inherited a database so must live with a less than elegant structure.
The table contains one keyword field into which the author has entered
things like...

Record 1 = Apples
Record 2 = Apples, Bananas
Record 3 = Apples, Figs
Record 4 = Bananas, Figs, Dates

I need to do a search on this field to return all of the records containing
Figs. What's the search syntax?

I've tried...
SELECT * from dbname.tablename MATCH (dbname.fieldname) AGAINST 'Figs'

It doesnt' work.

Thanx in advance
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

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



RE: [PHP] Keyword Search

2004-04-06 Thread Jay Blanchard
[snip]
I've inherited a database so must live with a less than elegant
structure.
The table contains one keyword field into which the author has entered
things like...

Record 1 = Apples
Record 2 = Apples, Bananas
Record 3 = Apples, Figs
Record 4 = Bananas, Figs, Dates

I need to do a search on this field to return all of the records
containing
Figs. What's the search syntax?

I've tried...
SELECT * from dbname.tablename MATCH (dbname.fieldname) AGAINST 'Figs'
[/snip]

A. Belongs on a SQL list (and there are plenty)
2. SELECT * FROM dbname.tablename WHERE (dbname.fieldname) LIKE '%Figs%'

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



Re: [PHP] Keyword Search

2004-04-06 Thread Richard Davey
Hello Robb,

Tuesday, April 6, 2004, 5:24:55 PM, you wrote:

RK I need to do a search on this field to return all of the records containing
RK Figs. What's the search syntax?

RK I've tried...
RK SELECT * from dbname.tablename MATCH (dbname.fieldname) AGAINST 'Figs'
RK It doesnt' work.

Does the keywords table have a fulltext index on it? If so the above
would work, but only if you have reduced the minimum word length
allowed.

You could just do:

SELECT * FROM table WHERE keyword LIKE '%Figs%'

?

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



RE: [PHP] Array_keys problem

2004-04-06 Thread Ford, Mike [LSS]
On 04 April 2004 01:13, Robin 'Sparky' Kopetzky wrote:

   function key_exists($ps_key)
   {
   if ( in_array($ps_key,
 array_keys($this-ma_arguments)) ) {
 return true;
  } else {
 return false;
  }
   }

Ummm --

   function key_exists($ps_key)
   {
  return array_key_exists($ps_key, this-ma_arguments);
   }

?

(Assuming it's passed the is_array() test, of course!)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



Re: [PHP] Keyword Search

2004-04-06 Thread Robb Kerr
On Tue, 6 Apr 2004 11:25:09 -0500, Jay Blanchard wrote:

 [snip]
 I've inherited a database so must live with a less than elegant
 structure.
 The table contains one keyword field into which the author has entered
 things like...
 
 Record 1 = Apples
 Record 2 = Apples, Bananas
 Record 3 = Apples, Figs
 Record 4 = Bananas, Figs, Dates
 
 I need to do a search on this field to return all of the records
 containing
 Figs. What's the search syntax?
 
 I've tried...
 SELECT * from dbname.tablename MATCH (dbname.fieldname) AGAINST 'Figs'
 [/snip]
 
 A. Belongs on a SQL list (and there are plenty)
 2. SELECT * FROM dbname.tablename WHERE (dbname.fieldname) LIKE '%Figs%'

Thanx for the advice. I'll give it a try. BTW, I know that some of my
questions belong on a SQL list. Can you recommend any? I haven't found any
as active or helpful as this PHP one.
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

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



RE: [PHP] Keyword Search

2004-04-06 Thread Jay Blanchard
[snip]
Thanx for the advice. I'll give it a try. BTW, I know that some of my
questions belong on a SQL list. Can you recommend any? I haven't found
any
as active or helpful as this PHP one.
[/snip]

Some of them depend on the database in question. For MySql
[EMAIL PROTECTED] is a good one. Many notables in the MySQL field
are there.

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



Re: [PHP] Re: Reusing MySQL Connections - Can it be done?

2004-04-06 Thread Justin Patrin
Red Wingate wrote:

[...]

I tried this, but, same results. If I store the Resource ID from a
mysql_pconnect() in $GLOBALS['_CONNECT_DB'] and then call...
   mysql_query($query, $GLOBALS['_CONNECT_DB']);
[...]

How are you setting the global?

[...]

I guess he said he is using $GLOBALS['_CONNECT_DB'] :-p
I was asking for the exact line of code...

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


Re: [PHP] smarty

2004-04-06 Thread Richard Harb
Tuesday, April 6, 2004, 5:33:03 PM, you wrote:

 hi all has anyone used smarty before? what do you think of it? I think it's
 pretty nice to seperate your script (code) from your design.

 i would like to hear your comments and if you have any alternatives let me
 know.

Hi,

I've used it on a few sites - and I sort of can't do without any more
:) - just kidding, but the clean seperation of logic and presentation
helps a lot creating maintainable code.

Speedwise it's very fast, no complaints there. There might have been a
couple limitation here and there (uhm - new versions took care of that
for me as well), but then you can write your own
extensions in no time and get around those as well.

Bottom line: I definitely recommend it.

Richard

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



Re: [PHP] php + lynx + grep

2004-04-06 Thread Brian L. Ollom
 Try
 
 $output = `lynx --source 
 http://weather.noaa.gov/weather/current/KTOL.html |grep -v
 '41-35-19N' |grep TOL | head -n 1`
 
 Those are backticks, not single quotes surrounding the
 command.

Backticks didn't work either.

I got it to work by using a cron to  the info into a text file
and then include()'d the text file in the website, but I'd
rather not have to rely on the cron job if I don't have to.


| Brian Ollom  |   |
| NiteHawke.Com|  http://www.nitehawke.com/|
| An Authorized Firefly Dealer |  email  [EMAIL PROTECTED]  |


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



Re: [PHP] php + lynx + grep

2004-04-06 Thread Brian L. Ollom
 Functions like system, exec etc aren't supported by most ISP
 ( at least over here in germany ). But you might give 
 
 file_get_contents();
 file();
 ...
 
 a look as they can read the output of HTTP request which might
 be easier:
 
 $var = file
 ( 'http://weather.noaa.gov/weather/current/KTOL.html' );
 foreach ( $var AS $line ) {
 if ( preg_match( 41-35-19N , $var ) )
... etc pp
 }

I am the ISP, but I'll try that and see if it helps...  (o;


| Brian Ollom  |   |
| NiteHawke.Com|  http://www.nitehawke.com/|
| An Authorized Firefly Dealer |  email  [EMAIL PROTECTED]  |


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



[PHP] combining variables...

2004-04-06 Thread Tristan . Pretty
Simply put, can I connect 2 variables, to make one...

I want to output:
$view_request_$i

making for example a string:
view_all_2

But I'm getting errors..?
Parse error: parse error in /home/risk/public_html/download/results3.php 
on line 675

is there a simple explination...?


*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***

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



Re: [PHP] php + lynx + grep

2004-04-06 Thread John Nichel
Brian L. Ollom wrote:
Try

$output = `lynx --source 
http://weather.noaa.gov/weather/current/KTOL.html |grep -v
'41-35-19N' |grep TOL | head -n 1`

Those are backticks, not single quotes surrounding the
command.


Backticks didn't work either.

I got it to work by using a cron to  the info into a text file
and then include()'d the text file in the website, but I'd
rather not have to rely on the cron job if I don't have to.

| Brian Ollom  |   |
| NiteHawke.Com|  http://www.nitehawke.com/|
| An Authorized Firefly Dealer |  email  [EMAIL PROTECTED]  |

What's the output you're looking for.  When I run that line of code, and 
echo out $output, I get...

TDFONT FACE=Arial,Helvetica  KTOL 061552Z 22013KT 10SM CLR 11/M03 
A3001 RMK AO2 SLP164 T0033

--
***
*  _  __   __  __   _  * John  Nichel *
* | |/ /___ __ \ \/ /__ _ _| |__ ___  __ ___ _ __  * 716.856.9675 *
* | ' / -_) _` \ \/\/ / _ \ '_| / /(_-_/ _/ _ \ '  \ * 737 Main St. *
* |_|\_\___\__, |\_/\_/\___/_| |_\_\/__(_)__\___/_|_|_|* Suite #150   *
*  |___/   * Buffalo, NY  *
* http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 *
***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] combining variables...

2004-04-06 Thread Richard Davey
Hello Tristan,

Tuesday, April 6, 2004, 6:14:19 PM, you wrote:

TPrsc Simply put, can I connect 2 variables, to make one...

TPrsc I want to output:
TPrsc $view_request_$i

TPrsc making for example a string:
TPrsc view_all_2

I believe it's $view_request_$$i

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



[PHP] xml_set_default_handler under php5

2004-04-06 Thread Hundiak, Arthur
I can't seem to get xml_set_default_handler to work under php5RC1.

I made a very simple test case but the handler just does not seemed to be
getting called.  It works under 4.3.4.

I gather the xml_ routines now use libxml2 instead of expat.  I have libxml2
2.6.5 which is pretty recent.

Anyone else having problems with xml_set_default_handler?

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



Re: [PHP] combining variables...

2004-04-06 Thread Tristan . Pretty
Sadly, it didnb't work...

here's my code... I wanna repeat and output final variables 6 times...

==

for ($i = 1; $i = 6; $i++) {

if ($view_request_bu_$i != '') {
$view_request_$i = strtolower($view_request_bu_$i);
} else if ($view_request_email_$i != '') {
$view_request_$i = strtolower($view_request_email_$i);
} else if ($view_request_company_$i != '') {
$view_request_$i = strtolower($view_request_company_$i);
} else if ($view_request_datestart_$i != '') {
$view_request_$i = date;
} else if ($view_request_filename_$i != '') {
$view_request_$i = strtolower($view_request_filename_$i);
} else if ($view_request_filecat_$i != '') {
$view_request_$i = strtolower($view_request_filecat_$i);
} else if ($view_request_filetype_$i != '') {
$view_request_$i = strtolower($view_request_filetype_$i);
} else if ($view_request_display_name_$i != '') {
$view_request_$i = 
strtolower($view_request_display_name_$i);
} else if ($view_request_region_$i != '') {
$view_request_$i = strtolower($view_request_region_$i);
} else if ($view_request_id_$i != '') {
$view_request_$i = strtolower($view_request_id_$i);
} else {
$view_request_$i = Error;
}

}

=





Richard Davey [EMAIL PROTECTED] 
06/04/2004 18:27
Please respond to
Richard Davey [EMAIL PROTECTED]


To
[EMAIL PROTECTED]
cc

Subject
Re: [PHP] combining variables...






Hello Tristan,

Tuesday, April 6, 2004, 6:14:19 PM, you wrote:

TPrsc Simply put, can I connect 2 variables, to make one...

TPrsc I want to output:
TPrsc $view_request_$i

TPrsc making for example a string:
TPrsc view_all_2

I believe it's $view_request_$$i

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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





*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***

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



[PHP] Re: combining variables...

2004-04-06 Thread K.Bogac Bokeer
$i   = 2;
$var = view_request_$i;
$value = $$var;
Tristan Pretty wrote:
Simply put, can I connect 2 variables, to make one...

I want to output:
$view_request_$i
making for example a string:
view_all_2
But I'm getting errors..?
Parse error: parse error in /home/risk/public_html/download/results3.php 
on line 675

is there a simple explination...?

*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: combining variables...

2004-04-06 Thread Richard Davey
Hello K.Bogac,

Tuesday, April 6, 2004, 6:34:50 PM, you wrote:

KBB $i   = 2;
KBB $var = view_request_$i;
KBB $value = $$var;

That's it, I knew there was a variable variable ($$) in there
somewhere :)

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP] php + lynx + grep

2004-04-06 Thread John Nichel
Brian L. Ollom wrote:
What's the output you're looking for.  When I run that line of
code, and echo out $output, I get...
TDFONT FACE=Arial,Helvetica  KTOL 061552Z 22013KT 10SM
CLR 11/M03 A3001 RMK AO2 SLP164 T0033


On a website or command line? Command line is the easy part, but
I'm having problems getting that to work on a web site.

| Brian Ollom  |   |
| NiteHawke.Com|  http://www.nitehawke.com/|
| An Authorized Firefly Dealer |  email  [EMAIL PROTECTED]  |

ForPilot's - Software for your piloting needs!
http://www.forpilots.com/
Great Deals on Great Pilot Supplies!
http://www.acespilotshop.com/cgi-bin/ares.cgi?ID=240400532
Want deals on other great stuff?  Click here!
http://www.dollardays.com/index.asp?affilid=385

This is the exact code I used, and hit via a browser

?php

$output = `lynx --source 
http://weather.noaa.gov/weather/current/KTOL.html |grep -v '41-35-19N' 
|grep TOL | head -n 1`;
echo ( $output );

?

--
***
*  _  __   __  __   _  * John  Nichel *
* | |/ /___ __ \ \/ /__ _ _| |__ ___  __ ___ _ __  * 716.856.9675 *
* | ' / -_) _` \ \/\/ / _ \ '_| / /(_-_/ _/ _ \ '  \ * 737 Main St. *
* |_|\_\___\__, |\_/\_/\___/_| |_\_\/__(_)__\___/_|_|_|* Suite #150   *
*  |___/   * Buffalo, NY  *
* http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 *
***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Connecting to Databases

2004-04-06 Thread gohaku
On Apr 6, 2004, at 10:57 AM, Robb Kerr wrote:

I know that this message is more related to MySQL than PHP but I don't 
know
of a good MySQL board. This board is VERY active and useful.
Have you checked out MySQL General Discussion over at:
http://lists.mysql.com/ ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php + lynx + grep

2004-04-06 Thread gohaku


On Apr 6, 2004, at 12:53 PM, Brian L. Ollom wrote:

Try

$output = `lynx --source
http://weather.noaa.gov/weather/current/KTOL.html |grep -v
'41-35-19N' |grep TOL | head -n 1`
Those are backticks, not single quotes surrounding the
command.
I use following to retrieve output with Lynx:
$out = `lynx -dump -source http://localhost`;

Backticks didn't work either.

I got it to work by using a cron to  the info into a text file
and then include()'d the text file in the website, but I'd
rather not have to rely on the cron job if I don't have to.

| Brian Ollom  |   |
| NiteHawke.Com|  http://www.nitehawke.com/|
| An Authorized Firefly Dealer |  email  [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] Validating form field text input to be a specific variable type

2004-04-06 Thread Merritt, Dave
All,

I have a form on which the user is supposed to select a variable type
(boolean, integer, real, date/time, text) from a select box and enter the
default value for this selected variable type in a text box.  I'm trying to
validate that the default value entered matches the variable type selected
i.e. user selects boolean so valid defaults could only be 0, 1, true, false
and anything else would generate an error, or the user selects integer and
enters 1.7 for the default would also throw a flag.  I know that all of the
form values submitted from the web page are strings but is there a way to
test/convert the strings against the other variable types.

I'm sure that I'm not explaining this very well, but for example, if I use
the following code I will always get an error displayed even if the user
enters a valid value such as 3 in the default field because the form values
are always submitted as strings.  

if ( ($GLOBALS['PageOptions']['Type'] == 'Integer') and (!
is_int($GLOBALS['PageOptions']['Default']) ) )
{
// display an error
}

If I use (int) on the form default value then that won't work either because
if the default field value entered was not an integer but text such as
'snafu' then the value is always converted to an integer regardless.

if ( ($GLOBALS['PageOptions']['Type'] == 'Integer') and (! is_int((int)
$GLOBALS['PageOptions']['Default']) ) )
{
// display an error
}

Thanks in advance,

Dave Merritt
[EMAIL PROTECTED]

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



Re: [PHP] combining variables...

2004-04-06 Thread Christian Jerono
Guess it will work this way (think it's the right syntax :-))

for ($i = 1; $i = 6; $i++) {
if (${'view_request_bu_'.$i} != '') {
...
}
}

etc pp.

Am Dienstag, 6. April 2004 19:24 schrieb [EMAIL PROTECTED]:
 Sadly, it didnb't work...

 here's my code... I wanna repeat and output final variables 6 times...

 ==

 for ($i = 1; $i = 6; $i++) {

 if ($view_request_bu_$i != '') {
 $view_request_$i = strtolower($view_request_bu_$i);
 } else if ($view_request_email_$i != '') {
 $view_request_$i = strtolower($view_request_email_$i);
 } else if ($view_request_company_$i != '') {
 $view_request_$i = strtolower($view_request_company_$i);
 } else if ($view_request_datestart_$i != '') {
 $view_request_$i = date;
 } else if ($view_request_filename_$i != '') {
 $view_request_$i = strtolower($view_request_filename_$i);
 } else if ($view_request_filecat_$i != '') {
 $view_request_$i = strtolower($view_request_filecat_$i);
 } else if ($view_request_filetype_$i != '') {
 $view_request_$i = strtolower($view_request_filetype_$i);
 } else if ($view_request_display_name_$i != '') {
 $view_request_$i =
 strtolower($view_request_display_name_$i);
 } else if ($view_request_region_$i != '') {
 $view_request_$i = strtolower($view_request_region_$i);
 } else if ($view_request_id_$i != '') {
 $view_request_$i = strtolower($view_request_id_$i);
 } else {
 $view_request_$i = Error;
 }

 }

 =





 Richard Davey [EMAIL PROTECTED]
 06/04/2004 18:27
 Please respond to
 Richard Davey [EMAIL PROTECTED]


 To
 [EMAIL PROTECTED]
 cc

 Subject
 Re: [PHP] combining variables...






 Hello Tristan,

 Tuesday, April 6, 2004, 6:14:19 PM, you wrote:

 TPrsc Simply put, can I connect 2 variables, to make one...

 TPrsc I want to output:
 TPrsc $view_request_$i

 TPrsc making for example a string:
 TPrsc view_all_2

 I believe it's $view_request_$$i

 --
 Best regards,
  Richard Davey
  http://www.phpcommunity.org/wiki/296.html

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





 *
 The information contained in this e-mail message is intended only for
 the personal and confidential use of the recipient(s) named above.
 If the reader of this message is not the intended recipient or an agent
 responsible for delivering it to the intended recipient, you are hereby
 notified that you have received this document in error and that any
 review, dissemination, distribution, or copying of this message is
 strictly prohibited. If you have received this communication in error,
 please notify us immediately by e-mail, and delete the original message.
 ***

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



[PHP] Re: PHP Access Violation using PEAR::Mail_smtp

2004-04-06 Thread Ben Ramsey
I've asked about PHP Access Violation errors before (this very same 
error, as a matter of fact), and every time I ask, I get no response. 
It's been 24 hours, and no one on php-general, pear-general, or #php and 
#pear in Freenode IRC has responded to this particular post.

Do I smell bad?

Please forgive me for refreshing my own post to the list, but this is an 
important question, and it is time-sensitive.  Any help or pointers 
would be greatly appreciated, as I cannot get around this issue at all.

Thanks,
Ben
Ben Ramsey wrote:

I'm getting the following error when using the Mail_smtp package from PEAR:

PHP has encountered an Access Violation at 0177A8B4

It does not occur everytime I use it, but even when send() returns true, 
e-mail messages are not being sent.  However, it all worked fine a week 
ago when I was testing it, and I don't think anything has changed to my 
installation of PHP.

I'm using PHP 5RC1 on a Windows Server 2003.  The localhost has no 
built-in mail functionality, so I cannot use mail().  I must use 
Mail_smtp to log in to the mail server.  I also have Net_SMTP and 
Net_Socket installed, and, like I said, when I first dropped in my code, 
all was working fine.

My code is, as follows:

code
require_once 'Mail/smtp.php';
$smtp_settings = array(
'host' = 'localhost',
'port' = '25',
'auth' = 'LOGIN',
'username' = 'username',
'password' = 'password'
);
$to = [EMAIL PROTECTED];
$msg = Line 1\nLine 2\nLine 3;
$headers = array(
'Subject'  = My Subject,
'From' = [EMAIL PROTECTED],
'Date' = date('r'),
'Content-Type' = 'text/plain',
'X-Mailer' = PHP/ . phpversion()
);
$mail = new Mail_smtp($smtp_settings);

if ($mail-send($to, $headers, $msg)) {
echo h2Sent successfully/h2;
} else {
echo h2Not sent/h2;
}
/code
If I don't get the access violation error, I get the message Sent 
successfully.  Yet, I don't receive any messages.

In the code for Mail_smtp (in Mail/smtp.php), I have added the following 
line just under the function declaration line for the send() method:

echo test;

When the access violation occurs, I get this line:

PHP has encountered an Access Violation at 0177A8B4test

 From this, it appears to me that the access violation is not occurring 
when the class tries to send mail, but sometime earlier than that. 
However, I do not know much more about these Access Violoations, other 
than PHP is trying to access memory that it doesn't have permission to 
access.  I couldn't find anything at bugs.php.net or through Google that 
helped much with this problem.

Any help would be greatly appreciated.  I am on a tight deadline, so any 
help ASAP would be even more greatly appreciated.  ;-)

--
Regards,
 Ben Ramsey
 http://benramsey.com
 http://www.phpcommunity.org/wiki/People/BenRamsey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Connecting to Databases

2004-04-06 Thread John W. Holmes
From: Robb Kerr [EMAIL PROTECTED]

 Unfortunately, SQLyog and Dreamweaver reside on the same machine. Should I
 create a new user for the database which is [EMAIL PROTECTED]? Why
would
 SQLyog require this while Dreamweaver does not? And, why doesn't identical
 connection information work on both applications?

Yes, but do the PHP scripts also run on the same machine or are the uploaded
to a server?

I know you already fixed it, so this may not matter.

---John Holmes...

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



Re: [PHP] function CreateDate i made doesnt work?

2004-04-06 Thread John W. Holmes
From: Andy B [EMAIL PROTECTED]

  Replace the above two lines with
 
  $time = date('YmdHis', mktime(0,0,0,$month,$day,$year);
 

 ok the function works now because when i echo the output of
 $_SESSION['add']['start_date'] it shows the right 14 digit timestamp for
the
 date i wanted to create... now the problem is getting it to echo on a page
 in a normal standard user readable format... i have the following line i
 used to attempt that with but still..no matter what i put in the form for
a
 date it returns monday january 15 2038..or in one instance of playing with
 it even ended up with december 31 1969... even though i put in the date i
 wanted ...
 say first saturday 9 (september) 2004
 here is the line i used: something must be wrong with it
 Start Date: ?echo date(l F j Y, $_SESSION['add']['start_date']);?

date() expects a UNIX timestamp. MMDDHHMMSS is NOT a UNIX timestamp. So,
instead of converting the UNIX timestamp to MMDDHHMMSS in your function,
why not leave it a UNIX timestamp? Then you can send it through date()
whenever you want it formatted.

---John Holmes...

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



Re: [PHP] Connecting to Databases

2004-04-06 Thread John W. Holmes
From: Robb Kerr [EMAIL PROTECTED]
 I solved the problem by adding my IP address to the Access Hosts list for
 the database. Fortunately I use a cable modem with a static IP address,
but
 if I were using a dialup with a dynamic IP, would I have to add that IP as
 an Access Host every time I dialed up? This seems wrong.

Well, even though the IP is dynamic, it's still generally within a certain
range. You could just assign the IP address using a wildcard: 192.128.4.%,
for example.

---John Holmes...

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



Re: [PHP] smarty

2004-04-06 Thread Chris de Vidal
Kelly Hallman said:
 Apr 6 at 5:33pm, Angelo Zanetti wrote:
 hi all has anyone used smarty before? what do you think of it? I think
 it's pretty nice to seperate your script (code) from your design.
 i would like to hear your comments and if you have any alternatives

 There are a lot of templating systems for PHP, but I chose Smarty because
 it seemed the most feature-laden, and likely to have continued support.
 I wanted to standardize on something, so I went for the most ubiquitous.
 Really, I couldn't be happier with it in every regard.

 At first it may seem like more than you need, but continue working with it
 and you'll find new design strategies that take you further than you ever
 thought you'd go. It's one of those things you start using and never look
 back. I use it on almost every project now, even small ones.

 There are the naysayers who complain it's too bloated for basic work,
 but I think the powerful benefits far outweigh any performance issues.
 I've never felt like it was slow or too much for a given task.

Given that scripts are compiled the first time they're ran, you'll never*
notice the bloat and never lack performance; it's the same as real PHP
code and can be optimized with a caching engine like Zend.

* OK so you will notice it the first time and if you make any changes to
the file.


I just used it for the first time since I am trying to work with a real
estate agent who only had time to learn Front Page (yuk).  We were in a
tight spot, because she'd make a change to the website and I'd have to
chase after her because Front Page screwed up the code (the RocketPHP
plugin was buggy, at best, and didn't allow her to flow).

For our next site, she'll mock up everything in Front Page how she wants
it to look then I'll add template tags and business logic.  Whee!
Separation of code from design, at last!

It will be tempting to put all logic in the PHP but you might need some
logic in the template; for example, we have a level check: If the user is
at a low level he/she won't get fancy options on his profile.  This
required outputting HTML.

I could have put a tag in the template like {bio} but that'd mean
maintaining HTML in the PHP code which I wanted to avoid (left the
prettyness to the Front Page developer).  Instead, I put something like
this in the template:
{if $level  2}
 {bio}
{/if}

It's extremely low-level.  I can leave the code which fetches the $level
in the PHP code and just have the checks in the template.

Hopefully you get the idea; you are recommended to leave presentation
logic in the template but all other logic should be in the back end PHP
file.

Smarty is a great templating engine which is easy to install and use on
any sized project and I highly recommend it.

/dev/idal

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



Re: [PHP] combining variables...

2004-04-06 Thread John W. Holmes
From: [EMAIL PROTECTED]
 I want to output:
 $view_request_$i

echo ${'view_request_'.$i};
echo ${view_request_$i};

Read the manual section on Variable Variables, please. 

---John Holmes...

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



[PHP] [php 5] static class variable question

2004-04-06 Thread Bill Zeller
[PHP5 RC1, Windows XP Pro]
Hi,

I have a few classes called Audio, System, etc. In order to not pollute the
namespace (if someone else has a System class, for example), I'd like to
separate my classes. One way of doing this would be to preprend each class
with some text, to make my classes something like myProject_Audio,
myProject_System, myProject_Whatever. I would much rather be able to do
something like myProject::Audio, myProject::System. I would like to do this
by creating a class called myProject and having Audio and System be static
variables, referring to the classes Audio and System. The Audio and System
variables in class myProject would act as an alias to the Audio and System
classes.

I can access myProject::someVar fine when someVar is any variable, but I'm
unable to call:

$audio = new myProject::Audio;

Is there any way to do this? Should I create a static function Audio() in
class myProject and forward the variables to the Audio class? If I did that
I could call

$audio = new myProject::Audio(); or
$audio = new myProject::Audio(var1, var2);

but then it would be hard to access variables in class Audio (because you
can't do myProject::Audio()::someVarInAudio because Parse error: parse
error, unexpected T_PAAMAYIM_NEKUDOTAYIM)

Thanks,

Best Regards,
Bill Zeller

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



[PHP] Using Amazon Web Services - Publisher Results

2004-04-06 Thread Nicole
I read these 2 articles to get me started with using Amazon Web Services:

http://www.devshed.com/c/a/PHP/Usin...-SOAP-part-1/ 
http://www.devshed.com/c/a/PHP/Usin...-SOAP-part-2/

I have a page with a Table of Contents linking to specific Browse Nodes that
would be of interest to our viewers.

I'd like to add a link to a results page with books published by Nolo Press.
To do this I'm passing the name nolo via the link.

Here is the code I have so far.  Note, that it works perfectly when I only
want to see a list from a Browse Node.

CODE::

//get publisher information
$publisher = $_GET['publisher'];
if ($publisher == nolo)
{
  $publisher = Nolo Press;
}

// if keyword is set, get those results
if (isset($keyword))
{
$catalogParams = array(
'keyword' = htmlentities($keyword),
'page' = $page,
'mode' = 'books',
'tag' = 'tag',
'sort' = '+pmrank',
'type' = 'lite',
'devtag'= 'tag'
);

// invoke the method
$result = $proxy-KeywordSearchRequest($catalogParams);
$catalogItems = $result['Details'];
$catalogTotal = $result['TotalResults'];
}
else
{
// get items from the catalog
// sort order is default
$catalogParams = array(
'browse_node' = $node,
'page'= $page,
'mode'= 'books',
'tag' = 'tag',
'type'= 'heavy',
'devtag'  = 'tag'
);
$catalogResult = $proxy-BrowseNodeSearchRequest($catalogParams);
$catalogTotal = $catalogResult['TotalResults'];
$catalogItems = $catalogResult['Details'];
}

if (isset($publisher))
{
//THE FOLLOWING LINE IS LINE 115
foreach ($catalogItems as $i)
{
  if($i['Manufacturer'] == $publisher)
  {
   $catalogParams = array(
'browse_node' = $node,
  'page'= $page,
  'mode'= 'books',
  'tag' = 'tag',
  'type'= 'heavy',
  'devtag'  = 'tag'
   );

   $catalogResult = $proxy-BrowseNodeSearchRequest($catalogParams);
   $catalogTotal = $catalogResult['TotalResults'];
   $catalogItems = $catalogResult['Details'];
  }
}
}

// format and display the results
?

!-- inner catalog table --

  table border=0 cellspacing=5 cellpadding=0
  ?

  // parse the $items[] array and extract the necessary information
  // (image, price, title, author, item URL)
//THE FOLLOWING LINE IS LINE 209
  foreach ($catalogItems as $i)
  {
  ?
  tr
  td align=center valign=top rowspan=3
a href=book.php?asin=? echo $i['Asin']; ?
img border=0 src=? echo $i['ImageUrlSmall']; ?/a/td
  tdba href=book.php?asin=? echo $i['Asin']; ?
? echo $i['ProductName']; ?/a/b /
? echo implode(, , $i['Authors']); ?/td
  /tr
  tr
  td align=left valign=topfont size=-1
!--List Price: ? echo $i['ListPrice']; ? / Amazon.com--
Price: ? echo $i['OurPrice']; ? / Used Price:
? echo $i['UsedPrice'] ?
/font/td
  /tr
  tr
  td colspan=2nbsp;/td
  /tr
  ?
  }
  ?
  /table
--
END CODE

I get this error only if $publisher is set (these lines are marked above):

Warning: Invalid argument supplied for foreach()
in /home/www/palawport/amazon/sample7.php on line 115

Warning: Invalid argument supplied for foreach()
in /home/www/palawport/amazon/sample7.php on line 209

I did a little test and tried to see if catalogItems had any data.  The
following code ONLY returned the Publisher ... nothing else.

print_r($catalogItems);
print p;
print_r($publisher);
print p;
print_r($keyword);
exit;

Suggestions are welcome :)

Thanks
Nicole

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



RE: [PHP] smarty

2004-04-06 Thread Chris W. Parker
Chris de Vidal mailto:[EMAIL PROTECTED]
on Tuesday, April 06, 2004 11:43 AM said:

 I could have put a tag in the template like {bio} but that'd mean
 maintaining HTML in the PHP code which I wanted to avoid (left the
 prettyness to the Front Page developer).  Instead, I put something
 like this in the template:
 {if $level  2}
  {bio}
 {/if}

i've never used smarty* but i think i understand how it works. so my
question is this...

would it not be better to place that logic in your php code instead of
your template?

my thinking is this: if {bio} contains anything, it will print to the
page. if it doesn't contain anything, nothing will be printed. so
there's no need to check the value of $level within the template since
{bio} will simply contain something, or it will not.

i'm purely looking to understand this smarty thing a little better. :)


chris.


* i did try it once or twice in the past, with little things but didn't
quite grasp it.

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



[PHP] Re: [php 5] static class variable question

2004-04-06 Thread Bill Zeller
A note:

 by creating a class called myProject and having Audio and System be static
 variables, referring to the classes Audio and System. The Audio and System

This should be constant, not static. Sorry.

-bill
Bill Zeller [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 [PHP5 RC1, Windows XP Pro]
 Hi,

 I have a few classes called Audio, System, etc. In order to not pollute
the
 namespace (if someone else has a System class, for example), I'd like to
 separate my classes. One way of doing this would be to preprend each class
 with some text, to make my classes something like myProject_Audio,
 myProject_System, myProject_Whatever. I would much rather be able to
do
 something like myProject::Audio, myProject::System. I would like to do
this
 by creating a class called myProject and having Audio and System be static
 variables, referring to the classes Audio and System. The Audio and System
 variables in class myProject would act as an alias to the Audio and System
 classes.

 I can access myProject::someVar fine when someVar is any variable, but I'm
 unable to call:

 $audio = new myProject::Audio;

 Is there any way to do this? Should I create a static function Audio() in
 class myProject and forward the variables to the Audio class? If I did
that
 I could call

 $audio = new myProject::Audio(); or
 $audio = new myProject::Audio(var1, var2);

 but then it would be hard to access variables in class Audio (because you
 can't do myProject::Audio()::someVarInAudio because Parse error: parse
 error, unexpected T_PAAMAYIM_NEKUDOTAYIM)

 Thanks,

 Best Regards,
 Bill Zeller

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



[PHP] Re: GD installation

2004-04-06 Thread Shimi
Please im desperet for help!
Shimi [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 im having a problem installing the GD library
 OS - Windows XP Pro
 PHP - 4.3.5
 i tried in the PHP.INI get the ; of the line with the GD extension
 and im getting an error that the file not found
 ./php_gd2.dll
 i tried to copy the file to main PHP folder and WINDOWS\SYSTEM32
 nothing seems to be working
 the i tried to change the extension path to th main php folder
 and it still didnt work although the file is there

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



Re: [PHP] smarty

2004-04-06 Thread John W. Holmes
From: Chris de Vidal [EMAIL PROTECTED]

 I could have put a tag in the template like {bio} but that'd mean
 maintaining HTML in the PHP code which I wanted to avoid (left the
 prettyness to the Front Page developer).  Instead, I put something like
 this in the template:
 {if $level  2}
  {bio}
 {/if}

Rather than putting logic into your presentation layer, the whole bio
content should be a separate template. You then make the decision to either
load the template into $bio or not from within PHP. So {$bio} will either be
an empty string or the content of the other template, depending upon your
PHP logic. And you still maintain the separation of presentation and
code...

---John Holmes...

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



Re: [PHP] combining variables...

2004-04-06 Thread Curt Zirzow
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]):
 Sadly, it didnb't work...
 
 here's my code... I wanna repeat and output final variables 6 times...

 
 ==
 
 for ($i = 1; $i = 6; $i++) {
 
 if ($view_request_bu_$i != '') {
 $view_request_$i = strtolower($view_request_bu_$i);
 } else if ($view_request_email_$i != '') {
 $view_request_$i = strtolower($view_request_email_$i);

You might also want to look at how you can pass variables as arrays
so you dont have to do all these needless checking.

   input name=view_request[email][]
   input name=view_request[company][]

foreach($view_request as $key = $list) {
   for ($i = 1; $i = 6; $i++) {
 if ($list[$i] != '') {
   $view_request[$key][$i] = strtolowert($list[$i]);
 } else {
   $view_request[$key][$i]  = Error;;
   $view_request_$i = 
 }
   }
}

see: http://php.net/variables.external

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Validating form field text input to be a specific variable type

2004-04-06 Thread John W. Holmes
From: Merritt, Dave [EMAIL PROTECTED]

 I have a form on which the user is supposed to select a variable type
 (boolean, integer, real, date/time, text) from a select box and enter the
 default value for this selected variable type in a text box.  I'm trying
to
 validate that the default value entered matches the variable type selected
 i.e. user selects boolean so valid defaults could only be 0, 1, true,
false
 and anything else would generate an error, or the user selects integer and
 enters 1.7 for the default would also throw a flag.  I know that all of
the
 form values submitted from the web page are strings but is there a way to
 test/convert the strings against the other variable types.

 I'm sure that I'm not explaining this very well, but for example, if I use
 the following code I will always get an error displayed even if the user
 enters a valid value such as 3 in the default field because the form
values
 are always submitted as strings.

Well, if (int)$string == $string, then the value is an integer. Same for
(float)$string == $string for a real number. Boolean would be easy, just
strtolower($string) as compare to 1, 0, 'true', or 'false'. Date/time
validation will probaby require a regular expression or breaking it up to
validate days/month, etc. That can get a little hairy. If they say text,
well, anything goes, right? Maybe just make sure it's not empty()?

Let me know if you need more details. There are probably a ton of different
ways to do this.

---John Holmes...

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



Re: [PHP] Keyword Search

2004-04-06 Thread John W. Holmes
From: Robb Kerr [EMAIL PROTECTED]

 I've inherited a database so must live with a less than elegant structure.
 The table contains one keyword field into which the author has entered
 things like...

 Record 1 = Apples
 Record 2 = Apples, Bananas
 Record 3 = Apples, Figs
 Record 4 = Bananas, Figs, Dates

 I need to do a search on this field to return all of the records
containing
 Figs. What's the search syntax?

SELECT * FROM table WHERE FIND_IN_SET('Figs',fieldname)

---John Holmes...

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



[PHP] Not exactly PHP....

2004-04-06 Thread Shimi
can anyone email me explaining me how to crate my own news group? for
free...

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



Re: [PHP] smarty

2004-04-06 Thread Kelly Hallman
Apr 6 at 2:43pm, Chris de Vidal wrote:
 Given that scripts are compiled the first time they're ran, you'll
 never* notice the bloat and never lack performance; it's the same as
 real PHP code and can be optimized with a caching engine like Zend.

Certainly. However, the Smarty compiler is about 2200 lines of code, and
the Smarty class itself (which does load every time) is about 2000. Both
figures rounded up, and both files contain heaps of comments.  

Still, many people consider this bloat, if they're merely wanting to
search and replace a couple of values on an HTML template.

Those people are not really leveraging a template system, but if that's
all you wanted to do--ever--I can see why the additional overhead would be
undesirable. After all, a simple search and replace for a few values
doesn't require 4000 lines of code parsed (or 2000, after compilation).

 OK so you will notice it the first time and if you make any changes

Yes, and whenever your cached/compiled template has expired.

 For our next site, she'll mock up everything in Front Page how she wants
 it to look then I'll add template tags and business logic.  Whee!
 Separation of code from design, at last!

Working with others is one of the main benefits of a templating system. It 
doesn't matter then if it's FrontPage code or not, at least you, as the 
developer, don't have to muck with it. And it's easier to clean up later.

 It will be tempting to put all logic in the PHP but you might need some
 logic in the template; for example, we have a level check...

I'd go a step further and suggest using as much logic in the template as
possible. In a basic sense, it's display logic, not application logic.

 Instead, I put something like this in the template:
 {if $level  2}{bio}{/if}

Again, take it a step further and you may just load up a $User object (of 
your design) within your PHP code. Then in the template, you could use:

{if $User-hasPermission('write')} ... {/if}

When you start thinking like this, your PHP logic gets very slim and easy 
to read and maintain. This is the goal and benefit of templating.

A common reaction when starting to work with Smarty is you mean I need to
assign each variable into the template one-by-one?! On a certain level
this is true. But as illustrated above, you can also pass arrays, objects
and other complex data structures into your template.

It becomes especially powerful when working on a larger web app. You
needn't assign your values into the template from each PHP page. You can
make a boilerplate include and assign common variables as references:

// boiler.php
$pt = new Smarty;
$pt-assign_by_ref('User',$User);

// mypage.php
require boiler.php;
$User-doStuff();
$User-admin = true;
$pt-display('template.tpl');

So you can attach references right off the bat in an include, then every
time you use that include, you've already got things assigned and can
change them all you want before displaying, without additional assignment.

Going even one step further (the beauty of Smarty: always another level),
just extend the Smarty object itself. Then, instead of making all your
templates includes other templates (such as a header or a footer), you can
make your overall page be a template, and the extended Smarty object can 
be given extra functionality to control the page:

{* MyPage.tpl -- Smarty template for the entire page *}
...header...
{include file=$content}
...footer...

// mypage.php -- extended Smarty object
class MyPage extends Smarty {
   var $tmpl = 'MyPage.tpl';
   function render($x) {
  $this-assign('content',$x);
  $this-display($this-tmpl); } }

// actualphpcode.php -- called by the browser
$pt = new MyPage;
$pt-render('pagecontent.tpl');

Now, is Smarty awesome, or what? :)
--Kelly

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



RE: [PHP] Not exactly PHP....

2004-04-06 Thread Jay Blanchard
[snip]
can anyone email me explaining me how to crate my own news group? for
free...
[/snip]

First, you get a box (sometimes known as a crate)

Brought to you by the This Message Didn't Cost You a Dime  May Have
Brought A Smile To Another's Face Committee, R. Feynman, Treasurer

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



[PHP] Pulling Certain Data

2004-04-06 Thread Jason T. Davidson
Community-

 

I am a first time databaser and am having trouble pulling information from a
database to display on a site.  Not every entry is supposed to show up on
the web page, but does so.  I have tried IF statements without any help.
Here is what I have so far:

 

?

$r1=SELECT * FROM $main_tbl;

$rsql=mysql_query($r1,$db);

?

 

body text=#66 link=#66 vlink=#66 alink=#66

table width=600

  tr

td

  font size=5ZMP Rosters/fontfont size=5 - font
size=2a
href=http://www.vatusa.org/html/modules.php?op=modloadname=PN_Contentfile
=indexreq=visitartid=26VATUSA listing/a/font/font/td

  /tr

/table

br/br

table width=600

  tr

td

  font size=5Active Controllers/font/td

  /tr

/table

table width=600

tr bgcolor=#99

td width=180div align=centerfont
size=3strongCONTROLLER/strong/font/div/td

td width=60div align=centerfont
size=3strongCID/strong/font/div/td

td width=100div align=centerfont
size=3strongRATING/strong/font/div/td

td width=130div align=centerfont
size=3strongPOSITION/strong/font/div/td

td width=130div align=centerfont
size=3strongDATE JOINED/strong/font/div/td

/tr

?

while ($a_row=mysql_fetch_array($rsql))

{

?

tr bgcolor=#CC

td width=180 align=leftfont size=2? echo
$a_row[LNAME], $a_row[FNAME];?/font/td

td width=60 align=centerfont size=2? echo
$a_row[CID];?/font/td

td width=100 align=centerfont size=2?
echo $a_row[RATING];?/font/td

td width=130 align=centerfont size=2?
echo $a_row[POSITION];?/font/td

td width=130 align=centerfont size=2?
echo $a_row[JDATE];?/font/td

/tr

?}

?

/table

/body

 

 

 

I would like to only show people who are active within our roster and within
the database I have identified those people by putting a A, I or L
depending on their status with our organization.  I guess I am looking for a
way for the code to see how that person is labeled and then put them in the
proper roster.

 

www.zmpartcc.com/roster/roster.php

 

--

Jason T. Davidson

 



RE: [PHP] Not exactly PHP....

2004-04-06 Thread Chris W. Parker
Jay Blanchard mailto:[EMAIL PROTECTED]
on Tuesday, April 06, 2004 12:37 PM said:

 [snip]
 can anyone email me explaining me how to crate my own news group? for
 free...
 [/snip]
 
 First, you get a box (sometimes known as a crate)
 
 Brought to you by the This Message Didn't Cost You a Dime  May Have
 Brought A Smile To Another's Face Committee, R. Feynman, Treasurer

:)!

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



RE: [PHP] Pulling Certain Data

2004-04-06 Thread Jay Blanchard
[snip]
I am a first time databaser and am having trouble pulling information
from a
database to display on a site.  Not every entry is supposed to show up
on
the web page, but does so.  I have tried IF statements without any help.
Here is what I have so far:

$r1=SELECT * FROM $main_tbl;
[/snip]

You need to learn some basic query skills, limit the request in the SQL
query. For instance...
$r1=SELECT * FROM $main_tbl WHERE firstName = 'John' ;

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



Re: [PHP] Pulling Certain Data

2004-04-06 Thread John W. Holmes
From: Jason T. Davidson [EMAIL PROTECTED]

 I am a first time databaser and am having trouble pulling information from
a
 database to display on a site.  Not every entry is supposed to show up on
 the web page, but does so.  I have tried IF statements without any help.
 Here is what I have so far:

 $r1=SELECT * FROM $main_tbl;

You need a WHERE clause to indicate any conditions that selected rows must
satisfy

http://www.mysql.com/doc/en/SELECT.html

SELECT * FROM $main_tbl WHERE code = 'a' OR code = 'b' OR something  1

for example.

---John Holmes...

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



Re: [PHP] Pulling Certain Data

2004-04-06 Thread hitek
Sounds like you need a where clause in your sql query:
$r1=SELECT * FROM $main_tbl where status='A';
replace 'status' with whatever you called the status field in your table.

Keith

At 12:40 PM 4/6/2004, Jason T. Davidson wrote:
Community-



I am a first time databaser and am having trouble pulling information from a
database to display on a site.  Not every entry is supposed to show up on
the web page, but does so.  I have tried IF statements without any help.
Here is what I have so far:


?

$r1=SELECT * FROM $main_tbl;

$rsql=mysql_query($r1,$db);

?



body text=#66 link=#66 vlink=#66 alink=#66

table width=600

  tr

td

  font size=5ZMP Rosters/fontfont size=5 - font
size=2a
href=http://www.vatusa.org/html/modules.php?op=modloadname=PN_Contentfile
=indexreq=visitartid=26VATUSA listing/a/font/font/td
  /tr

/table

br/br

table width=600

  tr

td

  font size=5Active Controllers/font/td

  /tr

/table

table width=600

tr bgcolor=#99

td width=180div align=centerfont
size=3strongCONTROLLER/strong/font/div/td
td width=60div align=centerfont
size=3strongCID/strong/font/div/td
td width=100div align=centerfont
size=3strongRATING/strong/font/div/td
td width=130div align=centerfont
size=3strongPOSITION/strong/font/div/td
td width=130div align=centerfont
size=3strongDATE JOINED/strong/font/div/td
/tr

?

while ($a_row=mysql_fetch_array($rsql))

{

?

tr bgcolor=#CC

td width=180 align=leftfont size=2? echo
$a_row[LNAME], $a_row[FNAME];?/font/td
td width=60 align=centerfont size=2? echo
$a_row[CID];?/font/td
td width=100 align=centerfont size=2?
echo $a_row[RATING];?/font/td
td width=130 align=centerfont size=2?
echo $a_row[POSITION];?/font/td
td width=130 align=centerfont size=2?
echo $a_row[JDATE];?/font/td
/tr

?}

?

/table

/body







I would like to only show people who are active within our roster and within
the database I have identified those people by putting a A, I or L
depending on their status with our organization.  I guess I am looking for a
way for the code to see how that person is labeled and then put them in the
proper roster.


www.zmpartcc.com/roster/roster.php



--

Jason T. Davidson


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


Re: [PHP] Not exactly PHP....

2004-04-06 Thread Christian Jerono
[...]
  [snip]
  can anyone email me explaining me how to crate my own news group? for
  free...
  [/snip]
 
  First, you get a box (sometimes known as a crate)
 
  Brought to you by the This Message Didn't Cost You a Dime  May Have
  Brought A Smile To Another's Face Committee, R. Feynman, Treasurer
 
 :)!
[...]

:))!

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



Re: [PHP] Not exactly PHP....

2004-04-06 Thread Red Wingate
[...]
  [snip]
  can anyone email me explaining me how to crate my own news group? for
  free...
  [/snip]
 
  First, you get a box (sometimes known as a crate)
 
  Brought to you by the This Message Didn't Cost You a Dime  May Have
  Brought A Smile To Another's Face Committee, R. Feynman, Treasurer
 
 :)!
[...]

:))!

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



[PHP] Thanks for all the helped!

2004-04-06 Thread Jason T. Davidson
Looks like I went to the right place as I got many responses and what gave
me three days of headaches only took 5 mintues.

 

Thanks Again!

 

-Jason T. Davidson



  1   2   >