Form submission help and other question

I don’t know if this is the only error, but you misspelled $username

$getRank = $db->query(“SELECT * FROM users WHERE username = '”.$_SESSION[‘username’].“'”);
while ($row = $getRank->fetch_assoc())
{
$usename = $row[‘username’];
$rank = $row[‘rank’];
}

Oh thank you, I didn’t catch that at all, the e and n looked like an r together.

I did mention that on post #15 I also didn’t mean to sound rude, but you kept saying you have fixed the issues that are mentioned but wouldn’t post latest code version.
Is it working now?

Note: OR really should be || in an IF statement. See Logical Operators. User input should be escaped.

$c_name = mysqli_real_escape_string ($db, $c_name);

Its fine haha, understandable, this is very frustrating, just want this fixed. I also still need to do that table I mentioned in the OP and fix other bugs I have with other forms like the profile update form so i’m getting very frustrated with all of this.

So you’ve fixed all errors…
usename = username
channel_name = channel_username
Duplicate empty($v_title)
Changed OR to ||

Established the $db is resource
Escaped all data before insert into database
Checked that all database field names match.

Then I would suggest adding mysqli_error($db) to your query.

$sql ="INSERT INTO submitted_forms (`username`,`rank`,`channel_username`,`video_link`,`video_title`,`video_description`,`video_tags`,`music_sources`,`special_requests`) VALUES ('$username','$rank','$c_name','$v_link','$v_title','$v_desc','$v_tags','$m_sources','$s_requests')";
echo $sql;
$db->query($sql) or die(mysqli_error($db));

EDIT: echo $sql; //added

I still have this error “Call to a member function query() on a non-object on line 37” And its this

$getRank = $db->query("SELECT * FROM users WHERE username = '".$_SESSION['username']."'");
        while ($row = $getRank->fetch_assoc())

And how about with this.

$username = mysqli_real_escape_string ($db, $_SESSION['username']);
$query = "SELECT rank FROM users WHERE username = '$username'";
$getRank = $db->query($query) or die(mysqli_error($db));
while ($row = $getRank->fetch_assoc())
{	
	$rank = $row['rank'];
}

And you shouldn’t need a WHILE loop here.

$username = mysqli_real_escape_string ($db, $_SESSION['username']);
$query = "SELECT rank FROM users WHERE username = '$username'";
$getRank = $db->query($query) or die(mysqli_error($db));
$row = $getRank->fetch_assoc();
    $rank = $row['rank'];

Looking back on POST #18 I’m not sure I like the format of the top section.

<?php 
session_start();

if(isset($_SESSION['rank']) && $_SESSION['rank'] == "partner"){}else{
	header("location: ../index.php");
	exit;
}
include "menu.php";
include "header.php";
?>

Can I assume your connection is in menu.php or header.php?

Anyway, I don’t like how you’ve got $_SESSION[‘username’]; just sitting there, using header(“location:”) without exit; and using “AND” instead of &&.

Also, it does seems a bit odd that you are saying here that $_SESSION[‘rank’] MUST be set and that the value must be partner and then you go and query the DB to get the username and rank, when both these values must already be set to session.

Ok, to be honest. I didn’t really do to much of this code and don’t know much about it. Someone did most of it so i’m trying to fix the errors they’ve done and finish everything else I need. I really appreciate your help and i’ll see if your codes in the above posts work because this is really stressful haha, but thank you for all the help you’ve been giving me.

Also, the connection is in the config file, but I took it out by accident when I pasted it, don’t know why.

I will try one more time with this version. I’m still questioning that $db is set and your session values. I’ve tested this with both types of connections below.

<?php
$host = "localhost";
//Database user name.	
$login = "";
//Database Password.
$dbpass = "";
//Database name.
$dbname = "";
$db = mysqli_connect("$host", "$login", "$dbpass", "$dbname");
?>

AND

<?php
$host = "localhost";
//Database user name.	
$login = "";
//Database Password.
$dbpass = "";
//Database name.
$dbname = "";
$db = new mysqli("$host", "$login", "$dbpass", "$dbname");
?>

And the page with an extra check for $_SESSION[‘username’] before query as I’ve still not heard from you that you are sure these session values are set. I’ve left the query for rank in the script as the top condition is now looking for a rank of partner or admin.

&lt;?php
session_start();
include ("config.php");

if(isset($_SESSION['rank']) && ($_SESSION['rank'] == "partner" || $_SESSION['rank'] == "admin")){}else{
	header("location: ../index.php");
	exit;
}
include ("menu.php");
include ("header.php");

	if(isset($_POST['submit']))
	{
		$c_name     = trim($_POST['channel_name']);
		$v_link     = trim($_POST['video_link']);
		$v_title    = trim($_POST['video_title']);
		$v_desc     = trim($_POST['video_description']);
		$v_tags     = trim($_POST['video_tags']);
		$m_sources  = trim($_POST['music_sources']);
		$s_requests = trim($_POST['special_requests']);
		
		if(empty($c_name) || empty($v_link) || empty($v_title) || empty($v_desc) || empty($v_tags))
		{
			echo 'You must fill in the first 5 fields.';
		}
		else
		{
			if(!isset($_SESSION['username'])){
				echo 'Session is not set';
			}else{			
				$username = mysqli_real_escape_string ($db, $_SESSION['username']);
				$query = "SELECT rank FROM users WHERE username = '$username'";
				$getRank = $db-&gt;query($query) or die(mysqli_error($db));
				$row = $getRank-&gt;fetch_assoc();
				$rank = $row['rank'];
	
				
				$rank = mysqli_real_escape_string ($db, $rank);
				$c_name = mysqli_real_escape_string ($db, $c_name);
				$v_link = mysqli_real_escape_string ($db, $v_link);
				$v_title = mysqli_real_escape_string ($db, $v_title);
				$v_desc = mysqli_real_escape_string ($db, $v_desc);
				$v_tags = mysqli_real_escape_string ($db, $v_tags);
				$m_sources = mysqli_real_escape_string ($db, $m_sources);
				$s_requests = mysqli_real_escape_string ($db, $s_requests);
				
				$sql ="INSERT INTO submitted_forms (`username`,`rank`,`channel_username`,`video_link`,`video_title`,`video_description`,`video_tags`,`music_sources`,`special_requests`) VALUES ('$username','$rank','$c_name','$v_link','$v_title','$v_desc','$v_tags','$m_sources','$s_requests')";
				//echo $sql;
				$db-&gt;query($sql) or die(mysqli_error($db));
				echo 'Form submitted successfully.';
			}
		}
	}
?&gt;

&lt;form action="" method="post"&gt;
      &lt;p&gt;Channel name &lt;input type="text" name="channel_name" required&gt;*&lt;/p&gt;
      &lt;p&gt;Video Link   &lt;input type="text" name="video_link" required&gt;*&lt;/p&gt;
      &lt;p&gt;Video Title  &lt;input type="text" name="video_title" required&gt;*&lt;/p&gt;
      &lt;p&gt;Video Description &lt;input type="text" name="video_description" required&gt;*&lt;/p&gt;
      &lt;p&gt;Video Tags   &lt;input type="text" name="video_tags" required&gt;*&lt;/p&gt;
      &lt;p&gt;Music Sources &lt;input type="text" name="music_sources"&gt;&lt;/p&gt;
      &lt;p&gt;Special Requests &lt;input type="text" name="special_requests"&gt;&lt;/p&gt;
      &lt;br&gt;&lt;/br&gt;
      &lt;p&gt;&lt;input type="submit" name="submit" value="Submit"&gt;&lt;/p&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Finally!!! Thank you so much, it finally worked! Now, do you know how I would do the table I was talking about in the OP?

Are you referring to Status as in video online or offline? If that’s the case, you can just add a field to submitted_forms named status (int) and update the record as needed e.g. (0,1) where online would be 1.

No like, I know what to do for the status and everything, but how would I do the table? Like how would I just pull that users submissions and no one elses? I want there own submissions to be displayed in a table for them to see.

Very rough…

Admin

&lt;?php
session_start();
include ("config.php");

if(isset($_SESSION['rank']) && ($_SESSION['rank'] == "partner" || $_SESSION['rank'] == "admin")){}else{
	header("location: ../index.php");
	exit;
}
//Show all or single id
if(isset($_GET['id'])){
	$id = mysqli_real_escape_string ($db, $_GET['id']);
	$condition = "WHERE u.user_id = '$id'";
}else{ 
	$condition = "ORDER BY u.name ASC";
}
$sql = "SELECT 
`sf`.`id`,
`u`.`name`,
`sf`.`rank`,
`sf`.`channel_username`,
`sf`.`video_link`,
`sf`.`video_title`,
`sf`.`video_description`,
`sf`.`video_tags`,
`sf`.`music_sources`,
`sf`.`special_requests`
FROM `users` AS u 
LEFT JOIN `submitted_forms` AS sf
ON sf.username = u.username 
$condition";
$result = $db-&gt;query($sql) or die(mysqli_error($db));
?&gt;
&lt;?xml version="1.0" encoding="windows-1252"?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;style type="text/css"&gt;
.display {
  width:100%;
  background-color:#E5E5E5;
  color:#000000;  
  font-family: Arial;
  font-size: 13px;
}
.display th{
  background-color:#84848E;
  color:#FFF;
  font-size: 12px;
  font-weight:bold;
  text-align:center;
}
.display td{
  background-color:#FFF;
  color:#00000;
  font-weight:normal;
}
.display .head td{
  background-color:#B1B1BE;
  color:#00000;
  font-weight:bold;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table border=0 summary="" cellspacing="1" cellpadding="1" class="display"&gt;
&lt;?php
$headrows = array();
while ($row = $result-&gt;fetch_assoc()){
	if(!in_array($row['name'],$headrows)){
		echo '&lt;tr&gt;
				&lt;th colspan="6"&gt;'.$row['name'].' (Rank: '.$row['rank'].')&lt;/th&gt;
			&lt;/tr&gt;
			&lt;tr class="head"&gt;
				&lt;td&gt;Channel Name&lt;/td&gt;
				&lt;td&gt;Title&lt;/td&gt;
				&lt;td&gt;Description&lt;/td&gt;
				&lt;td&gt;Video Tags&lt;/td&gt;
				&lt;td&gt;Music Sources&lt;/td&gt;
				&lt;td&gt;Special Requests&lt;/td&gt;
			&lt;/tr&gt;'; 		
		$headrows[] = $row['name'];
	}
		
	echo '&lt;tr&gt;
			&lt;td&gt;'.$row['channel_username'].'&lt;/td&gt;
			&lt;td&gt;&lt;a href="'.$row['video_link'].'"&gt;'.$row['video_title'].'&lt;/a&gt;&lt;/td&gt;
			&lt;td&gt;'.$row['video_description'].'&lt;/td&gt;
			&lt;td&gt;'.$row['video_tags'].'&lt;/td&gt;
			&lt;td&gt;'.$row['music_sources'].'&lt;/td&gt;
			&lt;td&gt;'.$row['special_requests'].'&lt;/td&gt;
		&lt;/tr&gt;';
}
?&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;

Logged in user

&lt;?php
session_start();
include ("config.php");

if(isset($_SESSION['username'])){}else{
	header("location: ../index.php");
	exit;
}

$username = mysqli_real_escape_string ($db, $_SESSION['username']); 
$sql = "SELECT 
`sf`.`id`,
`u`.`name`,
`sf`.`rank`,
`sf`.`channel_username`,
`sf`.`video_link`,
`sf`.`video_title`,
`sf`.`video_description`,
`sf`.`video_tags`,
`sf`.`music_sources`,
`sf`.`special_requests`
FROM `users` AS u 
LEFT JOIN `submitted_forms` AS sf
ON sf.username = u.username 
WHERE u.username = '$username'";
$result = $db-&gt;query($sql) or die(mysqli_error($db));
?&gt;
&lt;?xml version="1.0" encoding="windows-1252"?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;style type="text/css"&gt;
.display {
  width:100%;
  background-color:#E5E5E5;
  color:#000000;  
  font-family: Arial;
  font-size: 13px;
}
.display th{
  background-color:#84848E;
  color:#FFF;
  font-size: 12px;
  font-weight:bold;
  text-align:center;
}
.display td{
  background-color:#FFF;
  color:#00000;
  font-weight:normal;
}  
.display .head td{
  background-color:#B1B1BE;
  color:#00000;
  font-weight:bold;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table border=0 summary="" cellspacing="1" cellpadding="1" class="display"&gt;
&lt;?php
$headrows = array();
while ($row = $result-&gt;fetch_assoc()){
	if(!in_array($row['name'],$headrows)){
		echo '&lt;tr&gt;
				&lt;th colspan="6"&gt;'.$row['name'].' (Rank: '.$row['rank'].')&lt;/th&gt;
			&lt;/tr&gt;
			&lt;tr class="head"&gt;
				&lt;td&gt;Channel Name&lt;/td&gt;
				&lt;td&gt;Title&lt;/td&gt;
				&lt;td&gt;Description&lt;/td&gt;
				&lt;td&gt;Video Tags&lt;/td&gt;
				&lt;td&gt;Music Sources&lt;/td&gt;
				&lt;td&gt;Special Requests&lt;/td&gt;
			&lt;/tr&gt;'; 		
		$headrows[] = $row['name'];
	}
		
	echo '&lt;tr&gt;
			&lt;td&gt;'.$row['channel_username'].'&lt;/td&gt;
			&lt;td&gt;&lt;a href="'.$row['video_link'].'"&gt;'.$row['video_title'].'&lt;/a&gt;&lt;/td&gt;
			&lt;td&gt;'.$row['video_description'].'&lt;/td&gt;
			&lt;td&gt;'.$row['video_tags'].'&lt;/td&gt;
			&lt;td&gt;'.$row['music_sources'].'&lt;/td&gt;
			&lt;td&gt;'.$row['special_requests'].'&lt;/td&gt;
		&lt;/tr&gt;';
}
?&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;

This version of “Admin” turns username into a link to show just records by this user. Be sure to edit the page name variable line 5.

&lt;?php
session_start();
include ("config.php");
// page name
$pagename = "mypage.php";

if(isset($_SESSION['rank']) && ($_SESSION['rank'] == "partner" || $_SESSION['rank'] == "admin")){}else{
	header("location: ../index.php");
	exit;
}
//Show all or single id
if(isset($_GET['id'])){
	$id = mysqli_real_escape_string ($db, $_GET['id']);
	$condition = "WHERE u.user_id = '$id'";
}else{
	$condition = "ORDER BY u.name ASC";
}
$sql = "SELECT
`sf`.`id`,
`u`.`user_id`,
`u`.`name`,
`sf`.`rank`,
`sf`.`channel_username`,
`sf`.`video_link`,
`sf`.`video_title`,
`sf`.`video_description`,
`sf`.`video_tags`,
`sf`.`music_sources`,
`sf`.`special_requests`
FROM `users` AS u
LEFT JOIN `submitted_forms` AS sf
ON sf.username = u.username
$condition";
$result = $db-&gt;query($sql) or die(mysqli_error($db));
?&gt;
&lt;?xml version="1.0" encoding="windows-1252"?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;style type="text/css"&gt;
.display {
  width:100%;
  background-color:#E5E5E5;
  color:#000000;
  font-family: Arial;
  font-size: 13px;
}
.display th{
  background-color:#84848E;
  color:#FFF;
  font-size: 12px;
  font-weight:bold;
  text-align:center;
}
.display th i{
  font-weight:normal;
  font-style:normal;
}
.display td{
  background-color:#FFF;
  color:#000000;
  font-weight:normal;
}
.display .head td{
  background-color:#B1B1BE;
  color:#00000;
  font-weight:bold;
}
.display th a:link{
  padding: 0 8px;
  color:#FFF;
  text-decoration:none;
}
.display th a:hover{
  text-decoration:underline;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table border=0 summary="" cellspacing="1" cellpadding="1" class="display"&gt;
&lt;?php
$headrows = array();
while ($row = $result-&gt;fetch_assoc()){
	if(!in_array($row['name'],$headrows)){
		echo '&lt;tr&gt;
				&lt;th colspan="6"&gt;&lt;a href="'.$pagename.'?id='.$row['user_id'].'"&gt;'.$row['name'].'&lt;/a&gt;&lt;i&gt;(Rank: '.$row['rank'].')&lt;/i&gt;&lt;a href="'.$pagename.'"&gt;Show All&lt;/a&gt;&lt;/th&gt;
			&lt;/tr&gt;
			&lt;tr class="head"&gt;
				&lt;td&gt;Channel Name&lt;/td&gt;
				&lt;td&gt;Title&lt;/td&gt;
				&lt;td&gt;Description&lt;/td&gt;
				&lt;td&gt;Video Tags&lt;/td&gt;
				&lt;td&gt;Music Sources&lt;/td&gt;
				&lt;td&gt;Special Requests&lt;/td&gt;
			&lt;/tr&gt;'; 		
		$headrows[] = $row['name'];
	}
		
	echo '&lt;tr&gt;
			&lt;td&gt;'.$row['channel_username'].'&lt;/td&gt;
			&lt;td&gt;&lt;a href="'.$row['video_link'].'"&gt;'.$row['video_title'].'&lt;/a&gt;&lt;/td&gt;
			&lt;td&gt;'.$row['video_description'].'&lt;/td&gt;
			&lt;td&gt;'.$row['video_tags'].'&lt;/td&gt;
			&lt;td&gt;'.$row['music_sources'].'&lt;/td&gt;
			&lt;td&gt;'.$row['special_requests'].'&lt;/td&gt;
		&lt;/tr&gt;';
}
?&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;

Hmm thank you! Does this show like for that specific user. Like so in the partner dashboard I want it to display there submissions, but anyway you get it. Thank you for all your help, I really appreciate it! I’ll post back and tell you if it worked!

You would use the “Logged in user” style code from above to only show records based $_SESSION[‘username’].

It works thank you! Do you know how to do pagination? I cannot get it to work and I don’t want all there submissions on the same page.

There are many ways to paginate. I prefer to query one time building a data set then show the part being requested. Something like this.

&lt;?php
session_start();
include ("config.php");

if(isset($_SESSION['username'])){}else{
	header("location: ../index.php");
	exit;
}

$username = mysqli_real_escape_string ($db, $_SESSION['username']);

/////////////////////////////////////////
//////// Define records per page ////////
$records_per_page=5;

/////////////////////////////////////////
// Query and build record set as $rows //
$rows = array();
$sql = "SELECT 
`sf`.`id`,
`u`.`name`,
`sf`.`rank`,
`sf`.`channel_username`,
`sf`.`video_link`,
`sf`.`video_title`,
`sf`.`video_description`,
`sf`.`video_tags`,
`sf`.`music_sources`,
`sf`.`special_requests`
FROM `users` AS u 
LEFT JOIN `submitted_forms` AS sf
ON sf.username = u.username 
WHERE u.username = '$username'";
$result = $db-&gt;query($sql) or die(mysqli_error($db));
while ($row = $result-&gt;fetch_assoc()){
	$rows[] = $row;
}
									   
//////////////////////////////////////////
// $page defined as $_GET['page'] or 1 //
$page = (isset($_GET['page']) ? (int)$_GET['page'] : 1);
 		   
/////////////////////////////////////////
//////////// Total Records //////////////
$total = count($rows);
 			   
/////////////////////////////////////////
//////////////Total Pages ///////////////
$pages = ceil($total / $records_per_page);
				
/*/////////////////////////////////////// 
Our $rows array starts with KEY 0, so adjust 
offset of $page - 1	times records per page 
*////////////////////////////////////////
$offset = ($page - 1)  * $records_per_page;
							
/////////////////////////////////////////
// Add 1 to offset for showing to user // 
$start = $offset + 1;
										
/////////////////////////////////////////
////// Get last record being shown //////
$end = min(($offset + $records_per_page), $total);
				
/////////////////////////////////////////
/////////// Previous link ///////////////
$prevlink = ($page &gt; 1) ? "&lt;a href=\\"?page=1\\" title=\\"First page\\"&gt;&laquo;&lt;/a&gt; &lt;a href=\\"?page=" . ($page - 1) . "\\" title=\\"Previous page\\"&gt;&lsaquo;&lt;/a&gt;" : "&lt;span class=\\"disabled\\"&gt;&laquo;&lt;/span&gt; &lt;span class=\\"disabled\\"&gt;&lsaquo;&lt;/span&gt;";
			
/////////////////////////////////////////
///////////// Next link ///////////////// 
$nextlink = ($page &lt; $pages) ? "&lt;a href=\\"?page=" . ($page + 1) . "\\" title=\\"Next page\\"&gt;&rsaquo;&lt;/a&gt; &lt;a href=\\"?page=" . $pages . "\\" title=\\"Last page\\"&gt;&raquo;&lt;/a&gt;" : "&lt;span class=\\"disabled\\"&gt;&rsaquo;&lt;/span&gt; &lt;span class=\\"disabled\\"&gt;&raquo;&lt;/span&gt;";
					
/////////////////////////////////////////
//////// Paging information /////////////
$paginate = "&lt;div class=\\"paging\\"&gt;" . $prevlink . " Page " . $page . " of " . $pages . " pages, displaying " . $start . "-" . $end . " of " . $total . " results " . $nextlink . " &lt;/div&gt;";

?&gt;
&lt;?xml version="1.0" encoding="windows-1252"?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;style type="text/css"&gt;
.display {
  width:100%;
  background-color:#E5E5E5;
  color:#000000;  
  font-family: Arial;
  font-size: 13px;
}
.display th{
  background-color:#84848E;
  color:#FFF;
  font-size: 12px;
  font-weight:bold;
  text-align:center;
}
.display td{
  background-color:#FFF;
  color:#00000;
  font-weight:normal;
}  
.display .head td{
  background-color:#B1B1BE;
  color:#00000;
  font-weight:bold;
}
.paging {
  width:500px;
  text-align:center;
  margin: 2px auto;
  font-size:14px;
}
.paging a:link{
  text-decoration:none;
  color:#0033CC;
  font-weight:bold;
  font-size:24px;
  cursor:pointer;
}
.paging .disabled{
  color:#000;
  font-weight:bold;
  font-size:24px;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table border=0 summary="" cellspacing="1" cellpadding="1" class="display"&gt;
&lt;?php
$headrows = array();
if (($page &gt; 0) && ($page &lt;= $pages)){       
	$start = ($page-1) * $records_per_page;		  
	for($i=$start;$i&lt;=($records_per_page+$start-1) && $i&lt;$total;$i++){
	
		if(!in_array($rows[$i]['name'],$headrows)){
			echo '&lt;tr&gt;
					&lt;th colspan="6"&gt;'.$rows[$i]['name'].' (Rank: '.$rows[$i]['rank'].')&lt;/th&gt;
				&lt;/tr&gt;
				&lt;tr class="head"&gt;
					&lt;td&gt;Channel Name&lt;/td&gt;
					&lt;td&gt;Title&lt;/td&gt;
					&lt;td&gt;Description&lt;/td&gt;
					&lt;td&gt;Video Tags&lt;/td&gt;
					&lt;td&gt;Music Sources&lt;/td&gt;
					&lt;td&gt;Special Requests&lt;/td&gt;
				&lt;/tr&gt;'; 		
			$headrows[] = $rows[$i]['name'];
		}
	
		echo '&lt;tr&gt;
			&lt;td&gt;'.$rows[$i]['channel_username'].'&lt;/td&gt;
			&lt;td&gt;&lt;a href="'.$rows[$i]['video_link'].'"&gt;'.$rows[$i]['video_title'].'&lt;/a&gt;&lt;/td&gt;
			&lt;td&gt;'.$rows[$i]['video_description'].'&lt;/td&gt;
			&lt;td&gt;'.$rows[$i]['video_tags'].'&lt;/td&gt;
			&lt;td&gt;'.$rows[$i]['music_sources'].'&lt;/td&gt;
			&lt;td&gt;'.$rows[$i]['special_requests'].'&lt;/td&gt;
		&lt;/tr&gt;';
	}
}
?&gt;
&lt;/table&gt;
&lt;?php echo $paginate;?&gt;
&lt;/body&gt;
&lt;/html&gt;