Results from Db outputted twice
Posted on
16th Feb 2014 07:03 pm by
admin
Hey guys.. for come reason my data is outputted twise shown in the image below and i cant figure out why.
Code: [Select]<html>
<head>
<title>Month Summary</title>
<!-- change styles if you want -->
<style type="text/css">
p {font-family: georgia, verdana, sans-serif; font-size: 13px; color: #333333; }
h1 {font-family: georgia, verdana, sans-serif; font-size: 16px; color: #26618e; }
body {background-color: #fcfcfc;}
</style>
</head>
<body>
<br/>
<?php
// THERE IS NO NEED TO EDIT BELOW HERE
$mon = $_GET['mon']; // month from clicked month name
$month = intval($mon); // var to use with month name array
if (strlen($mon)==1) { $mon = "0". $mon; }
$yr = $_GET['yr']; // year from clicked month name
include("cal_parms.php");
include("./lang/dat_nam_en.php"); // load default language file so as not to mess anything upp with new text.
include($dat_names); // retrieved from cal_parms.php as a 'language' file
include("cal_db_conn.php");
mysql_connect($db_host, $db_login, $db_pass) or die ("Can't connect!");
mysql_select_db($db_name) or die ("Can't open database!");
$min_dat = $yr. "-". $mon. "-01";
$max_dat = $yr. "-". $mon. "-31"; //sloppy but effective
// retrieve all events for the month
$query = "SELECT * from $db_table WHERE (ev_dat>='$min_dat') AND (ev_dat<='$max_dat') ORDER by ev_dat";
$result = @mysql_db_query($db_name, $query);
echo "<table width='480' cellpadding='3' cellspacing='3' align='center' style='border: thin dotted #999999;' bgcolor='#f7f7f7'><tr><td>";
while ($myrow = mysql_fetch_array($result)) // loop through all results
{
$found = $myrow['ev_dat'];
$pieces = explode("-", $found);
$monum = intval($pieces[1]);
$danum = intval($pieces[2]);
echo "<h1>". $danum. " ". $mo[$month]. ", ". $yr. "</h1>";
echo "<p><strong>". $EventText. ": ". $myrow['ev_title']. "</strong><br/>";
echo $LocationText. ": ". $myrow['ev_locn']. "<br/>";
echo $DetailsText. "<br/>". nl2br($myrow['ev_desc']). "</p>";
$i++;
}
if ($i==0) { echo "<h1>".$noEventsText." ". $mo[$month]. "</h1>"; }
if ($sho == "1") {
echo "<p align='right'><a href='javascript:self.close()'>".$closewindowText ."</a>";
}
else {
echo "<p align='right'>« <a href='javascript:history.go(-1)'>".$backToCalendar."</a></p>";
}
?>
</td></tr></table>
</html>
</body>
hopefully someone can see the reason why
Thanks
312
42
Other php-forum
Problem assigning value to variable in "IF" function
Does this script makes sense? I am trying to take the value that is set to "authenticat" a
explode() function problem maybe
Hi I'm having trouble searching my database. When I type two words in the search field it only searc
Email to a friend script problems
I have this send-to-a-friend script with 2 issues:
1) When you open the form popup on a p
How to separate records and ORDER BY
Let say i have 100 records and displayed in one page, then i want to get the records from 50-100 and
for some reason mysql query not working, not inserting, please check it out
This code is not inserting anything into my db, don't know why, the $_SESSION variable does contain
php ajax - two drop down list with a submit button
i have created a form with 2 drop-down list and a submit button. I would like to know how to pass th
DirectoryIterator and Hacked Website
Hi Everyone.
My problem:
Some one has been sneaking in to my website hidden Iframes. I've
What are causes of a connection-timeout with fopen()?
Hello! Here is the situation: The server I host my website on just upgraded it's PHP build from 4.4.
Multi Dimensional Array Append
Hi Guys
I have a function that returns a multidimentional array eg
$result = functio
Php WordPress help
I am writing the following code for making a plugin
<?php
header("Content-Type