Page 1 of 1

what is missing of this code? how to get result_1 print?

Posted: Mon Jul 14, 2008 11:52 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 $result_1 ; // should it work?

print "Hello world";

mysql_close($conn);
?>

Re: what is missing of this code? how to get result_1 print?

Posted: Mon Jul 14, 2008 1:17 pm
by WebbieDave

Re: what is missing of this code? how to get result_1 print?

Posted: Tue Jul 15, 2008 1:12 am
by sureshmaharana
Try this one:
<?
$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 .') as result";
$result_1 = mysql_query($query_1);
$row = mysql_fetch_array($result_1);
print $row['result'];

mysql_close($conn);
?>

Re: what is missing of this code? how to get result_1 print?

Posted: Tue Jul 15, 2008 6:53 am
by kdao
Thanks everyone.
It works !

:)