Mysql Variable Displayed in php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



RE:  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();

?>

############################################################

Delz


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux