[PHP-DB] vaiable from one page to another

2003-02-05 Thread bismi jomon

hi,

i hav two programs ,

html

 form name=f action=p.php mehtod=post

input type=text name=fname 

input type=submit 

/form

/html

p.php:

?php

echo($fname)

?

i tried these programs and i didnt get the value of the variable in another php 
program. butit is not getting. one our friend told to put like 

echo $_post(fname)

but it is also not working. now  getting the error about post array.

so what to do.

help me

regards

bis

 



-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


Re: [PHP-DB] vaiable from one page to another

2003-02-05 Thread Jason Wong
On Wednesday 05 February 2003 16:36, bismi jomon wrote:

 hi,

 i hav two programs ,

 html

  form name=f action=p.php mehtod=post

 input type=text name=fname 

 input type=submit 

 /form

 /html

 p.php:

 ?php

 echo($fname)

 ?

 i tried these programs and i didnt get the value of the variable in another
 php program. butit is not getting. one our friend told to put like

 echo $_post(fname)

 but it is also not working. now  getting the error about post array.

 so what to do.

manual  A simple tutorial
manual  Variables  Variables from outside PHP

-- 
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-db
--
/*
If you always postpone pleasure you will never have it.  Quit work and play
for once!
*/


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




[PHP-DB] Re: vaiable from one page to another

2003-02-05 Thread Bastian Vogt
Hi,

you have to write it exactly like this:

echo $_POST['fname'];

HTH,
Bastian



 echo $_post(fname)


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




[PHP-DB] Re: vaiable from one page to another

2003-02-05 Thread J.Veenhuijsen
Try

p.php:

 ?php
 //Not ?php

 echo($fname);

 ?

Jochem

Bismi Jomon wrote:
hi,

i hav two programs ,

html

 form name=f action=p.php mehtod=post

input type=text name=fname 

input type=submit 

/form

/html

p.php:

?php

echo($fname)

?

i tried these programs and i didnt get the value of the variable in 
another php program. butit is not getting. one our friend told to put like
echo $_post(fname)

but it is also not working. now  getting the error about post array.

so what to do.

help me

regards

bis





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



[PHP-DB] Help with select box - multiple...

2003-02-05 Thread Aaron Wolski
Hi All,
 
Sorry to be a pain on this one as it is sorta off topic.. but any help
would be awesome.
 
I'm creating a report for Product Popularity in which the Admin is
present with a form and they have the ability to select A product or
multiple products from a drop down combo box.
 
The form is submitted to itself.. and all works.. meaning I can select
multiple products from the drop down box and the results displayed fine.
However, I want to SHOW to the user (in the drop down box) which
products were selected. Things work fine if I am selecting on product -
meaning it show the product name being sleected.. however, if multiple
products are selected it doesn't show any as being selected.
 
The select box code is below as is the script to iterate through the
products array.
 
Thanks all.
 
 
*** product select box ***
 
select name=products[] class=selectcontent size=3 multiple
 

option value= class=selectcontentProduct/option
 
?php
 
 
$productQuery = db_query(SELECT name, SUM(quantity) as mostSold FROM
CartTable WHERE submitted=1 GROUP BY name ORDER BY mostSold DESC);
 
while ($productResult = db_fetch($productQuery)) {
 
?
 

 

 
option value=?php echo $productResult['name']; ? ?php if
($productResult['name'] == $str_products) echo selected; ?
class=selectcontent?php echo $productResult['name']; ?/option
 
?php

}
 
?
 

/select
 
 
 
*** array iteration code **
 
if ($products) {
 
if (is_array($products)) {
 
$str_products = implode(,,$products);

} 
 
else {
 
$str_products = $products;
 
}
 
echo $str_products;
 
}
 
 
 
 
Aaron



Re: [PHP-DB] Help with select box - multiple...

2003-02-05 Thread Jeffrey_N_Dyke

You can take the selected items posted to your page and use in_array() to
search for the current item as your code creates the list.  this is a chunk
of code that i use to do the same thing.  I wrote this a long time ago, so
there may be better ways to do thisbut it works. ;-)

snip
if (in_array($value, $array)) {
 print option value=\$value\ selected.$value./option\n;
} else {
 print option value=\$value\.$value./option\n;
}
snip
hth,
jeff


   
 
Aaron Wolski 
 
aaronjw@marte   To: [EMAIL PROTECTED]
 
kbiz.comcc:   
 
 Subject: [PHP-DB] Help with select box - 
multiple...   
02/05/2003 
 
08:42 AM   
 
   
 
   
 




Hi All,

Sorry to be a pain on this one as it is sorta off topic.. but any help
would be awesome.

I'm creating a report for Product Popularity in which the Admin is
present with a form and they have the ability to select A product or
multiple products from a drop down combo box.

The form is submitted to itself.. and all works.. meaning I can select
multiple products from the drop down box and the results displayed fine.
However, I want to SHOW to the user (in the drop down box) which
products were selected. Things work fine if I am selecting on product -
meaning it show the product name being sleected.. however, if multiple
products are selected it doesn't show any as being selected.

The select box code is below as is the script to iterate through the
products array.

Thanks all.


*** product select box ***

select name=products[] class=selectcontent size=3 multiple


option value= class=selectcontentProduct/option

?php


$productQuery = db_query(SELECT name, SUM(quantity) as mostSold FROM
CartTable WHERE submitted=1 GROUP BY name ORDER BY mostSold DESC);

while ($productResult = db_fetch($productQuery)) {

?





option value=?php echo $productResult['name']; ? ?php if
($productResult['name'] == $str_products) echo selected; ?
class=selectcontent?php echo $productResult['name']; ?/option

?php

  }

?


/select



*** array iteration code **

if ($products) {

  if (is_array($products)) {

   $str_products = implode(,,$products);

  }

  else {

   $str_products = $products;

  }

  echo $str_products;

}




Aaron





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




Re: [PHP-DB] UPDATE doesn't work

2003-02-05 Thread Le Hoang
Thank Jason! It counts now.

So if i want to make something like

Most view tutorial is $row[title]  How can i do this?


Regards,

- Original Message - 
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 05, 2003 1:44 PM
Subject: Re: [PHP-DB] UPDATE doesn't work


 On Wednesday 05 February 2003 12:50, Le Hoang wrote:
 
  
  // Add 1 view to the view column
  
  $v = $row[view];
  $vplus = $v+1;
  $view = mysql_query(update photoshop_tutorial where id=$id set
  view=$vplus); // Problem here!
 
 You should ALWAYS check the result of a call to mysql_query():
 
  if ($view === false) { echo Fatal error:  . mysql_error(); }
 
 
 Your problem is that the SQL for update is incorrect and it should be:
 
   UPDATE photoshop_tutorial SET view = $vplus WHERE id = $id
 
 You can also do the increment inside the SQL so:
 
   UPDATE photoshop_tutorial SET view = view + 1 WHERE id = $id
 
 -- 
 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-db
 --
 /*
 Tell a man there are 300 billion stars in the universe and he'll believe you.
 Tell him a bench has wet paint on it and he'll have to touch to be sure.
 */
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 



[PHP-DB] Argh ! array help required :(

2003-02-05 Thread Aaron Wolski
Hi All,
 
Again.. a little off topic - sorry (again!).
 
Have a form that allows me to select a bunch of product names from a
drop down combo box.
 
I'm trying to create code like in ('Product name1','Product Name2) to
be inserted into an SQL statement.
 
I figured that since $products was ALREADY in an array format the code
below would work.. but it doesn't:
 
$prod_search = in(;
for ($i=0;$icount($products);$i++) {
$prod_search .= escapeValue($products[$i]);
if ($i != (count($products) - 1)) {
$prod_search .= ,;
}
}
 
$prod_search .= );
 
Can anyone see where I am going wrong?
 
Thanks!
 
 
 
Aaron 
 



RE: [PHP-DB] odbc query with single quote in string

2003-02-05 Thread Squirrel User
The 1st one didn't work, but the 2nd one did work.  Fantastic!  Thanks alot, 
you saved me from frustrations.

Quoting John W. Holmes [EMAIL PROTECTED]:

  I'm having problem querying a table with a field value containing an
  appostropy, please help.  Using ODBC to connect MSAcess database.
  
 $mQuery = CustomerID='$mCust';
 $mCur2 = odbc_do( $mCnx, select Login from Emails where $mQuery
 );
  
  When it hits O'Donald, James, I get error in odbc_exec().  I tried
  variations of $mQuery, including:
  
 $mQuery = addslashes( $mQuery );
 
 You don't want to use addslashes() on $mQuery, you want to use it on the
 data you're inserting between the quotes, i.e. $mCust. 
 
 $mQuery = CustomerID=' . addslashes($mCust) . ';
 
 If that still causes an error, your database may require quotes to be
 escaped with another quote, instead of a backslash. In that case, you
 can create a function like this
 
 function addslashes2($data)
 { return str_replace(','',$data); }
 
 Hope that helps.  
 
 ---John W. Holmes...
 
 PHP Architect - A monthly magazine for PHP Professionals. Get your copy
 today. http://www.phparch.com/
 
 
 




-
This mail sent through ISOT.  To find out more 
about ISOT, visit http://isot.com

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




Re: [PHP-DB] Argh ! array help required :(

2003-02-05 Thread Jason Wong
On Thursday 06 February 2003 01:13, Aaron Wolski wrote:
 Hi All,

 Again.. a little off topic - sorry (again!).

 Have a form that allows me to select a bunch of product names from a
 drop down combo box.

 I'm trying to create code like in ('Product name1','Product Name2) to
 be inserted into an SQL statement.

 I figured that since $products was ALREADY in an array format the code
 below would work.. but it doesn't:

 $prod_search = in(;
 for ($i=0;$icount($products);$i++) {
 $prod_search .= escapeValue($products[$i]);
 if ($i != (count($products) - 1)) {
 $prod_search .= ,;
 }
 }

 $prod_search .= );

 Can anyone see where I am going wrong?

  $doo = array('dah', 'dee', 'dib');
  $doo = in (' . implode(', ', $doo) . ');
  echo $doo;

-- 
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-db
--
/*
More are taken in by hope than by cunning.
-- Vauvenargues
*/


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




[PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread Aaron Wolski
Argh 
 
 
HOW does one check for an array being empty from a form field??
 
Tried a billion different things and NOTHING works
 
I've tried:
 
if ($products == \n) {
 
echo hello;
}
 
else {
 
echo bye;
 
}
 
 
if ($products == ) {
 
echo hello;
}
 
else {
 
echo bye;
 
}
 
 
 
if (empty($products)) {
 
echo hello;
}
 
else {
 
echo bye;
 
}
 
 
if (!isset($products)) {
 
echo hello;
}
 
else {
 
echo bye;
 
}
 
 
if (count($products) == 0) {
 
echo hello;
}
 
else {
 
echo bye;
 
}
 
 
NOTHING works!!!
 
Any help.. puuulease?
 
Aaron



Re: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread Mark
First try isset($product) to see if it's being POSTed or GETted
properly. You might need to use $_POST['products'] or
$_GET['products'].


--- Aaron Wolski [EMAIL PROTECTED] wrote:
 Argh 
  
  
 HOW does one check for an array being empty from a form
 field??
  
 Tried a billion different things and NOTHING works
  
 I've tried:
  
 if ($products == \n) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 if ($products == ) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
  
 if (empty($products)) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 if (!isset($products)) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 if (count($products) == 0) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 NOTHING works!!!
  
 Any help.. puuulease?
  
 Aaron
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to death to 
defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP-DB] calendário

2003-02-05 Thread Rui Miguel Palma
Eu tenho dois SELECT um para os meses e outros para os anos, como faço para garantir 
que o utilizador não possa escolher um ano já passado, e durante o presente ano apenas 
os meses seguintes e o actual.

Desde já obrigado
__
Rui Palma
ICQ#: 171381429
  Current ICQ status: 
+  More ways to contact me 
__



RE: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread Hutchins, Richard
What about:

count($arrayname)

Should tell you how many items are in an array.

 -Original Message-
 From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 05, 2003 4:04 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 
 Argh 
  
  
 HOW does one check for an array being empty from a form 
 field??
  
 Tried a billion different things and NOTHING works
  
 I've tried:
  
 if ($products == \n) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 if ($products == ) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
  
 if (empty($products)) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 if (!isset($products)) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 if (count($products) == 0) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 NOTHING works!!!
  
 Any help.. puuulease?
  
 Aaron
 

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




Re: [PHP-DB] checking for empty array from a form field?grrrrrrrrrrr!

2003-02-05 Thread Mignon Hunter
I usually use:

while(list($key,$value) = each($products)) {
echo $key:$value;
}


On Wed, 2003-02-05 at 15:03, Aaron Wolski wrote:
 Argh 
  
 
 HOW does one check for an array being empty from a form field??
  
 Tried a billion different things and NOTHING works
  
 I've tried:
  
 if ($products == \n) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
 
 if ($products == ) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
 
 
 if (empty($products)) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
 
 if (!isset($products)) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
 
 if (count($products) == 0) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
 
 NOTHING works!!!
  
 Any help.. puuulease?
  
 Aaron
-- 
Mignon Hunter
Web Developer
Toshiba International
713.466.0277 x 3461


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




RE: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread Aaron Wolski
Ok... well

When I select the select product which has a option value= it tells
me the count is one (1). If I select an ACTUAL product it tells me
one(1) was select.. if I select two ACTUAL products it tells me two (2)
products were selected.

For SOME reason it doesn't seem to be recognizing that the option
value= is empty!


Any more ideas??

*sigh*

Aaron

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] 
Sent: February 5, 2003 4:03 PM
To: 'Aaron Wolski'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] checking for empty array from a form field?
grrr!

What about:

count($arrayname)

Should tell you how many items are in an array.

 -Original Message-
 From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 05, 2003 4:04 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 
 Argh 
  
  
 HOW does one check for an array being empty from a form 
 field??
  
 Tried a billion different things and NOTHING works
  
 I've tried:
  
 if ($products == \n) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 if ($products == ) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
  
 if (empty($products)) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 if (!isset($products)) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 if (count($products) == 0) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 NOTHING works!!!
  
 Any help.. puuulease?
  
 Aaron
 

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




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




RE: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread jay
to find out if an array is empty use:
empty()

it must be unset
NULL returns false
0 returns false
it must be truly empty to return true...



 Ok... well
 
 When I select the select product which has a option value= it tells
 me the count is one (1). If I select an ACTUAL product it tells me
 one(1) was select.. if I select two ACTUAL products it tells me two (2)
 products were selected.
 
 For SOME reason it doesn't seem to be recognizing that the option
 value= is empty!
 
 
 Any more ideas??
 
 *sigh*
 
 Aaron
 
 -Original Message-
 From: Hutchins, Richard [mailto:[EMAIL PROTECTED]]
 Sent: February 5, 2003 4:03 PM
 To: 'Aaron Wolski'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 What about:
 
 count($arrayname)
 
 Should tell you how many items are in an array.
 
  -Original Message-
  From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, February 05, 2003 4:04 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] checking for empty array from a form field?
  grrr!
 
 
  Argh 
 
 
  HOW does one check for an array being empty from a form
  field??
 
  Tried a billion different things and NOTHING works
 
  I've tried:
 
  if ($products == \n) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
  if ($products == ) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
 
  if (empty($products)) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
  if (!isset($products)) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
  if (count($products) == 0) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
  NOTHING works!!!
 
  Any help.. puuulease?
 
  Aaron
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

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




RE: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread Hutchins, Richard
Somebody else replied with isset($varname). Try that. The count() function
is working as expected (see
http://www.php.net/manual/en/function.count.php). So maybe it's not the best
choice for trying to find out what you want.

 -Original Message-
 From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 05, 2003 4:53 PM
 To: 'Hutchins, Richard'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 
 Ok... well
 
 When I select the select product which has a option 
 value= it tells
 me the count is one (1). If I select an ACTUAL product it tells me
 one(1) was select.. if I select two ACTUAL products it tells 
 me two (2)
 products were selected.
 
 For SOME reason it doesn't seem to be recognizing that the option
 value= is empty!
 
 
 Any more ideas??
 
 *sigh*
 
 Aaron
 
 -Original Message-
 From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] 
 Sent: February 5, 2003 4:03 PM
 To: 'Aaron Wolski'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 What about:
 
 count($arrayname)
 
 Should tell you how many items are in an array.
 
  -Original Message-
  From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, February 05, 2003 4:04 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] checking for empty array from a form field?
  grrr!
  
  
  Argh 
   
   
  HOW does one check for an array being empty from a form 
  field??
   
  Tried a billion different things and NOTHING works
   
  I've tried:
   
  if ($products == \n) {
   
  echo hello;
  }
   
  else {
   
  echo bye;
   
  }
   
   
  if ($products == ) {
   
  echo hello;
  }
   
  else {
   
  echo bye;
   
  }
   
   
   
  if (empty($products)) {
   
  echo hello;
  }
   
  else {
   
  echo bye;
   
  }
   
   
  if (!isset($products)) {
   
  echo hello;
  }
   
  else {
   
  echo bye;
   
  }
   
   
  if (count($products) == 0) {
   
  echo hello;
  }
   
  else {
   
  echo bye;
   
  }
   
   
  NOTHING works!!!
   
  Any help.. puuulease?
   
  Aaron
  
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

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




