Php function call in html stops loading footer

Hi All,

I am a newbie to php and I have this issue. I would appreciate if anyone can help out. I tried a few things but was not able to come up with a solution.

From reading few codes and learning from it, I created this function in query.php and am calling this function in uk.php file, but the problem is that it loads and shows the data in table, but then it stops loading page from there on and the footer which is in html code after the place where I am calling this function does not load.

I tried removing return false; command, but with that it loads the footer, but it shows the table after the footer.

I want the table with data to show in between header and footer.

Can you guys let me know what I need to do to achieve that?

File Name: query.php

function uk()
{
	$output = '';
	$result = db_query("SELECT * FROM lecture where groups='uk'");

	if(mysqli_num_rows($result) > 0)
	{
		$output .= '<div id="style2" style="overflow-x:auto;">
						<table>
							<tr>
								<th class="text-center">Date</th>
								<th class="text-center">Title</th>
								<th class="text-center">Venue</th>
								<th class="text-center">Duration</th>
								<th class="text-center">Size (MB)</th>
								<th class="text-center">Link</th>
							</tr>';
		while($row = mysqli_fetch_array($result))
		{
			$output .= '
				<tr>
					<td>'.$row["mydate"].'</td>
					<td>'.$row["title"].'</td>
					<td>'.$row["venue"].'</td>
					<td>'.$row["duration"].'</td>
					<td>'.$row["size"].'</td>
					<td><a href="../'.$row["path"].$row["file_name"].'">Save</a></td>
				</tr>
			';
		}
		echo $output;
	}
	else
	{
		echo 'Data Not Found';
	}
}

File Name: uk.php

Header html here

<?php
include '../includes/query.php';
uk();
return false;
?>

Footer html here

Where is your closing </table> tag?

Thanks a lot man… yes that was it :). That fixed it. For some reason my my mind never thought of that.

https://validator.w3.org/

And a good code editor might help as well. (Like PhpStorm (paid) or Netbeans)

Also intend your code the right way

Sponsor our Newsletter | Privacy Policy | Terms of Service