Jump to content

Pulling information from a database PLEASE HELP!


Collegeboox

Recommended Posts

I am having trouble pulling a youtube embedded code from my database. Everything else comes out fine however it just doesnt pull anything out where the embedded code is supposed to be. Any ideas I put the code below. All help would be greatly appreciated, also if anyone is feeling generous and would like to help me some more please message me I have a couple other small questions.

 

<?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 'Title' field in the table
$username = mysql_result($result,$loops,"username"); // get result from the 'Content' field in the table
$messsage = mysql_result($result,$loops,"message");
$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. 
					</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>";
	}

		?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.