AW: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread [EMAIL PROTECTED]
hallo,

look like here?

http://www.php.net/manual/en/function.sizeof.php

echo sizeof($HTTP_POST_VARS[myArrayObject]);


a.v.l


-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 5. Februar 2003 02:54
An: Aaron Wolski
Cc: [EMAIL PROTECTED]
Betreff: RE: [PHP-DB] checking for empty array from a form field?
grrr!


to find out if an array is empty use:
empty()

it must be unset
NULL returns false
0 returns false
it must be truly empty to return true...



 Ok... well

 When I select the select product which has a option value= it tells
 me the count is one (1). If I select an ACTUAL product it tells me
 one(1) was select.. if I select two ACTUAL products it tells me two (2)
 products were selected.

 For SOME reason it doesn't seem to be recognizing that the option
 value= is empty!


 Any more ideas??

 *sigh*

 Aaron

 -Original Message-
 From: Hutchins, Richard [mailto:[EMAIL PROTECTED]]
 Sent: February 5, 2003 4:03 PM
 To: 'Aaron Wolski'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] checking for empty array from a form field?
 grrr!

 What about:

 count($arrayname)

 Should tell you how many items are in an array.

  -Original Message-
  From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, February 05, 2003 4:04 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] checking for empty array from a form field?
  grrr!
 
 
  Argh 
 
 
  HOW does one check for an array being empty from a form
  field??
 
  Tried a billion different things and NOTHING works
 
  I've tried:
 
  if ($products == \n) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
  if ($products == ) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
 
  if (empty($products)) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
  if (!isset($products)) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
  if (count($products) == 0) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
  NOTHING works!!!
 
  Any help.. puuulease?
 
  Aaron
 

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




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

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



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




RE: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread Aaron Wolski
Well well well.. with the help of someone else pointing me in a
different direction altogether here's what we came up with that totally
works!


$PRODUCT_SELECTED = TRUE;

foreach($products as $value) {

if(empty($value)) {

$PRODUCT_SELECTED = FALSE;
}

last;

}

if(!$PRODUCT_SELECTED) {

$productQuery = db_query(SELECT name FROM CartTable
WHERE submitted=1 GROUP BY name);
while ($productResult = db_fetch($productQuery)) {

$products[] = $productResult[name];

}

$prod_search = in(;
for ($i=0;$icount($products);$i++) {

$prod_search .=
escapeQuote($products[$i]);
if ($i !=
(count($products) - 1)) {
$prod_search .=
,;
}
}

$prod_search .= );

$product = AND name $prod_search;

}

else {

$prod_search = in(;
for ($i=0;$icount($products);$i++) {   
$prod_search .= escapeQuote($products[$i]);
if ($i != (count($products) - 1)) {
$prod_search .= ,;
 }
}

$prod_search .= );

$product = AND name $prod_search;
  
}

Thanks to all for their support and help on this. Longest 4 hours of my
life :(

Aaron

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] 
Sent: February 5, 2003 4:53 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] checking for empty array from a form field?
grrr!

