Page 1 of 1

How to print php result from query without table?

Posted: Mon Jul 14, 2008 7:43 am
by kdao
<?php


$user='kdao';
$pass='khaidao';
$host='localhost';
$db='kdao';
$table='guessbook';

$conn = mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($db,$conn);

$query_1 = "select concat('There are ',to_days('2008-10-15') - to_days(current_date()),' left to the special holiday .');
$result_1 = mysql_query($query_1);

print "Hello world";

mysql_close($conn);
?>

Re: How to print php result from query without table?

Posted: Wed Jul 16, 2008 7:24 am
by parimala
hi kdao

you had written every thing correctly but the minor mistake is you forgot to keep the " quotation at the end of the statement.

The proper format is
$query_1 = "select concat('There are ',to_days('2008-10-15') - to_days(current_date()),' left to the special holiday .')";
$result_1 = mysql_query($query_1);
echo mysql_result($result_1,0,0);

you will get the result without a table;

thanks and regards
parimala