[PHP] Re: Sorting multidim array and keeping associations

2004-12-11 Thread Peter Lauri
Stupid as I was, I did not do what I should have done :) In the origin the
array was created from a MySQL database. I did not sort it correctly from
there because I did not have the knowledge about the GROUP BY command, so I
tried to solve it via PHP. Now I have everything sorted and alright just by
making the Query correct.

/Peter


Peter Lauri [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 Best groupmember,

 I have an multidim array that looks something like this:

 [40] = [1]=32, [2]=55, [total]=87
 [22] = [8]=2, [7]=105, [total]=107
 [142] = [2]=3, [7]=8, [total]=11

 I want to sort this array according to the total and still keep the acc.
 with the basekey. I know I can easily do this by writing an function
myself.
 But are there any built in functions for this? I have looked at usort,
 uksort and more, but they do not seem to solve my problem.

 - Best Of Times
 /Peter

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



[PHP] Re: Data Access Object (DAO) with PHP

2004-12-11 Thread Shen Kong
Hi, do you mean ADODB? PEAR::DB? or DBX ?
Adwin Wijaya :
Hi,
Is there any mature DAO class for PHP (free) ?
thx


--
-- ShenKong (shenkong(at)php.net)
-- http://www.openphp.cn
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Question:maybe urldecode

2004-12-11 Thread Stuart Felenstein

--- Richard Lynch [EMAIL PROTECTED] wrote:

  I made the correction , using $_GET now.  Values
 are
  printing out, aside from the select lists (arrays)
  which print out as array.
 
 Yes.
 
 An array will print as Array
 
 You'll need to dig into the Array for what you need,
 or implode it, or
 something.
 
I'm imploding the arrays and the correct values are
returned.  Still this is what I'm struggling with:

If I put this querystring back into the url:

http://www.lurkingforwork.com/myownsearch.php?Ind[]=1JTitle=City=WinchesterDays=Recs=15Submit=Submit

The textfield City is repopulate with the value -
Winchester.
The select list Ind[] though is not.  

I thought perhaps I need to do a loop for the Ind[]
value, so I tried this:

select name=Ind[] size=8 multiple=multiple
id=Ind[] value=?php foreach ($Ind as $value) {
echo $value;}?

I was wrong there as well.  
Just to repeat.  I want to take the query string
created from the user's choices / search parameters
and repopulate the form by applying the querystring on
the form.  www.mysite.com/search?querystring.

Does this make sense ? Am I being clear in what I'm
asking ?

Stuart

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



[PHP] Data Access Object (DAO) with PHP

2004-12-11 Thread adwin wijaya
Hi,
Is there any mature DAO class for PHP (free) ?
thx
--
===
Best Regards
Adwin Wijaya
www.kuya-kuya.net
www.e-rhema.net
===
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Data Access Object (DAO) with PHP

2004-12-11 Thread Shen Kong
Hi, mybe you mean PDO:
http://pecl.php.net/package/PDO
http://www.zend.com/expert_qa/qas.php?id=93single=1
http://www.zend.com/expert_qa/qas.php?id=98single=1
Adwin Wijaya :
Shen Kong wrote:
  Hi, do you mean ADODB? PEAR::DB? or DBX ?
-- more advance than that i think. It is a class that will be created 
to access database as object like the one in Java.



--
-- ShenKong (shenkong(at)php.net)
-- http://www.openphp.cn
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP vs JSP?

2004-12-11 Thread Gareth Williams
Because you prefer it?
Seriously, you should choose what you are most happy with.  Both work 
fine, although, PHP rocks!

On 11 Dec 2004, at 10:11, Peter Lauri wrote:
Best groupmember,
Why should I choose PHP instead of JSP/Servlets when it comes to 
develop a
high-traffic site. Assume that the infrastructure for both are set up. 
It
only comes to efficiency (both coding and running)? What are your
experience?

--
- Best Of Times
/Peter Lauri
--
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] Clickable image maps

2004-12-11 Thread Kurt Blom
Hi all,
Can PHP handle with CIM's (Clickable Image Maps) to get data from a html 
page (instead of using checkboxes...)?
I searched the online doc for it but no matches.

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


[PHP] Question: Repopulating form parameters

2004-12-11 Thread Stuart Felenstein
I'm hoping that this question will be more succinct.
I am trying to repopulate a search form with a user's
chosen paramters.  I am running into a problem with
multiple select lists

First , this is the element when the form is first
presented to the user:

select name=Ind[] size=8 multiple=multiple
id=Ind[] 
?php while($row = mysql_fetch_array($inds,
YSQL_BOTH)) { echo 'option
value='.$row['CareerIDs'].''.$row['CareerCategories'].'/option';
}
?

So the element's option are taken from a table. 

Now I am grabbing the array and can print out the
chosen values correctly, either using an implode:

if (count($Ind)  0 AND is_array($Ind)) {
$Ind = '.implode(',', $Ind).';
}

or a for loop:

if (isset($Ind)) {
$j = count($Ind);
for($i=0; $i$j; $i++)
print_r($Ind[$i]);
}

What I can't do is getting the options that were
chosen to be highlighted in the select list.  
i.e if there are 5 options for user to choose from:
1-Banking 2-Arts 3-I.T. 4-Accounting 5-Retail

And user chooses 1-Banking and 5-Retail, when I
reapply the query string I want those 2 to be
highlighed in the options list.  
It is working fine for textfield.  

?Ind%5B%5D=1Ind%5B%5D=2JTitle=City=BronxDays=Recs=15Submit=Submit

If I apply the above query string, Bronx will be
populated in the Citytextfield
Not so, with the Ind[] array.

Anyone know what I am talking about ?

Stuart

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



Re: [PHP] Question: Repopulating form parameters

2004-12-11 Thread Stuart Felenstein
--- [EMAIL PROTECTED] wrote:

 you (just) need to mark the previously chosen items
 as selected in 
 the repopulated list. the highlighting part is a
 basic html/form 
 issue. i.e., if you have questions on this you
 should look at how, on 
 a simple (html-only) form, an item on a list is
 marked (highlighted) 
 as the default. obviously you have set up your code
 so that you know 
 what's been selected previously and then put out the
 necessary html 
 when you repopulate.
 
This makes sense, however I'm still spacing out trying
to figure out then where I place the option value
selected in this html / php code:

select name=Ind[] size=8 multiple=multiple
id=Ind[] 
?php while($row = mysql_fetch_array($inds,
MYSQL_BOTH)) { echo 'option
value='.$row['CareerIDs'].''.$row['CareerCategories'].'/option
'; ?

I'm pretty sure I need to loop through the $_Get of
the array.   Not sure , and haven't found anything
that shows this.

Stuart

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



[PHP] Re: Data Access Object (DAO) with PHP

2004-12-11 Thread Greg Beaver
Adwin Wijaya wrote:
Hi,
Is there any mature DAO class for PHP (free) ?
http://pear.php.net/DB_DataObject
Greg
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] allow_url_fopen ini directive not enough

2004-12-11 Thread KJ
Greg Donald wrote:
On Fri, 10 Dec 2004 22:00:43 +, KJ [EMAIL PROTECTED] wrote:

5. Joe Hacker has studied the script coz he's a tart that wants to piss
people off and he has found a vunerability.
6. Joe Hacker uses the vunerability to change your account passwd. He
then logs in as you and deletes all your files. He has access to your
mysql password which was in the congif file of phpMyFantasticGuestbook

Why would you allow your MySQL user to connect from anywhere besides
your web server?  Remote MySQL connections are a big no-no.
No remote connection, quote: Joe Hacker uses the vunerability to change 
your account passwd. He then logs in as you and deletes all your files. 
He's logged onto your box, local connection.


and he deletes all your data, he then leaves a nice index.php in your
account to say that he's been by.

Sorry to hear that, I'd recommend you stop using
phpMyFantasticGuestbook immediately.  And anything else you don't feel
paranoid about to audit.
phpMyFantasticGuestbook doesn't actually exist, it was a scenario to try 
to explain the issue.

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


Re: [PHP] Question: Repopulating form parameters

2004-12-11 Thread Jason Wong
On Saturday 11 December 2004 20:46, Stuart Felenstein wrote:
 --- [EMAIL PROTECTED] wrote:
  you (just) need to mark the previously chosen items
  as selected in
  the repopulated list. the highlighting part is a
  basic html/form
  issue. i.e., if you have questions on this you
  should look at how, on
  a simple (html-only) form, an item on a list is
  marked (highlighted)
  as the default. obviously you have set up your code
  so that you know
  what's been selected previously and then put out the
  necessary html
  when you repopulate.

 This makes sense, however I'm still spacing out trying
 to figure out then where I place the option value
 selected in this html / php code:

Inside the while loop.

Tip: (para-phrasing the above comments) in a WYSIWYG HTML editor create a form 
with a multiple select list box, make one or two of the items selected by 
default, examine the HTML source.

 select name=Ind[] size=8 multiple=multiple
 id=Ind[] 
 ?php while($row = mysql_fetch_array($inds,
 MYSQL_BOTH)) { echo 'option
 value='.$row['CareerIDs'].''.$row['CareerCategories'].'/option
 '; ?

 I'm pretty sure I need to loop through the $_Get of
 the array.   Not sure , and haven't found anything
 that shows this.

Yes, you need to reference $_GET to see whether an option was selected and 
change the echo above accordingly.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
rcw those apparently-bacteria-like multicolor worms coming out of
  microsoft's backorifice
rcw that's the backoffice logo
*/

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



Re: [PHP] Friendly URL

2004-12-11 Thread Bruno B B Magalhães
Richard,
well a much simpler solution than my old one:
$this-uri =  
explode('/',basename($_SERVER['SCRIPT_NAME']).$_SERVER['PATH_INFO']);

Many thanks for your help,
Bruno B B Magalhaes
On Dec 10, 2004, at 11:57 PM, Richard Lynch wrote:
$_SERVER['PHP_SELF'] or $_SERVER['SCRIPT_FILENAME'] or ...
It's all in there, though you might have to tear it apart a bit to get
exactly what you want.
Bruno B B Magalhães wrote:
Hi Richard,
well but I want also the file it self to be included in it...
Regards,
Bruno B B Magalhaes
But I need
On Dec 10, 2004, at 8:20 PM, Richard Lynch wrote:
Bruno B B Magalhães wrote:
Hi guys,
As part of my framework I have a URI decoder so it explode, remove
unnecessary data (as GET query) amd put it into an array...
Is there any better way of doing this (faster?), just wondering.
if(isset($_SERVER['REQUEST_URI']) === true)
{
$path = explode('/',$_SERVER['SCRIPT_NAME']);
$total_paths = count($path);
$path = 
stristr($_SERVER['REQUEST_URI'],$path[$total_paths-1]);
$path = explode('/',$path);
$total_paths = count($path);
$i = 0;
for($i=0;$i$total_paths;$i++)
{
$get_string = false;
$get_string = stristr($path[$i],'?');
if($get_string)
{
	$get_string = \\.$get_string;
	$this-uri[$i] 
strtolower(addslashes(strip_tags(eregi_replace($get_string,'',$path[ 
$i
])
)));
}
else
{
	$this-uri[$i] = strtolower(addslashes(strip_tags($path[$i])));
}
			}
		}
I could be wrong, but I think you've just re-written the code that is
already in PHP to give you $_SERVER['PATH_INFO']
?php echo $_SERVER['PATH_INFO']?
--
Like Music?
http://l-i-e.com/artists.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Spurious newlines when requesting empty php file

2004-12-11 Thread Michael Sims
Carl Michael Skog wrote:
 If I save the response of this command with lynx (lynx -dump
 http://www.formatemp.com/catalog/paynova-reply.php;  somefile),
 I will get three newlines.

Aha! I knew it. :)  See:

http://marc.theaimsgroup.com/?l=php-generalm=110272197009025w=2

Lynx adds the newlines.  Better to use Links instead for this sort of thing.

 If I request this file in a browser and scrutinize the response
 packet in a packet analyser, I see something fishy.

 After the usual header fields part are closed with the usual double
 \r\n sequence, a new header is added, consisting of the character
 0.
 This is the then closed with the double \r\n sequence.

Yes, I've noticed that too, using Ethereal to capture packets.  Try this
with a php file that produces output.  If you capture the packet you'll see
that the output is preceded by a hexidecimal number and followed by 0.
The first hex number is the number of characters in the output.  This does
not happen with plain HTML files, at least not on my test machine.

 Obviously, this is part of the data part of the package, and possibly
 becomes the three newlines I am observing.

No...that's Lynx's fault.

 What does this extra header value come from ?

Aha, just found it:

http://www.apps.ietf.org/rfc/rfc2616.html#sec-3.6.1

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



[PHP] I need to pass vars to external cgi script ?

2004-12-11 Thread Dave Carrera
Hi All,

I need to send some vars to a cgi script.

The script url is like this

http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_var;var2=my_seco
nd_php_var and so on.

How do I send / call this script from inside my php script ?

Any help I appreciated

Thank you in advance

Dave C



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.809 / Virus Database: 551 - Release Date: 09/12/2004
 

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



Re: [PHP] assignment

2004-12-11 Thread Ryan King
On Dec 9, 2004, at 10:02 PM, Song Ken Vern wrote:
Hi,
Tried searching for what this $$ operator means.
But can't get the right results by using $$ as search string in php 
manual.

$temp = $$temp2;
Is this an array assignment?
No, its a variable varible:
http://us2.php.net/manual/en/language.variables.variable.php
-ryan
--
http://theryanking.com/blog
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP vs JSP?

2004-12-11 Thread John Nichel
Travis Conway wrote:
Did he really ask that question on a PHP board?
That is like walking into a Coke factory, going to the manager and 
asking pepsi or coke?
Good a place as any to ask.  Sure, the opinions one receives here may be 
a bit biased towards php, but most of the users on this list subscribe 
to the, use what best suits your needs philosophy.  Not to mention 
that quite a few of us also have experience with JSP (as well as other 
technologies), so comparisons can be made.

--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] alternating table entry colors

