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. ":&nbsp;". $myrow['ev_title']. "</strong><br/>";
echo $LocationText. ": &nbsp;". $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'>&laquo;&nbsp;<a href='javascript:history.go(-1)'>".$backToCalendar."</a></p>";
}
?>
</td></tr></table>
</html>
</body>
hopefully someone can see the reason why

Thanks

No comments posted yet

Your Answer:

Login to answer
312 Like 42 Dislike
Previous forums Next forums
Other forums

How can i steam a video on my PHP site? (non YouTube)
Basically I have a PHP site and don't want to give page rank to YouTube. I just want to stream a bas

PO Release Strategy Issue
Hi Experts,

I am facing an issue related to PO release strategy. The details are-
<

IIS7 and getimagesize() problem
I have just discovered after hrs of trying to fix a problem where it's coming from. It's to do with

Question about ShowWindow()
Hello....

I'm struggling with sumpin, and I hope y'all can help.

I've got a CFormView

$_GET problem
Hi all,

Have a bit of a problem with a little piece of code, I am not sure if this should be

path to include folder
Hi everyone,

When I'm testing locally, I have to add the name of the site folder as part of t

building a function with multiple outputs
I want to build a function that has multiple outputs.

I know but am not to sure how I should

Multi dimensional arrays
If I put in this code:

1
2
3
4
5
6
7
8
9
10
11
12
13<

php mysql script to find record
Hi,

Currently I have a simple table with 4 columns. A, B, C, D

If I want to find all

1,000 select boxes with 100 options?!
I have 1 drop down select box with 1,000 options.


In some case, there will be 100+ of the

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash