php-general Digest 17 May 2004 13:07:39 -0000 Issue 2768

Topics (messages 186369 through 186403):

Re: while inside a while or join or...
        186369 by: Rachel Rodriguez
        186370 by: Curt Zirzow
        186371 by: John W. Holmes

Forums
        186372 by: Ryan A
        186373 by: John W. Holmes
        186374 by: Justin French
        186381 by: Steve Magruder - WebCommons.org
        186391 by: John Taylor-Johnston
        186392 by: John Taylor-Johnston

change database from mysql to mssql
        186375 by: David
        186393 by: Torsten Roehr
        186403 by: Aidan Lister

create if table not exists
        186376 by: John Taylor-Johnston
        186378 by: Travis Low
        186379 by: Tim Van Wassenhove
        186385 by: John Taylor-Johnston
        186386 by: John Taylor-Johnston
        186390 by: John Taylor-Johnston

Re: weird problem with index page
        186377 by: Andy Ladouceur
        186382 by: loll
        186383 by: Jason Wong

Re: File_exists result cached over a session?
        186380 by: Steve Magruder - WebCommons.org

passing values of checkboxes in PHP
        186384 by: gowthaman ramasamy
        186387 by: John Taylor-Johnston
        186394 by: Marek Kilimajer

passing values of checkboxes in PHP- solved
        186388 by: gowthaman ramasamy
        186389 by: John Taylor-Johnston

keeping the last zero
        186395 by: Mario
        186396 by: Oliver Hankeln
        186397 by: Marek Kilimajer
        186401 by: php chucker

[Newbie] Simple stats from mysql table data
        186398 by: Vans Hallden

class_xslt
        186399 by: eoghan
        186400 by: Clifford W. Hansen

thought I should share this
        186402 by: Brent Clark

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
> 
> I would like to select all 'b' from Table_1 WHERE a
> = '2' and then to 
> select all 'd' from table_2 with 'b' from previous
> result.
> 
> Table 2 is the Table with UserNames (d) and Table 1
> is the table with 
> 'marked' UserID's (b).
> 
If I understand you correctly, its sounds like you
want to do the following:

$sql = "
SELECT t1.b,
       t2.d
FROM Table_1 AS t1
LEFT JOIN Table_2 AS t2
ON (t1.b = t2.d)
WHERE t1.a = '2'";


=====
~Rachel


        
                
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/

--- End Message ---
--- Begin Message ---
* Thus wrote T. H. Grejc ([EMAIL PROTECTED]):
> Hallo,
> 
> I know of a few ways of doing this but I am not sure that any is right. 
> I want to consult with you what is the best way of doing this:
> 
> ...
> 
> I would like to select all 'b' from Table_1 WHERE a = '2' and then to 
> select all 'd' from table_2 with 'b' from previous result.
> 
> Table 2 is the Table with UserNames (d) and Table 1 is the table with 
> 'marked' UserID's (b).
> 
> What is the best way of doing this.

I'm having difficluties finding out how this is related to php, but
anyway... this is a  simple joining of two tables.

so you have

  select b from table_1 where a = 2

and
  select d from table_2 where b = results from table_1

Thus

  select table_1.b, table_2.d from table_1, table_2 
   where table_1.b = table_2.b 
    and table_1.a = 2


come to think of it, thats very much like an algebra problem.


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

--- End Message ---
--- Begin Message ---
T. H. Grejc wrote:

Hallo,

I know of a few ways of doing this but I am not sure that any is right. I want to consult with you what is the best way of doing this:

Table 1:
+----+-----+
| *a* | *b* |
+----+-----+
|  2   |  1    |
+----+-----+
|  2   |  2    |
+----+-----+

Table 2:
+----+-----+
| *b* | *d* |
+----+-----+
|  1   |  asd |
+----+-----+
|  2   |  fgh |
+----+-----+

I would like to select all 'b' from Table_1 WHERE a = '2' and then to select all 'd' from table_2 with 'b' from previous result.

Table 2 is the Table with UserNames (d) and Table 1 is the table with 'marked' UserID's (b).

What's this go to do with PHP? This should be on php-db at least...

SELECT t1.b, t2.d FROM table1 t1, table2, t2 WHERE t1.a = 2 AND t1.b = t2.b

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Hey,
Just spent 2 hours at hot scripts searching for a good forum software, after
going through 15 pages I found:
"PBLang - International PHP-forum" which seems good.

If anybody has used it...I would appreciate you telling me how your
experience with it was...good, bad and anything in between.

I have not *totally* decided on it, so if you know of a good/great piece of
forum software (HAS to be written in PHP) please feel free to reply and tell
me...if you do...good things will happen to you :-) or consider it your good
deed for the day/week.

Two forums that I really like are:
1. the forum at DIVX.com  (very very cool)
2. awforum.net (unfortunatly written in ASP..pain in the butt but easy to
use as its really simple)

The software HAS to be written in PHP coz its for a php discussion site.

Thanks,
-Ryan

--- End Message ---
--- Begin Message ---
Ryan A wrote:

Hey,
Just spent 2 hours at hot scripts searching for a good forum software, after
going through 15 pages I found:
"PBLang - International PHP-forum" which seems good.

Either get the free version of Invision Power Board or do yourself a favor and buy vBulletin.


--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message --- Personally, I hate almost all forum software other than my own (still in Dev), but that's a different story.

I've been frequenting the Textpattern forums [1] lately, which use PubBB [2], which is pretty good, lightweight, PHP driven, with a reasonable grip on standards and CSS.

1 http://www.textpattern.com/
2 http://www.punbb.org/

On 17/05/2004, at 10:54 AM, Ryan A wrote:

Hey,
Just spent 2 hours at hot scripts searching for a good forum software, after
going through 15 pages I found:
"PBLang - International PHP-forum" which seems good.


If anybody has used it...I would appreciate you telling me how your
experience with it was...good, bad and anything in between.

I have not *totally* decided on it, so if you know of a good/great piece of
forum software (HAS to be written in PHP) please feel free to reply and tell
me...if you do...good things will happen to you :-) or consider it your good
deed for the day/week.


Two forums that I really like are:
1. the forum at DIVX.com (very very cool)
2. awforum.net (unfortunatly written in ASP..pain in the butt but easy to
use as its really simple)


The software HAS to be written in PHP coz its for a php discussion site.

Thanks,
-Ryan

--- Justin French http://indent.com.au

--- End Message ---
--- Begin Message ---
Ryan A wrote:
> Hey,
> Just spent 2 hours at hot scripts searching for a good forum
> software, after going through 15 pages I found:
{snip}
> The software HAS to be written in PHP coz its for a php discussion
> site.

phpBB (www.phpbb.com) is the best (IMHO), as it has an extensive modder
community and it's slap-easy to install and get running.
-- 

Steve Magruder
www.webcommons.org

--- End Message ---
--- Begin Message ---
Costs money too!?

"Steve Magruder - Webcommons.Org" wrote:

> phpBB (www.phpbb.com) is the best (IMHO), as it has an extensive modder
> community and it's slap-easy to install and get running.

--- End Message ---
--- Begin Message ---
I personally prefer:

http://www.chevelles.com/cgi-bin/forum/ultimatebb.cgi?ubb=forum;f=39;hardset=;start_point=;DaysPrune=
http://www.ubbcentral.com/ubbclassic/

But it does cost $ I believe. However, this particular site has a mutilated forum. 
Part of it was originally Perl. Their switch over was painful. Part is php, part is 
Perl. Counter-productive. But I like how it works. I also love being a chevelle owner 
:)  http://www.chevelles.com/wagons/4-doors.html


> Two forums that I really like are:
> 1. the forum at DIVX.com  (very very cool)
> 2. awforum.net (unfortunatly written in ASP..pain in the butt but easy to
> use as its really simple)

--- End Message ---
--- Begin Message ---
Hi all

I have been using mysql as the database for my PHP application.
Now my manager ordered me to use Microsoft SQL Server as the database.
I have been using the mysql interface to access the database, so I have
to change my code.
Which database interface should I use, ODBC, ADO, mssql or PEAR?
Any brief suggestion or link to some good tutorial/paper would be very 
much appreciated.

============================
David Oilfield
China Lottery Online Co. Ltd
Email:[EMAIL PROTECTED]
Mobile:13521805655
Phone:010-83557528-263
============================

--- End Message ---
--- Begin Message ---
"David" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all
>
> I have been using mysql as the database for my PHP application.
> Now my manager ordered me to use Microsoft SQL Server as the database.
> I have been using the mysql interface to access the database, so I have
> to change my code.
> Which database interface should I use, ODBC, ADO, mssql or PEAR?
> Any brief suggestion or link to some good tutorial/paper would be very
> much appreciated.
>

Try PEAR::MDB or PEAR::MDB2 (as soon as it's stable) - this should also make
switching to another database easier in the future - back to MySQL maybe ;)
http://pear.php.net/package/MDB
http://pear.php.net/package/MDB2

Regards, Torsten

--- End Message ---
--- Begin Message ---
Yep, MDB2 is the best bet

"Torsten Roehr" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "David" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi all
> >
> > I have been using mysql as the database for my PHP application.
> > Now my manager ordered me to use Microsoft SQL Server as the database.
> > I have been using the mysql interface to access the database, so I have
> > to change my code.
> > Which database interface should I use, ODBC, ADO, mssql or PEAR?
> > Any brief suggestion or link to some good tutorial/paper would be very
> > much appreciated.
> >
>
> Try PEAR::MDB or PEAR::MDB2 (as soon as it's stable) - this should also
make
> switching to another database easier in the future - back to MySQL maybe
;)
> http://pear.php.net/package/MDB
> http://pear.php.net/package/MDB2
>
> Regards, Torsten

--- End Message ---
--- Begin Message ---
How can I check if a table exists in a mysql db. If it table does not exist, then,

$news = mysql_query($sql_create);

else

$news = mysql_query($sql);

Not sure I know where to start?


-----snip--------
$server = "localhost";
$user = "user1";
$pass = "****";
$db="user1table";
$table="comments";

$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);

$sql = 'SELECT * FROM '.$table.' WHERE MATCH (username) AGAINST 
(\''.stripslashes($searchenquiry).'\' IN BOOLEAN MODE) ORDER BY id asc;';

$sql_create = "CREATE TABLE ".$table." (
   id int(11) NOT NULL auto_increment,
   username varchar(100) NOT NULL,
   comment text,
   PRIMARY KEY (id)
);




Sorry, I'm not even sure if this is a php thing as much as it is also mysql.

-
John

--- End Message ---
--- Begin Message ---
The manual says:

<?php
mysql_connect("host");
$result = mysql_list_tables("wisconsin");
for ($i = 0; $i < mysql_num_rows($result); $i++) {
    $tb_names[$i] = mysql_tablename($result, $i);
    echo $tb_names[$i] . "<BR>";
}
?>

To paraphrase, just use mysql_list_tables() to get a table list in a result set, then go through the result set to see if the named table exists.

But wouldn't it be easier to create the tables in the first place?

cheers,

Travis


John Taylor-Johnston wrote:
How can I check if a table exists in a mysql db. If it table does not exist, then,

$news = mysql_query($sql_create);

else

$news = mysql_query($sql);

Not sure I know where to start?


-----snip-------- $server = "localhost"; $user = "user1"; $pass = "****"; $db="user1table"; $table="comments";

$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);

$sql = 'SELECT * FROM '.$table.' WHERE MATCH (username) AGAINST 
(\''.stripslashes($searchenquiry).'\' IN BOOLEAN MODE) ORDER BY id asc;';

$sql_create = "CREATE TABLE ".$table." (
   id int(11) NOT NULL auto_increment,
   username varchar(100) NOT NULL,
   comment text,
   PRIMARY KEY (id)
);




Sorry, I'm not even sure if this is a php thing as much as it is also mysql.

-
John


-- Travis Low <mailto:[EMAIL PROTECTED]> <http://www.dawnstar.com>

--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, John Taylor-Johnston wrote:
> How can I check if a table exists in a mysql db. 

$query = 'IF NOT EXISTS table CREATE TABLE table (......)';
mysql_query($query);

-- 
Tim Van Wassenhove <http://home.mysth.be/~timvw/contact.php>

--- End Message ---
--- Begin Message ---
I used phpmyadmin to help generate some code. When I add:

IF NOT EXISTS `mhinse_counter` it mysql_errors that the error is around:

"IF  NOT  EXISTS  `mhinse_counter` CREATE  TABLE  `mhinse_counter` ( "

Can anyone see clear here?


$server = "localhost";
$user = "user1";
$pass = "******";
$db="jtjohnston";
$table="mhinse_counter";


$query = 'IF NOT EXISTS `mhinse_counter`
CREATE TABLE `mhinse_counter` ( `id` int( 10 ) NOT NULL AUTO_INCREMENT ,'
         . ' `IPAddress` varchar( 100 ) NOT NULL default \'\','
         . ' `RemoteHost` varchar( 100 ) NOT NULL default \'\','
         . ' `Language` text NOT NULL ,'
         . ' `StampDate` date NOT NULL default \'0000-00-00\','
         . ' `StampTime` time NOT NULL default \'00:00:00\','
         . ' `TimeStamp` timestamp( 14 ) NOT NULL ,'
         . ' PRIMARY KEY ( `id` ) ) TYPE = MYISAM AUTO_INCREMENT =1';

$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
mysql_query($query) or die(print mysql_error());



> Tim Van Wassenhove wrote:
> > How can I check if a table exists in a mysql db.
> $query = 'IF NOT EXISTS table CREATE TABLE table (......)';
> mysql_query($query);

--- End Message ---
--- Begin Message ---
>But wouldn't it be easier to create the tables in the first place?

Travis,
It surely would. But for one situation, I don't/can't have access to phpMyAdmin to 
install it.
At the same time, I wanted to learn how to do it.

--
John

I'm still learning. But isn't this much more fun than Perl!


> To paraphrase, just use mysql_list_tables() to get a table list in a result
> set, then go through the result set to see if the named table exists.
>
> But wouldn't it be easier to create the tables in the first place?

--- End Message ---
--- Begin Message ---
Should have read:

CREATE TABLE IF NOT EXISTS `mhinse_counter`


> mysql_error said:
>
> "IF  NOT  EXISTS  `mhinse_counter` CREATE  TABLE  `mhinse_counter` ( "
>

Thanks to all.

--- End Message ---
--- Begin Message --- Try adding a trailing slash to the URL, and seeing if it works. If so, then try adding the apache configuration directive:

UseCanonicalName off

In either httpd.conf or an .htaccess file, and try accessing without the trailing slash. I had a similar issue and adding that fixed it.

Andy

Loll wrote:
[snip]if I go to www.domain.com/subdir it sya s page not found even though there is a index.php file in that directory. I am at a loss as to what is wrong. index.php is listed inthe directoryindex for apache so I dont understand why it is doing all this.

If anyone can help me it would be appreciated.

Thanks

Loll

--- End Message ---
--- Begin Message ---
Hi,

Thanks for th einfo, after beating myself all day over it, I have determined that it only seesm to be an issue when using Internet Explorer, using opera or mozilla it seems to work as it should, so I really dont understand now.

Checked the apache setting you meantioned and it seems to already be set to OFF.

Anyway, with all these troubles I thought perhaps I would try upgrading php by creating a CGI version (the server has mod 4.2.2 installed). I managed to get the binary to create correctly, I can use it from the command line (tested it by using ./php.cgi phpinfo.php) but when I try to get it to work from the browser , I end up at best with a error 500. *sigh* Can't seem to find anythign that works can I?






At 12:12 AM 5/17/2004, you wrote:
Try adding a trailing slash to the URL, and seeing if it works. If so, then try adding the apache configuration directive:

UseCanonicalName off

In either httpd.conf or an .htaccess file, and try accessing without the trailing slash. I had a similar issue and adding that fixed it.

Andy

Loll wrote:
[snip]if I go to www.domain.com/subdir it sya s page not found even though there is a index.php file in that directory. I am at a loss as to what is wrong. index.php is listed inthe directoryindex for apache so I dont understand why it is doing all this.
If anyone can help me it would be appreciated.
Thanks
Loll

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



--- End Message ---
--- Begin Message ---
On Monday 17 May 2004 13:38, loll wrote:

> Thanks for th einfo, after beating myself all day over it, I have
> determined that it only seesm to be an issue when using Internet Explorer,
> using opera or mozilla it seems to work as it should, so I really dont
> understand now.

With Mozilla it automatically adds a trailing slash, maybe IE doesn't do this?

-- 
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
------------------------------------------
/*
No one can guarantee the actions of another.
                -- Spock, "Day of the Dove", stardate unknown
*/

--- End Message ---
--- Begin Message ---
Marek Kilimajer wrote:
> Steve Magruder - WebCommons.org wrote:
>> File_exists results (and the results from other file-related
>> functions) are cached (according to the php doc) during the run of a
>> script.  For instance, if file_exists returns True for a file once,
>> it won't actually test the file again if file_exists is run again
>> against the file.
>>
>> What I need to know is whether this caching works over a session
>> (not just during a single script run).
>>
>> Thanks.
>
> no

Thanks.  Does any documentation exist that covers this?
-- 

Steve Magruder
www.webcommons.org

--- End Message ---
--- Begin Message ---
hi list,
I have a problem with getting the values of check boxes ...

In the form i have many checkbox options created dynamically. All of
them have same name but different values. But when user submits the form
i am able to access only the value of last checkbox that user cliked.
Values of rest of the selection is not displayed/passed.  How can i get
all the values. 
many thanks in advance ...
followings are my scripts ...

form ........this prints lot of check boxes on the from as per the
result or previous mysql query
----------------------------------------------------------------
while ($rows2 = mysql_fetch_array($result2))
{
echo <input type=\"checkbox\" Name=protid value=\"$variable\"> something
... 
}



I am trying to access these checkbox values in follwing script ........
-----------------------------------------------------------------------
if(isset($_POST['submit']))                                                            
                                                                                       
                                          
{
echo "hello";
echo $hell=$_POST['protid'];
echo $counts = count($hell);
}
?>
counts says there is only one value ....(that is value of last checked
box) I also tried putting $hell=$_POST['protid'] in a while loop ....
did not work.
sincerely
gowtham
-- 
Ra. Gowthaman,
Graduate Student,
Bioinformatics Lab,
Malaria Research Group,
ICGEB , New Delhi.
INDIA

Phone: 91-9811261804
       91-11-26173184; 91-11-26189360 #extn 314

--- End Message ---
--- Begin Message ---
Gowthaman,

Just at a glance, it seems that you Should Only receive One value.

<input type=\"checkbox\" Name=protid value=\"$variable\">

'Name=protid' tells me that you have only created one value.

Because they ALL have the SAME name="protid" there will be only one value.

This would be more evident if they were type=radiobox. What you need is to generate:

<input type=\"checkbox\" Name=protid1 value=\"$variable\">
<input type=\"checkbox\" Name=protid2 value=\"$variable\">
<input type=\"checkbox\" Name=protid3 value=\"$variable\">
<input type=\"checkbox\" Name=protid4 value=\"$variable\">

to get separate values.

Sorry! That's html.

Gowthaman Ramasamy wrote:

> In the form i have many checkbox options created dynamically. All of
> them have same name but different values. But when user submits the form
> i am able to access only the value of last checkbox that user cliked.
> Values of rest of the selection is not displayed/passed.  How can i get
> all the values.
> many thanks in advance ...
> followings are my scripts ...
>
> form ........this prints lot of check boxes on the from as per the
> result or previous mysql query
> ----------------------------------------------------------------
> while ($rows2 = mysql_fetch_array($result2))
> {
> echo <input type=\"checkbox\" Name=protid value=\"$variable\"> something
> ...
> }
>
> I am trying to access these checkbox values in follwing script ........
> -----------------------------------------------------------------------
> if(isset($_POST['submit']))
> {
> echo "hello";
> echo $hell=$_POST['protid'];
> echo $counts = count($hell);
> }
> ?>
> counts says there is only one value ....(that is value of last checked
> box) I also tried putting $hell=$_POST['protid'] in a while loop ....
> did not work.
> sincerely
> gowtham
> --
> Ra. Gowthaman,
> Graduate Student,
> Bioinformatics Lab,
> Malaria Research Group,
> ICGEB , New Delhi.
> INDIA
>
> Phone: 91-9811261804
>        91-11-26173184; 91-11-26189360 #extn 314

--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   -     Université de Sherbrooke:
          http://compcanlit.ca/
          819-569-2064

--- End Message ---
--- Begin Message --- John Taylor-Johnston wrote:
Gowthaman,

Just at a glance, it seems that you Should Only receive One value.

<input type=\"checkbox\" Name=protid value=\"$variable\">

'Name=protid' tells me that you have only created one value.

Because they ALL have the SAME name="protid" there will be only one value.

This would be more evident if they were type=radiobox. What you need is to generate:

<input type=\"checkbox\" Name=protid1 value=\"$variable\">
<input type=\"checkbox\" Name=protid2 value=\"$variable\">
<input type=\"checkbox\" Name=protid3 value=\"$variable\">
<input type=\"checkbox\" Name=protid4 value=\"$variable\">


Or give all name="protid[]" and you will get array $_POST['protid'] that you can loop over.

--- End Message ---
--- Begin Message ---
I myself solved the problem.
sorry for the trouble ..

sincerely,
gowtham
On Mon, 2004-05-17 at 11:51, gowthaman ramasamy wrote:
> hi list,
> I have a problem with getting the values of check boxes ...
> 
> In the form i have many checkbox options created dynamically. All of
> them have same name but different values. But when user submits the form
> i am able to access only the value of last checkbox that user cliked.
> Values of rest of the selection is not displayed/passed.  How can i get
> all the values. 
> many thanks in advance ...
> followings are my scripts ...
> 
> form ........this prints lot of check boxes on the from as per the
> result or previous mysql query
> ----------------------------------------------------------------
> while ($rows2 = mysql_fetch_array($result2))
> {
> echo <input type=\"checkbox\" Name=protid value=\"$variable\"> something
> ... 
> }
> 
> 
> 
> I am trying to access these checkbox values in follwing script ........
> -----------------------------------------------------------------------
> if(isset($_POST['submit']))                                                          
>                                                                                      
>                                             
> {
> echo "hello";
> echo $hell=$_POST['protid'];
> echo $counts = count($hell);
> }
> ?>
> counts says there is only one value ....(that is value of last checked
> box) I also tried putting $hell=$_POST['protid'] in a while loop ....
> did not work.
> sincerely
> gowtham
> -- 
> Ra. Gowthaman,
> Graduate Student,
> Bioinformatics Lab,
> Malaria Research Group,
> ICGEB , New Delhi.
> INDIA
> 
> Phone: 91-9811261804
>        91-11-26173184; 91-11-26189360 #extn 314
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
-- 
Ra. Gowthaman,
Graduate Student,
Bioinformatics Lab,
Malaria Research Group,
ICGEB , New Delhi.
INDIA

Phone: 91-9811261804
       91-11-26173184; 91-11-26189360 #extn 314

--- End Message ---
--- Begin Message ---
>sorry for the trouble ..
Nah! :)

Gowthaman Ramasamy wrote:

> I myself solved the problem.
> sorry for the trouble ..
>
> sincerely,
> gowtham
> On Mon, 2004-05-17 at 11:51, gowthaman ramasamy wrote:
> > hi list,
> > I have a problem with getting the values of check boxes ...
> >
> > In the form i have many checkbox options created dynamically. All of
> > them have same name but different values. But when user submits the form
> > i am able to access only the value of last checkbox that user cliked.
> > Values of rest of the selection is not displayed/passed.  How can i get
> > all the values.
> > many thanks in advance ...
> > followings are my scripts ...
> >
> > form ........this prints lot of check boxes on the from as per the
> > result or previous mysql query
> > ----------------------------------------------------------------
> > while ($rows2 = mysql_fetch_array($result2))
> > {
> > echo <input type=\"checkbox\" Name=protid value=\"$variable\"> something
> > ...
> > }
> >
> >
> >
> > I am trying to access these checkbox values in follwing script ........
> > -----------------------------------------------------------------------
> > if(isset($_POST['submit']))
> > {
> > echo "hello";
> > echo $hell=$_POST['protid'];
> > echo $counts = count($hell);
> > }
> > ?>
> > counts says there is only one value ....(that is value of last checked
> > box) I also tried putting $hell=$_POST['protid'] in a while loop ....
> > did not work.
> > sincerely
> > gowtham
> > --
> > Ra. Gowthaman,
> > Graduate Student,
> > Bioinformatics Lab,
> > Malaria Research Group,
> > ICGEB , New Delhi.
> > INDIA
> >
> > Phone: 91-9811261804
> >        91-11-26173184; 91-11-26189360 #extn 314
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> --
> Ra. Gowthaman,
> Graduate Student,
> Bioinformatics Lab,
> Malaria Research Group,
> ICGEB , New Delhi.
> INDIA
>
> Phone: 91-9811261804
>        91-11-26173184; 91-11-26189360 #extn 314

--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   -     Université de Sherbrooke:
          http://compcanlit.ca/
          819-569-2064

--- End Message ---
--- Begin Message ---
Hi all

I have a list of products with prices
e.g.

$100
$100.50
(those are examples, they can be anything, not all prices have decimal)

when I add those I get $200.5.

Is there a way to get $200.50.

Thanks

Mario


-----------------------------------------------------
Marios Adamantopoulos
Web Developer
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Hi!

I have a list of products with prices
e.g.

$100
$100.50
(those are examples, they can be anything, not all prices have decimal)

when I add those I get $200.5.

Is there a way to get $200.50.

if it is okay for you to add $100+$100 and get $200.00 you could use printf("$%1.2f",$price1+$price2); or $str=sprintf("$%1.2f",$price1+$price2);

HTH,
Oliver Hankeln

--- End Message ---
--- Begin Message --- Mario wrote:
Hi all

I have a list of products with prices
e.g.

$100
$100.50
(those are examples, they can be anything, not all prices have decimal)

when I add those I get $200.5.

Is there a way to get $200.50.

Thanks

Mario

You want to format the number? Use number_format()


PS: Don't hijack threads.

http://www.google.com/search?q=what+is+%22thread+hijacking%22
--- End Message ---
--- Begin Message ---
I prefer:

