Jump to content

Problem pulling information from database


Collegeboox

Recommended Posts

I am pulling an youtube embedded code from a database however when I have the homepage pull it from the database it will not show anything after the video....

 

EXAMPLE...(this is what it should look like)

 

1.) Title By: Author

    Youtube Video

    Message

    Posted By:

 

(however this is what it looks like)

 

1.) Title By: Author

    Youtube Video

 

*The "message" and "Posted By:" just do not show up*

 

The code is below can someone help me with this problem., it would be greatly appreciated.

 

 

<?php
//open database
			$connect = mysql_connect("Database","name","password") or die("Not connected");
			mysql_select_db("database") or die("could not log in");

			$query = "SELECT * FROM boox ORDER BY date DESC";
			$result = mysql_query($query);

			 // Get the page number, if none is set - it is 0
			if( isset($_GET['page']) )
			{ 
				$page =$_GET['page']; 
			}
			else
			{
				$page  = 0;
			}	

$resultsPerPage = 15;
$num = mysql_num_rows($result); // amount of rows
$loops = $page*$resultsPerPage; // starting loops at..

while ($loops < $num && $loops <  ($page+1)*$resultsPerPage )
{
$link = mysql_result($result,$loops,"link"); // get result from the 'link' field in the table
$username = mysql_result($result,$loops,"username"); // get result from the 'username' field in the table
$messsage = mysql_result($result,$loops,"message");
$author = mysql_result($result,$loops,"author");
$title = mysql_result($result,$loops,"title");
$date = mysql_result($result,$loops,"date");
if ($pagelimit == 0)
	{
	$pagelimit == 1;	
	}
if ($pagelimit <= 15)
// echo stuff here
	$loopz = $loops + 1;
	 echo "  &nbsp
		 </br><align='left'><table width='297' height='900' border='1' align='center' bgcolor='#111'>
				  <tr>
				    <td>$loopz.) $title By: $author
					</br>
					$link
					</br>
					$message
					</br>
					Posted By: $username $date
					</td>
				  </tr>
				</table></br><br>";
		 $count++ ;
		 $pagelimit++;
		 $loops++;
}

	if ( $page!=0 ) // Show 'Previous' link
	{
		$page--;
		$prevpage = ($page +  1);
		echo "<br><br><br><a href='index.php?page=$page'>Previous  $prevpage     </a>";
		$page++;
	}
	if ($loops > 5&&($page+1)*$resultPerPage < $num ) // Show 'next' link
	{
		$page++;
		$nextpage = ($page + 1);
		echo "<a href='index.php?page=$page'>   Next $nextpage</a>";
	}

		?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.