Re: Mysql Variable Displayed in php
| From: | Delz | Date: | Tue, 13 May 2003 01:58:04 +0000 |
| Subject: | Re: Mysql Variable Displayed in php | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27686@lists.php.net to get a copy of this message | ||
Thanks Jennifer i'll try this one.
Regards,
Delz
----- Original Message -----
From: "Jennifer Goodie" <goodie@apollointeractive.com>
To: "Delz" <phpuser@modeglobal.com>; <php-db@lists.php.net>
Sent: Tuesday, May 13, 2003 1:54 AM
Subject: RE: [PHP-DB] Mysql Variable Displayed in php
> while ($row = mysql_fetch_row($result)) { // Begin while
> echo($row[0]); //this is one way
> echo($row['overall']); //this is another way
> } // end while
>
>
> > -----Original Message-----
> > From: Delz [mailto:phpuser@modeglobal.com]
> > Sent: Friday, May 09, 2003 8:38 PM
> > To: php-db@lists.php.net
> > Subject: [PHP-DB] Mysql Variable Displayed in php
> >
> >
> > RE: [PHP-DB] mysql variable displayed in phpHi All,
> >
> > I have this following script in php connecting to a mysql
> > database and declared a variable named "overall" in the mysql statement:
> > How do I display the result in php generated by the mysql
> > variable "overall" so I can display it in my browser. I'm new to
> > php & can't
> > seem to output the result. Any help will be appreciated.
> >
> > ############################################################
> > <?
> >
> > $connection = mysql_connect("myhost","myuser","mypasswd");
> > if (!$connection) {
> > echo "Could not make a connection!";
> > exit;
> > }
> >
> > $db = mysql_select_db("mydb",$connection);
> >
> > if (!$db) {
> > echo "Could not select database!";
> > exit;
> > }
> >
> >
> > $query = "select @overalltotal :=SUM(total) as overall FROM mytable";
> > $result = mysql_db_query("mydb", $query);
> >
> > if ($result)
> > {
> >
> >
> > while ($row = mysql_fetch_row($result)) { // Begin while
> >
> >
> > } // end while
> >
> >
> > } else { echo "problems...."; }
> > mysql_close();
> >
> > ?>
>
>
>