2004-12-11 Thread Sebastian
my simple way..

while()
{
   $i += 1;
   $alt = ($i % 2) ? 'alt1' : 'alt2';
}

then just use $alt in your td class..

- Original Message - 
From: Graham Cossey [EMAIL PROTECTED]
To: Brad Ciszewski [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, December 11, 2004 8:33 AM
Subject: Re: [PHP] alternating table entry colors


 On Fri, 10 Dec 2004 18:19:35 -0600, Brad Ciszewski [EMAIL PROTECTED]
wrote:
  i need some assistance making my table (rows) change color for every
other
  data. here is what i have so far, but i get a unexpected T_STRING
error.
  this error's line is: if($thisRow mode 2 == 0){
 
  +=+=+  SCRIPT BELOW  +=+=+
 
  $thisRow = 0;
 
  $query = mysql_query(SELECT * FROM security_images ORDER BY ID DESC);
  while($gt=mysql_fetch_array($query)){
  if($thisRow mode 2 == 0){
  $backgroundColor = #CC;
  }else{
  $backgroundColor = #FF;
  }
 
  extract($gt);
  echo ?
   tr bgcolor=?PHP echo($backgroundColor); ?
 td?PHP echo($ID); ?/td
 td?PHP echo($ipAddr); ?/td
 td?PHP echo($area); ?/td
 td?PHP echo($insertdate); ?/td
 td?PHP echo($referenceid); ?/td
 td?PHP echo($hiddentext); ?/td
   /tr
   ?PHP
   $thisRow++
   } ?
 
  +=+=+  SCRIPT ABOVE  +=+=+
 
  thanx in advance!
 
  How about :

 ?php
 $rowNum = 0;
 $bg = array(#CC, #FF);
 run query
 while ( query_results)
 {
 ?
 tr bgcolor=?=$bg[$rowNum]?
   td...
 ?php
 $rowNum = ($rowNum==0)?1:0;
 }
 ?

 I normally use a CSS stylesheet with entries called tableRow0 and
 tableRow1 and then have the TR as:

 TR CLASS=tableRow?=$rowNum?

 HTH

 Graham

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




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



Re: [PHP] assignment

2004-12-11 Thread Jason Wong
On Friday 10 December 2004 12:02, Song Ken Vern wrote:

 Tried searching for what this $$ operator means.
 But can't get the right results by using $$ as search string in php manual.

 $temp = $$temp2;

Search for variable variables

 Is this an array assignment?

No, but in most cases where you think you need variable variables using 
arrays instead would be a better choice.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Stay away from hurricanes for a while.
*/

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



Re: [PHP] I need to pass vars to external cgi script ?

2004-12-11 Thread M. Sokolewicz
how about r? :) (or x)
Dave Carrera wrote:
Thanks John,
I get fopen expects second param when I call it.
What would this be ? r w x or something else ?
Thanks for the help
Dave Carrera
-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED] 
Sent: 11 December 2004 15:26
To: Dave Carrera; [EMAIL PROTECTED]
Subject: Re: [PHP] I need to pass vars to external cgi script ?


From: Dave Carrera [EMAIL PROTECTED]

I need to send some vars to a cgi script.
The script url is like this
http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_var;var2=m
y_seco
nd_php_var and so on.
How do I send / call this script from inside my php script ?

$file =
fopen('http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_varvar2=
my_second_php_varvar3=...');
or 

$file = fopen(httpscript.cgi?var1=$phpvar1var2=$phpvar2...);
although you'd want to urlencode() the PHP variables if you need something
like the second method. 

---John Holmes...
UCCASS - PHP Survey System http://www.bigredspark.com/survey.html

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.809 / Virus Database: 551 - Release Date: 09/12/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.809 / Virus Database: 551 - Release Date: 09/12/2004
 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Classes and Functions

2004-12-11 Thread R. Van Tassel
Can someone give me a distinction between the two and when to use / not use
them?

 

I want to thank everyone who replied about myFor loop question. All the
answers were VERY helpful! Thanks very much.

 

~ R. Van Tassel



Re: [PHP] Classes and Functions

2004-12-11 Thread Robby Russell
On Sat, 2004-12-11 at 13:03 -0500, R. Van Tassel wrote:
 Can someone give me a distinction between the two and when to use / not use
 them?
 
  
 
 I want to thank everyone who replied about myFor loop question. All the
 answers were VERY helpful! Thanks very much.

You might want to pick up a book on programming to read up on this. 

In a nutshell, a function should do something specific. It's good to use
functions when you do the same thing in different places in your code so
that you don't need to copy/paste your code over and over.

function foo()
{
$x = 1;
$y = 2;
return $x + $y;
}

$bar = foo();

print $bar;
-
OUTPUT:
3

A class/object is a collection of functions and variables that are
contained within their own scope. (vague description)

class foobar
{
  var $x = 10;

  var $y = NULL;

  function foobar($y)
  {
 $this-y = $y;
  }

  function add()
  {
return $this-x + $this-y;
  }

  function subtract()
  {
return $this-x - $this-y;
  }

}

$object = new foobar(4);

print $object-add() . \n;
print $object-subtract() . \n;

# set y to a new number
$object-y = 2;

print $object-add() . \n;
print $object-subtract() . \n;


OUTPUT:
 14
 6
 12
 8

As it sounds like you're still new to this, I would pick up a book or
read some material online that will better show you when to use either
and play around with them both. 

Have fun

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
*--- Now supporting PHP5 ---
/

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



Re: [PHP] assignment

2004-12-11 Thread Chris
That's a variable variable name.
http://us2.php.net/manual/en/language.variables.variable.php
So
$temp3 = 'valueoftemp3';
$temp2 = 'temp3';
$temp = $$temp2;
$$temp2 === $temp3;
Song Ken Vern wrote:
Hi, 

Tried searching for what this $$ operator means. 
But can't get the right results by using $$ as search string in php manual.

$temp = $$temp2; 

Is this an array assignment? 

Thanx. 
Ken

 

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


[PHP] Sorry forgot to include the code for my last message - Mike Francis

2004-12-11 Thread Mike Francis
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
head
titleOur List of Jokes/title
meta http-equiv=content-type
content=text/html; charset=iso-8859-1 /
/head
body
?php
// Connect to the database server
$dbcnx = @mysql_connect('localhost', 'root', 'MyPassword');
if (!$dbcnx) {
echo 'pUnable to connect to the ' .
'database server at this time./p' );
exit();
}
// Select the jokes database
if ([EMAIL PROTECTED]('ijdb')) {
exit('pUnable to locate the joke ' .
'database at this time./p');
}
?
pHere are all the jokes in our database:/p
blockquote
?php
// Request the text of all the jokes
$result = @mysql_query('SELECT joketext FROM joke');
if (!$result) {
exit('pError performing query: ' . mysql_error() . '/p');
}
// Display the text of each joke in a paragraph
while ($row = mysql_fetch_array($result)) {
echo 'p' . $row['joketext'] . '/p';
}
?
/blockquote
/body
/html

[PHP] Joining same table twice

2004-12-11 Thread Sebastian
i apologize if its against the rules to post mysql questions here, though im
using php to query the db
so...

i have a table with three integers.

[table post]
postuserid | replyuserid | parentid
--

i do a left join on table user to get the username that postuserid belongs
to, but i also need to get the username on the same table 'user' of
replyuserid as well if parentid isn't null. can this be done with a single
query?

this is what i have:

mysql_query(
SELECT post.postuserid, post.replyuserid, post.parentid, user.username AS
uname FROM post
LEFT JOIN user ON(user.userid = post.postuserid) ORDER BY id);

that gets me the username of postuserid, but what about replyuserid, how i
get that username?

thanks for any help.

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



[PHP] php variables in a backtick command

2004-12-11 Thread Jonathan Duncan
I am trying to run a shell command with backticks.  However, I get a parse 
error.  Is it because I have an array variable in there?

$result = `adduser -l=$dist_id -p=$user['password'] --f=$user['name_first'] 
$user['name_last']`;

Do I need to assign the value to a regular variable before I put it in 
there?  Like this?

$pword=$user['password']
$fname =$user['name_first']
$lname =$user['name_last']
$result = `adduser -l=$dist_id -p=$pword --f=$fname $lname`;

Thanks,
Jonathan 

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



Re: [PHP] php variables in a backtick command

2004-12-11 Thread Sebastian
well $user['password'] has no double quotes around it.

- Original Message - 
From: Jonathan Duncan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, December 11, 2004 8:09 PM
Subject: [PHP] php variables in a backtick command


 I am trying to run a shell command with backticks.  However, I get a parse
 error.  Is it because I have an array variable in there?

 $result =
`adduser -l=$dist_id -p=$user['password'] --f=$user['name_first']
 $user['name_last']`;

 Do I need to assign the value to a regular variable before I put it in
 there?  Like this?

 $pword=$user['password']
 $fname =$user['name_first']
 $lname =$user['name_last']
 $result = `adduser -l=$dist_id -p=$pword --f=$fname $lname`;

 Thanks,
 Jonathan

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




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



Re: [PHP] PHP via DIAL-UP?

2004-12-11 Thread Rory Browne
Assuming I understand you correctly, you want to connect to your
office computer, which is running apache, from home.

The fact that you are using win98 isn't particularly relevent,
provided you can connect to the internet with it.

Are you talking about connecting to your office computer through the
internet, or establishing a DialUp Link directly between your home,
and office? If it is the former, then all you need to do, is put your
office's IP into the address bar instead of http://localhost.

Your office enviornment is more relevent than anything else on this matter.

In short we'll need more info.

On Fri, 10 Dec 2004 17:34:56 -0800 (PST), Police Trainee
[EMAIL PROTECTED] wrote:
 Hello. I have a computer at my office running Apache
 that I use to run PHP scripts with using
 http://localhost.
 
 Is there anyway I can set up my computer to allow me
 to dial-in from home and use the webserver and my php
 applications?
 
 It is a win 98 system with tcp/ip.
 
 __
 Do you Yahoo!?
 Read only the mail you want - Yahoo! Mail SpamGuard.
 http://promotions.yahoo.com/new_mail
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] FTP_PUT 0kb problem

2004-12-11 Thread Marek Kilimajer
jpb wrote:
I am using the FTP_PUT command in conjunction with a form:
form action=upload.php method=post enctype=multipart/form-data
input type=file name=imagefile
input type=submit value=Submit
upload.php:
Everything seems to work except the put statement.
$upload = ftp_put($conn_id, $destination_file, $_POST[imagefile],
FTP_BINARY);
I am connecting to the server and it is replacing the old image file with a
0 kb file.
Permissions are RWX across the board. Any ideas?
Read http://www.php.net/manual/en/features.file-upload.php
information about uploaded file(s) is in $_FILES array and 
$_FILES['imagefile'] is an array

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


Re: [PHP] Joining same table twice