round($value,2);

-----Original Message-----
From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 17, 2004 5:10 AM
To: Mario
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] keeping the last zero

Mario wrote:
> Hi all
> 
> I have a list of products with prices
> e.g.
> 
> $100
> $100.50
> (those are examples, they can be anything, not all prices have 
> decimal)
> 
> when I add those I get $200.5.
> 
> Is there a way to get $200.50.
> 
> Thanks
> 
> Mario

You want to format the number? Use number_format()


PS: Don't hijack threads.

http://www.google.com/search?q=what+is+%22thread+hijacking%22

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

--- End Message ---
--- Begin Message --- Please try to endure my ignorance. I'm new to PHP4 and out to perform just a single isolated task with it. :)

I would like to form some simple statistics from specific column data in a mysql database and display those stats on a webpage.

I have collected a few demographics from certain respondents. These are sex, age, and usage of our service (individual/company). The responses are store in a mysql 3 database.

Basically, I would like to show:

total headcounts and percentages for 'male' and 'female' respondents (database column 'sex')

average ages for male/female respondents (database column 'age')

usage percentages for male/female respondents (database column 'usage')


I would very much appreciate if someone could point me to eg. code examples helping me to accomplish this task. Unless someone wants to just give away their utmost expertise and send me working code, which would leave me absolutely speechless from respect and gratefulness. =)

--- End Message ---
--- Begin Message --- hello,
im kinda new to php and new to xslt. im looking at these classes http://phpxmlclasses.sourceforge.net/
and wanted to use the class_xslt. The example shown, works fine for me, but i want to use it getting the xml as a string.
in order that i can generate the xml from my db... i have used the xml to vreate a string but i get this error...
*Warning*: Sablotron error on line 16: XML parser error 7: mismatched tag
has anyone any experience using this class with a string? my sample is posted below...
thanks eoghan


