PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hello
I am new in php and i want to ask you something
I want to create a script that the admin will choose a date e.x 12 December 2005
and click sumbit and show him the result only for 12 december 2005
I have created the arrays for day month and year and i want now someone to help me how i can add the things that i told you before.
i have uploaded the script at http://www.greekfrape.com/mod_report.php
This is the code that i have written :
?><html>
<head>
<title></title>
</head>
<body>
<?php
/* Program name: report.php
* Description: Program displays a selection list that
* customers can use to select a date.
*/
$link = mysql_connect("mysql_host", "mysql_login", "mysql_password")
or die ("Could not connect to MySQL");
mysql_select_db ("my_database")
or die ("Could not select database");
echo "<html>
<head><title>Select a date</title></head>
<body>";
/* create an array of months*/
$monthName = array(1=> "January", "February", "March",
"April", "May", "June", "July",
"August", "September", "October",
"November", "December");
$today = time(); //stores today's date
$f_today = date("M-d-Y",$today); //formats today's date
echo "<div align='center'>\n";
/* display today's date */
echo "<p> <h3>Today is $f_today</h3><hr>\n";
/* create form containing date selection list */
echo "<form action='processform.php' method='POST'>\n";
/* build selection list for the month */
$todayMO = date("m",$today); //get the month from $today
echo "<select name='dateMO'>\n";
for ($n=1;$n<=12;$n++)
{
echo "<option value=$n\n";
if ($todayMO == $n)
{
echo " selected";
}
echo "> $monthName[$n]\n";
}
echo "</select>";
/* build selection list for the day */
$todayDay= date("d",$today); //get the day from $today
echo "<select name='dateDay'>\n";
for ($n=1;$n<=31;$n++)
{
echo " <option value=$n";
if ($todayDay == $n )
{
echo " selected";
}
echo "> $n\n";
}
echo "</select>\n";
/* build selection list for the year */
$startYr = date("Y", $today); //get the year from $today
echo "<select name='dateYr'>\n";
for ($n=$startYr;$n<=$startYr+1;$n++)
{
echo " <option value=$n";
if ($startYr == $n )
{
echo " selected";
}
echo "> $n\n";
}
echo "</select>\n";
echo "</form>\n";
?>
</body>
</html>
$sql = "SELECT * FROM mytable WHERE date='".$_POST[year].$_POST[month].$_POST[day]."'";
$res = mysql_query($sql);
while( $all =mysql_fetch_row($sql)){
echo $all[col1]." -- ".$all[col2]; // just edit to your needs: numbers of cols and the fieldnames
}
Look i ll be more specific
I am using joomla and i have added the comport virua mart(online shop)
I want someone to tell me the code that i would select a specific day and will export me the result for example the total orders of the day........
The strange is that i look the database and i saw that the date is Integer!!!
And also to have two options : One to view the results and second to download it in txt