2004-12-11 Thread Marek Kilimajer
Sebastian wrote:
i apologize if its against the rules to post mysql questions here, though im
using php to query the db
so...
i have a table with three integers.
[table post]
postuserid | replyuserid | parentid
--
i do a left join on table user to get the username that postuserid belongs
to, but i also need to get the username on the same table 'user' of
replyuserid as well if parentid isn't null. can this be done with a single
query?
this is what i have:
mysql_query(
SELECT post.postuserid, post.replyuserid, post.parentid, user.username AS
uname FROM post
LEFT JOIN user ON(user.userid = post.postuserid) ORDER BY id);
that gets me the username of postuserid, but what about replyuserid, how i
get that username?
thanks for any help.
If you are using the same table more than once you can alias it and use 
the alias in your select, where, order by etc. clauses. If more columns 
have the same name, you can alias them too to get distinct array keys 
from mysql_fetch_assoc()

Useless example:
select t1.id t1_id, t2.id t2_id from table t1 left join table t2 on 
t1.id = t2.id ..

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


[PHP] Re: Data Access Object (DAO) with PHP

2004-12-11 Thread Manuel Lemos
Hello,
Adwin Wijaya wrote:
Is there any mature DAO class for PHP (free) ?
You may want to check Metastorage. It is not really a DAO class but 
rather a DAO class generator. It tends to generate code that is much 
more efficient than DAO base classes as the generated code only includes 
the features that you need for each DAO class in your data model, and 
any static details are compiled as optimized code instead of parameters 
that will consume CPU and memory to compute.

For instance, you do not need to build your queries at run time. These 
are just compiled into the generated code, even those that need to take 
dynamic parameters defined at run time. It is like calling stored 
procedures.

The way Metastorage works is letting the developer describe your data 
model of classes in a simple XML format with variables, relationships, 
validation rules and the type of functions that you need to manipulate 
your data objects.

Once you have defined your data model, the compiler (which is actually a 
bunch of PHP classes) builds everything that you need in a few seconds. 
The generated code is very compact and independent as it does not need 
any part of the compiler to run in your applications.

http://www.meta-language.net/metastorage.html
Here are also some screenshots of the compiler Web interface GUI, Web 
forms to interface with sample project generated classes, and UML 
diagram of generated classes:

http://www.meta-language.net/screenshots.html
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] dynamic include() in while loop

2004-12-11 Thread Sebastian
this is a brain buster, at least for me.
i have a while loop (results from mysql) which display news articles. i want
to include() a file if there hasn't been a news article posted today
meaning after midnight 12am to 12pm midnight... but if there are articles
the articles would be echo'd before the include and the rest of the articles
below the include..

eg,

Article (today)
Article (today)
include();
More articles (not today)

.. but if there are no Articles posted today it would show up as:

include();
Article
Article

i want to know if this is possible, if so, can anyone give me an example?
the articles are dated in unix timestamp.
cheers

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



Re: [PHP] php variables in a backtick command

2004-12-11 Thread Jonathan Duncan
Ah, that is a good idea, putting the command in a variable and then 
executing the variable.  I have doen that before but did not think of it 
now.  Too many things going on.  Thanks!

Jonathan

Rory Browne [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 I'm not sure about variable expansion with backticks(I don't use
 backticks, if necessary I use shell_exec() instead). I'm just after
 installing a fresh SuSE 9.1, and php is giving me a segfault at the
 minute, with that particular code, but if you were using double quotes
 you could:

 $command = adduser -l=$dist_id -p={$user['password']}
 --f=\{$user['name_first']} {$user['name_last']}\;

 bearing in mind that the variables have been {}'ed, and your double
 quote around $user['name_first'] and ['name_last']) has been escaped
 to \

 you can use shell_exec($command), which is identical to the backtick 
 operation.

 Having that said, you should consider using alternative program
 execution instead, instead of using the shell. What do you need the
 shell for? You might(albeit unlikely) also come across a situation
 where the shell is something like /bin/false, or /bin/falselogin, or
 /bin/scponly, or basicly something that doesn't particularly work that
 well as a shell.

 Rory

 On Sat, 11 Dec 2004 18:09:17 -0700, Jonathan Duncan [EMAIL PROTECTED] 
 wrote:
 I am trying to run a shell command with backticks.  However, I get a 
 parse
 error.  Is it because I have an array variable in there?

 $result = 
 `adduser -l=$dist_id -p=$user['password'] --f=$user['name_first']
 $user['name_last']`;

 Do I need to assign the value to a regular variable before I put it in
 there?  Like this?

 $pword=$user['password']
 $fname =$user['name_first']
 $lname =$user['name_last']
 $result = `adduser -l=$dist_id -p=$pword --f=$fname $lname`;

 Thanks,
 Jonathan

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

 



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



Re: [PHP] php variables in a backtick command

2004-12-11 Thread Jonathan Duncan
The quotes are only for the shell command which does not use quotes around 
password.  Thanks for the feedback.

Jonathan