=======================================================================================
<?
include_once("class_xslt.php");

$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
$xml .= "\t<apps>\r\n";
$xml .= "\t\t<application id=\"1\">\r\n";
$xml .= "\t\t\t<name>Editor</name>\r\n";
$xml .= "\t\t\t<author>John</author>\r\n";
$xml .= "\t\t\t<bugs>\r\n";
$xml .= "\t\t\t\t<bug>\r\n";
$xml .= "\t\t\t\t\t<desc>Foo</desc>\r\n";
$xml .= "\t\t\t\t\t\t<sev>2</sev>\r\n";
$xml .= "\t\t\t\t</bug>\r\n";
$xml .= "\t\t\t\t<bug>\r\n";
$xml .= "\t\t\t\t\t<desc>Bar</desc>\r\n";
$xml .= "\t\t\t\t\t\t<sev>3</sev>\r\n";
$xml .= "\t\t\t\t</bug>\r\n";
$xml .= "\t\t\t</bugs>\r\n";
$xml .= "\t</apps>\r\n";

//echo $xml;

$xslt=new Xslt();
$xslt->setXmlString($xml);
$xslt->setXsl("tr1.xsl");
if($xslt->transform()) {
  $ret=$xslt->getOutput();
  echo $ret;
} else {
  print("Error:".$xslt->getError());
}

?>
--- End Message ---
--- Begin Message ---
eoghan,
<snip>
> $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
> $xml .= "\t<apps>\r\n";
> $xml .= "\t\t<application id=\"1\">\r\n";
> $xml .= "\t\t\t<name>Editor</name>\r\n";
> $xml .= "\t\t\t<author>John</author>\r\n";
> $xml .= "\t\t\t<bugs>\r\n";
> $xml .= "\t\t\t\t<bug>\r\n";
> $xml .= "\t\t\t\t\t<desc>Foo</desc>\r\n";
> $xml .= "\t\t\t\t\t\t<sev>2</sev>\r\n";
> $xml .= "\t\t\t\t</bug>\r\n";
> $xml .= "\t\t\t\t<bug>\r\n";
> $xml .= "\t\t\t\t\t<desc>Bar</desc>\r\n";
> $xml .= "\t\t\t\t\t\t<sev>3</sev>\r\n";
> $xml .= "\t\t\t\t</bug>\r\n";
> $xml .= "\t\t\t</bugs>\r\n";
> $xml .= "\t</apps>\r\n";
</snip>

Basically the only problem I can see is you don't have an ending application 
tag.
-- 
Thank You,

Clifford W. Hansen
Operations Support Developer
Aspivia (Pty) Ltd.

+27 (0) 11 259-1150 (Switchboard)
+27 (0) 11 259-1019 (Fax)
+27 (0) 83 761-0240 (Mobile)
[EMAIL PROTECTED] (EMail)
http://chansen.aspivia.com (Web)

"We have seen strange things today!" Luke 5:26

This message contains information intended for the perusal, and/or use (if so 
stated), of the stated addressee(s) only. The information is confidential and 
privileged. If you are not an intended recipient, do not peruse, use, 
disseminate, distribute, copy or in any manner rely upon the information 
contained in this message (directly or indirectly). The sender and/or the 
entity represented by the sender shall not be held accountable in the event 
that this prohibition is disregarded.

If you receive this message in error, notify the sender immediately by e-mail, 
fax or telephone and return and/or destroy the original message.

The views or representations contained in this message, whether express or 
implied, are those of the sender only, unless that sender expressly states 
them to be the views or representations of an entity or person, who shall be 
named by the sender and who the sender shall state to represent. No liability 
shall otherwise attach to any other entity or person.

--- End Message ---
--- Begin Message ---
http://developers.slashdot.org/article.pl?sid=04/05/16/1631212&mode=thread&tid=126&tid=169&tid=172

Kind Regards
Brent Clark

--- End Message ---

Reply via email to