Somebody else replied with isset($varname). Try that. The count()
function
is working as expected (see
http://www.php.net/manual/en/function.count.php). So maybe it's not the
best
choice for trying to find out what you want.

 -Original Message-
 From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 05, 2003 4:53 PM
 To: 'Hutchins, Richard'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 
 Ok... well
 
 When I select the select product which has a option 
 value= it tells
 me the count is one (1). If I select an ACTUAL product it tells me
 one(1) was select.. if I select two ACTUAL products it tells 
 me two (2)
 products were selected.
 
 For SOME reason it doesn't seem to be recognizing that the option
 value= is empty!
 
 
 Any more ideas??
 
 *sigh*
 
 Aaron
 
 -Original Message-
 From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] 
 Sent: February 5, 2003 4:03 PM
 To: 'Aaron Wolski'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 What about:
 
 count($arrayname)
 
 Should tell you how many items are in an array.
 
  -Original Message-
  From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, February 05, 2003 4:04 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] checking for empty array from a form field?
  grrr!
  
  
  Argh 
   
   
  HOW does one check for an array being empty from a form 
  field??
   
  Tried a billion different things and NOTHING works
   
  I've tried:
   
  if ($products == \n) {
   
  echo hello;
  }
   
  else {
   
  echo bye;
   
  }
   
   
  if ($products == ) {
   
  echo hello;
  }
   
  else {
   
  echo bye;
   
  }
   
   
   
  if (empty($products)) {
   
  echo hello;
  }
   
  else {
   
  echo bye;
   
  }
   
   
  if (!isset($products)) {
   
  echo hello;
  }
   
  else {
   
  echo bye;
   
  }
   
   
  if (count($products) == 0) {
   
  echo hello;
  }
   
  else {
   
  echo bye;
   
  }
   
   
  NOTHING works!!!
   
  Any help.. puuulease?
   
  Aaron
  
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

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




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




[PHP-DB] Oracle + PHP + Linux Red Hat {again}

2003-02-05 Thread Alberto Grájeda C.
Please, any idea to resolve my problem!!!

I have the output:
Connected to DataBase Oracle!
Warning: OCIStmtExecute: ORA-03106: fatal two-task communication protocol 
error in /var/www/html/ora2.php on line 21

Warning: OCIFetchStatement: ORA-24374: define not done before fetch or 
execute and fetch in /var/www/html/ora2.php on line 22
Found: 0 results

I'm running redhat 7.3 with oracle 9i client connecting to oracle 8.0.5 
Server on NT. I put the putEnv to $ORACLE_HOME,$ORACLE_SID,I use 
OCIDefineByName, but the result is the error. When I'm using the oci 
functions I can't receive the error above, but if I use the old oracle 
functions of php, the results are good.

Do someone have any idea to resolve my problem??

Thanks in advance.

P.D. I probe to set up the User=oracle and Group dba in apache web server, 
but  either, it's not working.

The source code:
?php
PutEnv(ORACLE_SID=upbback);
PutEnv(ORACLE_HOME=/opt/oracle/product/9.2.0);

$db_conn = ocilogon(generador,sinok,upbback);
if (!$db_conn)
{
   echo Connection failed;
   echo Error Message: [ . OCIError($db_conn) . ];
   exit;
}
else
{
  echo Connected to DataBase Oracle!;
}

$cmdstr = select cod_aula,nombre from aulas;
$parsed = ociparse($db_conn, $cmdstr);
OCIDefineByName($parsed,COD_AULA,$codaula);
OCIDefineByName($parsed,NOMBRE,$nombre); 
OCIExecute($parsed);
$nrows = ocifetchstatement($parsed, $results);
echo Found: $nrows results\n;
echo table border=1 cellspacing='0' width='50%' align=center\n;
echo tr\n;
echo tdbCodigo/b/td\n;
echo tdbNombre/b/td\n;
echo /tr\n;

for ($i = 0; $i  $nrows; $i++ ) {
echo tr\n;
echo td . $codaula. /td;
echo td . $nombre. /td;
echo /tr\n;
}
echo /table\n;
OCIFreeStatement($parsed);
OCILogoff($db_conn);
?


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




Re: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread Jeff Pauls
try :

if (strlen($products) == 0) {
 
echo nothing entered in field;
}


http://www.php.net/manual/en/function.strlen.php


Jeff


- Original Message - 
From: Aaron Wolski [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 05, 2003 3:03 PM
Subject: [PHP-DB] checking for empty array from a form field? grrr!


 Argh 
  
  
 HOW does one check for an array being empty from a form field??
  
 Tried a billion different things and NOTHING works
  
 I've tried:
  
 if ($products == \n) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 if ($products == ) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
  
 if (empty($products)) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 if (!isset($products)) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 if (count($products) == 0) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
  
 NOTHING works!!!
  
 Any help.. puuulease?
  
 Aaron
 


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




[PHP-DB] Use php with sequel server2000?

2003-02-05 Thread Terry L. Ensley
I have a situation where I have a network at work with only Sequel Server
2000 on a Microsoft IIs Server.  Is php a viable option for accessing a
sequel database?

Thanks



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




[PHP-DB] Re: php-db Digest 5 Feb 2003 17:13:51 -0000 Issue 1661

2003-02-05 Thread JeRRy
Hi,

I would like to know how to get error messages to
appear if something goes wrong.  Like if the mysql
finds the database account but fails to update the
table, finds the table but a unique entry is inputted
so can't add.  I'd like to be able, if possible, to
customize the error message.  Could someone please
show me how to achieve this?

At pressent it only produces an error if the database
is not found.  Nothing else!

Jerry

http://movies.yahoo.com.au - Yahoo! Movies
- What's on at your local cinema?

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




[PHP-DB] Remnant data from previous queries when using mysql_fetch_array...

2003-02-05 Thread Mike Hilty
Hello,
I am a novice PHP dev having a strange issue with mysql_fetch_array.
For some reason, it is keeping data from previous queries in the array, and
displaying it in the web page.
My development platform is Win2k SP2, Apache 1.3.23, PHP 4.3.0,
MySQL-MAX 3.23.47-nt.
Here is the code that I am using:

?php
// open database connection
$connection = mysql_connect(localhost, username, password) or die (Unable
to
connect!);

// select database
mysql_select_db(vendorNameChange) or die (Unable to select database!);

// generate and execute query
$query = select * from changelog where changedBy = '$changedBy' or
vendorNumber = '$vendorNumber'
or oldName like '$oldName' or newName like '$newName' or newVendorNumber =
'$newVendorNumber';
$result = mysql_query($query) or die (Error in query: $query.  .
mysql_error());

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

do {
print buOld vendor number/u: /b;
print $row[vendorNumber];
print br;
snip
/snip
} while($row = mysql_fetch_array($result));

} else {print Sorry, no records were found!;}

// close database connection
mysql_close($connection);

?

I am looking for a way to initialize the array, and display only the
data returned from the current query on the page.  Any help with this would
be greatly appreciated.

Thanks,
Mike Hilty






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




[PHP-DB] ``List-Unsubscribe''

2003-02-05 Thread Bruce Levick
``List-Unsubscribe''




RE: [PHP-DB] Use php with sequel server2000?

2003-02-05 Thread John W. Holmes
 I have a situation where I have a network at work with only Sequel
Server
 2000 on a Microsoft IIs Server.  Is php a viable option for accessing
a
 sequel database?

Sure... 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




RE: [PHP-DB] Remnant data from previous queries when using mysql_fetch_array...

2003-02-05 Thread John W. Holmes
 I am a novice PHP dev having a strange issue with
mysql_fetch_array.
 For some reason, it is keeping data from previous queries in the
array,
 and
 displaying it in the web page.
 My development platform is Win2k SP2, Apache 1.3.23, PHP 4.3.0,
 MySQL-MAX 3.23.47-nt.
 Here is the code that I am using:
 
 ?php
 // open database connection
 $connection = mysql_connect(localhost, username, password) or die
(Unable
 to
 connect!);
 
 // select database
 mysql_select_db(vendorNameChange) or die (Unable to select
database!);
 
 // generate and execute query
 $query = select * from changelog where changedBy = '$changedBy' or
 vendorNumber = '$vendorNumber'
 or oldName like '$oldName' or newName like '$newName' or
newVendorNumber =
 '$newVendorNumber';
 $result = mysql_query($query) or die (Error in query: $query.  .
 mysql_error());
 
 if ($row = mysql_fetch_array($result)) {
 
 do {
 print buOld vendor number/u: /b;
 print $row[vendorNumber];
 print br;
 snip
 /snip
 } while($row = mysql_fetch_array($result));
 
 } else {print Sorry, no records were found!;}
 
 // close database connection
 mysql_close($connection);
 
 ?
 
 I am looking for a way to initialize the array, and display only
the
 data returned from the current query on the page.  Any help with this
 would
 be greatly appreciated.