Sebastian [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 well $user['password'] has no double quotes around it.

 - Original Message - 
 From: Jonathan Duncan [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, December 11, 2004 8:09 PM
 Subject: [PHP] php variables in a backtick command


 I am trying to run a shell command with backticks.  However, I get a 
 parse
 error.  Is it because I have an array variable in there?

 $result =
 `adduser -l=$dist_id -p=$user['password'] --f=$user['name_first']
 $user['name_last']`;

 Do I need to assign the value to a regular variable before I put it in
 there?  Like this?

 $pword=$user['password']
 $fname =$user['name_first']
 $lname =$user['name_last']
 $result = `adduser -l=$dist_id -p=$pword --f=$fname $lname`;

 Thanks,
 Jonathan

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


 

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



[PHP] Re: Sorry forgot to include the code for my last message - Mike Francis

2004-12-11 Thread David Robley
On Sun, 12 Dec 2004 07:03, Mike Francis wrote:

 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 titleOur List of Jokes/title
 meta http-equiv=content-type
 content=text/html; charset=iso-8859-1 /
 /head
 body
 ?php
 // Connect to the database server
 $dbcnx = @mysql_connect('localhost', 'root', 'MyPassword');
 if (!$dbcnx) {
 echo 'pUnable to connect to the ' .
 'database server at this time./p' );

Note that using the @ in front of the connect suppresses any error messsages
that may be returned from the connect; I would get rid of that. Then add
here:

echo mysql_error();
 exit();
 }
 // Select the jokes database
 if ([EMAIL PROTECTED]('ijdb')) {

And use mysql_error() here too.
 exit('pUnable to locate the joke ' .
 'database at this time./p');
 }
 ?

mysql_error() will return a useful error message.

-- 
David Robley

Backups? We doan *NEED* no steenking baX%^~,VbKx NO CARRIER

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



[PHP] Header location open into a new window?

2004-12-11 Thread Justin Wilkins
 

Is there a way in the current code below to make my $go_to_address go to a
webpage in a new link -- instead of embedded in an iframe?

 

In others words, can Header(Location:  open in a new window?

 

? 

if (!eregi(modules.php, $_SERVER['PHP_SELF'])) {

  die (You can't access this file directly...); }

if(!IsSet($mainfile)) { include (mainfile.php); }

/* get current user online whether they are registered user or just visitor
*/

/* we need global variables belong to PHP-Nuke */ global $user, $anonymous;
$users = $user;

/* init our variables */

$userid = 1;

$username = $anonymous;

/* check if registered user online */

if (is_user($users))

{

  if (!is_array($users))

  { 

$user_cookie = explode(':', addslashes(base64_decode($users))); 

$userid = $user_cookie[0]; 

$username = $user_cookie[1]; 

unset($user_cookie);

  }

  else

  { 

$userid = $users[0]; 

$username = $users[1];

  }

  $userid = (preg_match('/^[0-9]+$/', $userid)) ? intval($userid) : 1;

  $username = (preg_match('/^[a-z0-9_-]+$/i', $username)) ? $username :

$anonymous;

}

/* construct a link (for registered user) */ if ($userid  1) {

  $content =

'https://swww.google.com/servlet/com.google.framework.servlets.BGSeamlessLog

in?STYLESHEETURL=googlePREFID='.rawurlencode($username).'';

}

else

{

  $content2 = 'modules.php?name=form_joinpp'; }

/* clean unnecessary variables, to keep memory usage as low as possible */
unset($userid); unset($username);

/* all done. we provide $content variable to block handler */ 

 

 

$index=0;

$theme=4July;

//TEST

$url_for_anonymous = $content2;

/TEST 

 

if (is_user($user)) {

$go_to_address1=$content;

$go_to_address=rawurldecode($go_to_address1);

include(header.php);

OpenTable3();

echo centerh4a href=\index.php\Click Here to Return to the Main
Menu/a/h4/center; echo iframe SRC=\.$go_to_address.\
width=\100%\ height=\1200\ 

framespacing=0 frameborder=no border=0 scrolling=auto/iframe; echo
brcenter/centerbr; } else { header(Location:.$content2.); } 

 

CloseTable3();

include(footer.php);

die;

?

 



[PHP] FTP_PUT 0kb problem

2004-12-11 Thread jpb

I am using the FTP_PUT command in conjunction with a form:

form action=upload.php method=post enctype=multipart/form-data
input type=file name=imagefile
input type=submit value=Submit

upload.php:
Everything seems to work except the put statement.
$upload = ftp_put($conn_id, $destination_file, $_POST[imagefile],
FTP_BINARY);

I am connecting to the server and it is replacing the old image file with a
0 kb file.

Permissions are RWX across the board. Any ideas?

Thanks - Jeff

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



Re: [PHP] Re: Data Access Object (DAO) with PHP

2004-12-11 Thread adwin wijaya
Shen Kong wrote:
 Hi, do you mean ADODB? PEAR::DB? or DBX ?
-- more advance than that i think. It is a class that will be created 
to access database as object like the one in Java.

--
===
Best Regards
Adwin Wijaya
www.kuya-kuya.net
www.e-rhema.net
===
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP vs JSP?

2004-12-11 Thread Peter Lauri
Best groupmember,

Why should I choose PHP instead of JSP/Servlets when it comes to develop a
high-traffic site. Assume that the infrastructure for both are set up. It
only comes to efficiency (both coding and running)? What are your
experience?

--
- Best Of Times
/Peter Lauri

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


Re: [PHP][Kill Thread] Question:maybe urldecode

2004-12-11 Thread Stuart Felenstein

--- Stuart Felenstein [EMAIL PROTECTED] wrote:

I am ending this thread. 

Stuart

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


Re: [PHP] alternating table entry colors

2004-12-11 Thread Graham Cossey
On Fri, 10 Dec 2004 18:19:35 -0600, Brad Ciszewski [EMAIL PROTECTED] wrote:
 i need some assistance making my table (rows) change color for every other
 data. here is what i have so far, but i get a unexpected T_STRING error.
 this error's line is: if($thisRow mode 2 == 0){
 
 +=+=+  SCRIPT BELOW  +=+=+
 
 $thisRow = 0;
 
 $query = mysql_query(SELECT * FROM security_images ORDER BY ID DESC);
 while($gt=mysql_fetch_array($query)){
 if($thisRow mode 2 == 0){
 $backgroundColor = #CC;
 }else{
 $backgroundColor = #FF;
 }
 
 extract($gt);
 echo ?
  tr bgcolor=?PHP echo($backgroundColor); ?
td?PHP echo($ID); ?/td
td?PHP echo($ipAddr); ?/td
td?PHP echo($area); ?/td
td?PHP echo($insertdate); ?/td
td?PHP echo($referenceid); ?/td
td?PHP echo($hiddentext); ?/td
  /tr
  ?PHP
  $thisRow++
  } ?
 
 +=+=+  SCRIPT ABOVE  +=+=+
 
 thanx in advance!
 
 How about :

?php
$rowNum = 0;
$bg = array(#CC, #FF);
run query
while ( query_results)
{
?
tr bgcolor=?=$bg[$rowNum]?
  td...
?php
$rowNum = ($rowNum==0)?1:0;
}
?

I normally use a CSS stylesheet with entries called tableRow0 and
tableRow1 and then have the TR as:

TR CLASS=tableRow?=$rowNum?

HTH

Graham

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


Re: [PHP] PHP vs JSP?

2004-12-11 Thread Raditha Dissanayake
Peter Lauri wrote:
Best groupmember,
Why should I choose PHP instead of JSP/Servlets when it comes to develop a
high-traffic site. Assume that the infrastructure for both are set up. It
only comes to efficiency (both coding and running)? What are your
experience?
 

As a sun certified java programmer, let me assure you that PHP is easier 
to work with.

--
- Best Of Times
/Peter Lauri
 


--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload 

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


RE: [PHP] Spurious newlines when requesting empty php file

2004-12-11 Thread Carl Michael Skog
Thanks for the answer !

The URL of the file is http://www.formatemp.com/catalog/paynova-reply.php
and the file is definitely empty.
It was created by the touch(UNIX command):
-rw-r--r--   42 foo   foo  0 Dec 10 18:49 paynova-reply.php

The server is configured as follows:
Apache/1.3.33 (Unix) mod_perl/1.29 mod_auth_passthrough/1.8
mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.9 mod_ssl/2.8.21 OpenSSL/0.9.6b
It is a server configured by my ISP, eXaion.com.

If I save the response of this command with lynx (lynx -dump
http://www.formatemp.com/catalog/paynova-reply.php;  somefile),
I will get three newlines.

If I request this file in a browser and scrutinize the response packet in a
packet analyser, I see something fishy.

After the usual header fields part are closed with the usual double \r\n
sequence, a new header is added, consisting of the character 0.
This is the then closed with the double \r\n sequence.
In other words, the extra hex characters 30, 0D, 0A, 0D, 0A are included in
the data part of the package.


Obviously, this is part of the data part of the package, and possibly
becomes the three newlines I am observing.

What does this extra header value come from ?


Regards,
Carl Michael Skog


-Original Message-
From: Richard Lynch ceo-at-l-i-e.com |PHP General user list|
[mailto:...] 
Sent: den 10 december 2004 22:40
To: .
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Spurious newlines when requesting empty php file

Carl Michael Skog wrote:
 Some strange results with spurious newlines inserted in the response 
 when requesting a php file has led me to investigating what happens 
 when a completely empty php-file is requested.

 I would have thought that the response from a empty php file would 
 also be empty, but, to my surprise, they consist of 3 newlines !!!

 The strange thing is that I observed this behaviour on two completely 
 unrelated servers.

 Is this what can be expected or is it a result of misconfiguration ?

I just tried this with an empty PHP file, and got exactly what I expected.

A valid response with no content at all.

Please specify your software versions, and provide URLs and, as silly as
this sounds, an ls -als empty.php so we can see your empty PHP file.

Also check php.ini for auto_prepend_file and auto_append_file settings,
which might be tacking on blanks.

And, if you are using this as an empty file:
--- not quite empty file - ?php ?
--
then PHP is quite right to send out the newline at the end.


- really empty file - ?php
?-

Note that some editors, under some configurations, will *ADD* a newline to a
file on the last line for historical reasons.

Re-configure your editor *now* if yours does that, our include files and
calls to http://php.net/header will drive you crazy, or you'll end up
mis-using output buffering to solve your non-problem.

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

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


Re: [PHP] PHP vs JSP?

2004-12-11 Thread Travis Conway
Did he really ask that question on a PHP board?
That is like walking into a Coke factory, going to the manager and asking 
pepsi or coke?

- Original Message - 
From: Raditha Dissanayake [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, December 11, 2004 7:11 AM
Subject: Re: [PHP] PHP vs JSP?


Peter Lauri wrote:
Best groupmember,
Why should I choose PHP instead of JSP/Servlets when it comes to develop a
high-traffic site. Assume that the infrastructure for both are set up. It
only comes to efficiency (both coding and running)? What are your
experience?
As a sun certified java programmer, let me assure you that PHP is easier 
to work with.

--
- Best Of Times
/Peter Lauri


--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] I need to pass vars to external cgi script ?

2004-12-11 Thread John Holmes
 From: Dave Carrera [EMAIL PROTECTED]

 I need to send some vars to a cgi script.
 
 The script url is like this
 
 http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_var;var2=my_seco
 nd_php_var and so on.
 
 How do I send / call this script from inside my php script ?

$file = 
fopen('http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_varvar2=my_second_php_varvar3=...');

or 

$file = fopen(httpscript.cgi?var1=$phpvar1var2=$phpvar2...);

although you'd want to urlencode() the PHP variables if you need something like 
the second method. 

---John Holmes...

UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html

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


[PHP] assignment

2004-12-11 Thread Song Ken Vern
Hi, 

Tried searching for what this $$ operator means. 
But can't get the right results by using $$ as search string in php manual.

$temp = $$temp2; 

Is this an array assignment? 

Thanx. 
Ken

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


RE: [PHP] I need to pass vars to external cgi script ?

2004-12-11 Thread Dave Carrera
Thanks John,

I get fopen expects second param when I call it.

What would this be ? r w x or something else ?

Thanks for the help

Dave Carrera


-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED] 
Sent: 11 December 2004 15:26
To: Dave Carrera; [EMAIL PROTECTED]
Subject: Re: [PHP] I need to pass vars to external cgi script ?


 From: Dave Carrera [EMAIL PROTECTED]

 I need to send some vars to a cgi script.
 
 The script url is like this
 
 http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_var;var2=m
 y_seco
 nd_php_var and so on.
 
 How do I send / call this script from inside my php script ?

$file =
fopen('http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_varvar2=
my_second_php_varvar3=...');

or 

$file = fopen(httpscript.cgi?var1=$phpvar1var2=$phpvar2...);

although you'd want to urlencode() the PHP variables if you need something
like the second method. 

---John Holmes...

UCCASS - PHP Survey System http://www.bigredspark.com/survey.html



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.809 / Virus Database: 551 - Release Date: 09/12/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.809 / Virus Database: 551 - Release Date: 09/12/2004
 

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


Re: [PHP] assignment

2004-12-11 Thread Sebastian
variables variable?
http://us2.php.net/manual/en/language.variables.variable.php

- Original Message - 
From: Song Ken Vern [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 09, 2004 11:02 PM
Subject: [PHP] assignment


 Hi,

 Tried searching for what this $$ operator means.
 But can't get the right results by using $$ as search string in php
manual.

 $temp = $$temp2;

 Is this an array assignment?

 Thanx.
 Ken

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




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


Re: [PHP] PHP vs JSP?

2004-12-11 Thread Raditha Dissanayake
Travis Conway wrote:
Did he really ask that question on a PHP board?
I have met factory managers (though not at the comanies you mention ) 
who have admitted that their competitors may have the edge :-)
But seriously whether PHP is better or JSP is better is a religious 
question. However on the point of ease of use PHP is a clear winner. 
There are other areas in which J2EE wins but let's not go into it here.

--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload 

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


[PHP] MySQL Connection problem

2004-12-11 Thread Mike Francis
Hi,
I have Apache 2, PHP 5 and MySQL 4.1 installed on an XP pro box.

I have created a new database 'ijdb' with a single table 'joke' and have 
entered data into two of the three fields in the table.

I can access the database / tables / data from a command prompt.

However, when I try to connect through WAMP I either receive a 'Unable to 
connect to the
database server at this time.' error message - which is my default error 
message, or, I receive a blank window in IE / Mozilla / Opera etc and no error 
messages.

I have tried removing the @ from the file and this has no effect - interesting?!
The error logs do not reveal anything that indicates a missing table / field.

I wonder if anyone has any ideas ?

Cheers,
Mike

[PHP] Re: php variables in a backtick command

2004-12-11 Thread Jonathan Duncan
So I tried it that way and it worked, that is annoying though, having to add 
extra lines to the code and assign the contents of one variable to another. 
Any way around this?

Jonathan


Jonathan Duncan [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I am trying to run a shell command with backticks.  However, I get a parse 
error.  Is it because I have an array variable in there?

 $result = 
 `adduser -l=$dist_id -p=$user['password'] --f=$user['name_first'] 
 $user['name_last']`;

 Do I need to assign the value to a regular variable before I put it in 
 there?  Like this?

 $pword=$user['password']
 $fname =$user['name_first']
 $lname =$user['name_last']
 $result = `adduser -l=$dist_id -p=$pword --f=$fname $lname`;

 Thanks,
 Jonathan 

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


Re: [PHP] php variables in a backtick command

2004-12-11 Thread Rory Browne
I'm not sure about variable expansion with backticks(I don't use
backticks, if necessary I use shell_exec() instead). I'm just after
installing a fresh SuSE 9.1, and php is giving me a segfault at the
minute, with that particular code, but if you were using double quotes
you could:

$command = adduser -l=$dist_id -p={$user['password']}
--f=\{$user['name_first']} {$user['name_last']}\;

bearing in mind that the variables have been {}'ed, and your double
quote around $user['name_first'] and ['name_last']) has been escaped
to \

you can use shell_exec($command), which is identical to the backtick operation.

Having that said, you should consider using alternative program
execution instead, instead of using the shell. What do you need the
shell for? You might(albeit unlikely) also come across a situation
where the shell is something like /bin/false, or /bin/falselogin, or
/bin/scponly, or basicly something that doesn't particularly work that
well as a shell.

Rory

On Sat, 11 Dec 2004 18:09:17 -0700, Jonathan Duncan [EMAIL PROTECTED] wrote:
 I am trying to run a shell command with backticks.  However, I get a parse
 error.  Is it because I have an array variable in there?
 
 $result = `adduser -l=$dist_id -p=$user['password'] --f=$user['name_first']
 $user['name_last']`;
 
 Do I need to assign the value to a regular variable before I put it in
 there?  Like this?
 
 $pword=$user['password']
 $fname =$user['name_first']
 $lname =$user['name_last']
 $result = `adduser -l=$dist_id -p=$pword --f=$fname $lname`;
 
 Thanks,
 Jonathan
 
 --
 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] Forms Question: Options

2004-12-11 Thread Steve Marquez
Hi everyone!

Can someone help me with this question?

I created a photo upload utility with individual galleries that images can
be uploaded into. In the MySQL database, there are multiple names of
galleries, some are the same. I want to have a select menu to show just the
unique names of the galleries.

I have used:

Select DISTINCT gallery_names from images_upload;

I have about 15 records, ten are GALLERY1 and 5 are GALLERY2. When I use
the DISTINCT, two are output. It works perfectly in the MySQL terminal.

However, when I use the same in PHP as a web page, it only outputs one, the
one with only 5 records.

Here is the code:

?php 

// log into our local server using the MySQL root user.
   $dbh = mysql_connect( hostname, username, password );

   // select the database.
   mysql_select_db( db ) or die ( mysql_error() . \n );

   //and read it back for printing purposes.
   $get_table_data = SELECT DISTINCT gallery_name FROM images_upload ORDER
BY gallery_name DESC;
   
   $response = mysql_query( $get_table_data, $dbh );

   //now print it out for the user.
   if ( $one_line_of_data = mysql_fetch_array( $response ) ) {
 extract ( $one_line_of_data );
 }

 ?


-- Snip --


  ?php
  
   while ( $data = mysql_fetch_array( $response, MYSQL_ASSOC)) {
 print select name=\gallery_name\;
 foreach ( $data as $option_value ) {
 print option
value=\$option_value\$option_value/option;
  
 }  print /select;
   }
  
  ?


-- Snip --

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


[PHP] Re: MySQL Connection problem

2004-12-11 Thread Peter Lauri
It would be nice if you submit code that generates the error.

/Peter


Mike Francis [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
Hi,
I have Apache 2, PHP 5 and MySQL 4.1 installed on an XP pro box.

I have created a new database 'ijdb' with a single table 'joke' and have
entered data into two of the three fields in the table.

I can access the database / tables / data from a command prompt.

However, when I try to connect through WAMP I either receive a 'Unable to
connect to the
database server at this time.' error message - which is my default error
message, or, I receive a blank window in IE / Mozilla / Opera etc and no
error messages.

I have tried removing the @ from the file and this has no effect -
interesting?!
The error logs do not reveal anything that indicates a missing table /
field.

I wonder if anyone has any ideas ?

Cheers,
Mike

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


[PHP] Re: Forms Question: Options

2004-12-11 Thread Matthew Weier O'Phinney
* Steve Marquez [EMAIL PROTECTED]:
 I created a photo upload utility with individual galleries that images can
 be uploaded into. In the MySQL database, there are multiple names of
 galleries, some are the same. I want to have a select menu to show just the
 unique names of the galleries.

 I have used:

 Select DISTINCT gallery_names from images_upload;

 I have about 15 records, ten are GALLERY1 and 5 are GALLERY2. When I use
 the DISTINCT, two are output. It works perfectly in the MySQL terminal.

 However, when I use the same in PHP as a web page, it only outputs one, the
 one with only 5 records.

 Here is the code:

 ?php 

 // log into our local server using the MySQL root user.
$dbh = mysql_connect( hostname, username, password );

// select the database.
mysql_select_db( db ) or die ( mysql_error() . \n );
 
//and read it back for printing purposes.
$get_table_data = SELECT DISTINCT gallery_name FROM images_upload ORDER
 BY gallery_name DESC;

$response = mysql_query( $get_table_data, $dbh );

//now print it out for the user.
if ( $one_line_of_data = mysql_fetch_array( $response ) ) {

It's only printing out one record because you're only fetching from the
results set once. Change that to :

while ($one_line_of_data = mysql_fetch_array($response)) {

and you should be set.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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