make html tables after getting the query!
Posted: Wed Mar 11, 2009 1:13 pm
dear all,
i am newbie in php. i got some code written in php and its working fine but i dont know the logic of having html headings and the results of my sql query!
here is the code:
i am newbie in php. i got some code written in php and its working fine but i dont know the logic of having html headings and the results of my sql query!
here is the code:
instead of the messages that is colored i need to have the results in html table. i will appreciate all the help and thanks guys alot.
<?php
$host="11111.com";
$db_name="mydb";
$username="mydb";
$password="2008";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$theday=date("d") + 1;
$themonth=date("n");
$theyear=date("Y");
$nameday = date("l");
$sql= "SELECT * FROM calendar_events WHERE day='$theday' and month='$themonth' and year='$theyear' and approved=1" or die(mysql_error());
$result = mysql_query($sql) or die('Query failed. ' . mysql_error());
if (mysql_num_rows($result) > 0) {
echo "there are some records!";
}
else {
echo "there are no events for $nameday $theday/$themonth/$theyear" ;
}?>