$row = array();

will initialize the $row variable to an empty array. Or you can use
unset($row) to just get rid of it entirely. 

The problem isn't with mysql_query(), it's just that $row is retaining
data from a previous loop in your script. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




[PHP-DB] PHP Database Abstraction Layer

2003-02-05 Thread Luke Woollard
I once read a great article in the first or second issue of
http://www.phparch.com/ on database abstraction layers. At which point I
used the tutorial as a starting point for creating a very similar structure
I named dbWave. There are only minor differences and a postgresql driver is
now included for the most common pg_* functions.

I was just wondering if anyone has developed a database abstraction layer
that allows you to separate your SQL queries from your application logic
like dbWave does? I'm looking for a more advanced way of doing this?


Attached is dbWave for anyone to look at/use. To run it you need to use the
following tags in your file:

// DBWave include files
include( [attached_filename].php );

To instantiate the dbWave object you use the following code in a file name
connect.php
?php

/* This file instantiates dbWave using our chosen API */
/* It is automatically generated by the database setup program */

// Instantiate dbWave using the MySQL API
$dbWave = new Mysql();

// Connect to the database
$dbWave-connect( 'yourhost', 'yourport', 'yourdbname', 'yourdbuser',
'yourdbpass' );
?


Thanks,

Luke Woollard
Programmer / Analyst
TABORVISION.com


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


[PHP-DB] subdate

2003-02-05 Thread Addison Ellis
hello,
	thank you for your time.

	please note the time intervals that are working. what i 
want is to select only data that is two weeks old or younger. i did a 
test with one day and it worked great. i inserted the two-week/14days 
and neither of them worked. 1 month worked. i could not find anything 
on php.net that directed me to this.  thank you again, addison

this works:(*note end of syntax interval 1 day)
$obj = mysql_db_query($dbname,select a.*,s.name as 
subcategory_name,c.name as category_name from ads a,subcategory s,
category c where a.subcategory=s.id and s.category=c.id and 
a.subcategory=$id and a.que='checked' and
createdate =subdate(now(), interval 1 day));


this does not: (*note end of syntax interval 14 days)
$obj = mysql_db_query($dbname,select a.*,s.name as 
subcategory_name,c.name as category_name from ads a,subcategory s,
category c where a.subcategory=s.id and s.category=c.id and 
a.subcategory=$id and a.que='checked' and
createdate =subdate(now(), interval 14 days));


this does not: (*note end of syntax interval 2 weeks)
$obj = mysql_db_query($dbname,select a.*,s.name as 
subcategory_name,c.name as category_name from ads a,subcategory s,
category c where a.subcategory=s.id and s.category=c.id and 
a.subcategory=$id and a.que='checked' and
createdate =subdate(now(), interval 2 weeks));


this works: (*note end of syntax interval 1 month)
$obj = mysql_db_query($dbname,select a.*,s.name as 
subcategory_name,c.name as category_name from ads a,subcategory s,
category c where a.subcategory=s.id and s.category=c.id and 
a.subcategory=$id and a.que='checked' and
createdate =subdate(now(), interval 1 month));
--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
[EMAIL PROTECTED]
[EMAIL PROTECTED]
subsidiaries of small independent publishing co.
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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



RE: [PHP-DB] subdate

2003-02-05 Thread John W. Holmes
   please note the time intervals that are working. what i
 want is to select only data that is two weeks old or younger. i did a
 test with one day and it worked great. i inserted the two-week/14days
 and neither of them worked. 1 month worked. i could not find anything
 on php.net that directed me to this.  thank you again, addison
 
 this works:(*note end of syntax interval 1 day)
  createdate =subdate(now(), interval 1 day));


 this does not: (*note end of syntax interval 14 days)
  createdate =subdate(now(), interval 14 days));


 this does not: (*note end of syntax interval 2 weeks)
  createdate =subdate(now(), interval 2 weeks));


 this works: (*note end of syntax interval 1 month)
  createdate =subdate(now(), interval 1 month));


Take a look at 

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html
#Date_and_time_functions

and see why DAYS and WEEKS is causing you trouble. 

You're still not checking mysql_error() when you issue a query, are you?
Otherwise you may have figured it out already. And, you're still using
mysql_db_query(), which is depreciated. :( 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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