Jump to content

php/MySQL syntax issue - keep getting blank screen


Smokin Joe

Recommended Posts

It's a simple way of spitting out the list of training videos that my boss has available, and then view whichever one you want.

 

However, I can't really test it that well because I keep getting that blank screen.  I've tried some little debug techniques but I've learned that my debugging abilities are somewhat lacking.  Would anyone happen to see what I done wrong with my code or perhaps can point me towards some good debugging techniques?

 

 

<?php 

include "config.php";

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="../lrg_css_HOME.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Salesperson Training</title>
</head>

<body>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="190" valign="bottom"><a href="/index.php"><img src="/img/lrg_logo.gif" width="180" height="90" border="0" align="baseline"></a> </td>
    <td width="491" valign="bottom" nowrap class="headertext1"> </td>
    <td valign="bottom" nowrap class="headertext2"> </td>
  </tr>
</table>

<br /><br />

<?php

//If no previous command
if(!isset($cmd)) 
{

	mysql_connect($vid_server, $vid_DBusername, $vid_DBpassword) or die ("$DatabaseError - 162"); 
	mysql_select_db($vid_database); 


   //display all
   $result = mysql_query("SELECT * FROM $vid_table ORDER BY id"); 
   
   //loop to grab all news
   while($r=mysql_fetch_array($result)) 
   { 
	  //grab the title and the ID of the news
	  $title=$r["vname"];//take out the title
	  $id=$r["id"];//take out the id
	  $url=$r["vaddr"];//take out the address
	  $desc=$r["vdesc"];//take out the description

	 //spit out linked title, and a [Delete] link
	  echo "<a href=\"$url\">$title</a> - [<a href='index.php?cmd=view&id=$id'>View</a>]";
	  echo "<p>$desc</p>";
	  echo "<br><br>";
	}
}

//VIEW MOVIE
if($_GET["cmd"]=="view")
{


	mysql_connect($vid_server, $vid_DBusername, $vid_DBpassword) or die ("$DatabaseError");
	mysql_select_db($vid_database);  

	// open connection and grab the array
	$resultVid = mysql_query("SELECT vname, vaddr, vdesc FROM $vid_table WHERE id=$id") or die ("Database READ Error");
	$r=mysql_fetch_array($result);

    //grab the title and the ID of the news
    $title=$r["vname"];//take out the title
    $id=$r["id"];//take out the id
    $url=$r["vaddr"];//take out the address
    $desc=$r["vdesc"];//take out the description


	echo "<br /><br />";
	echo "<B>$title</B><br />";
	echo "<table border='0' cellpadding='0' align=\"center\"";
	echo "<tr><td>";
	echo "<OBJECT classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' width=\"720\" height=\"500\" codebase='http://www.apple.com/qtactivex/qtplugin.cab'>";
	echo "<param name='src' value=\"http://www.leiterrealty.com/training/videos/".$url."\">";
	echo "<param name='autoplay' value=\"true\">";
	echo "<param name='controller' value=\"true\">";
	echo "<param name='loop' value=\"true\">";
	echo "<EMBED src=\"http://www.leiterrealty.com/training/videos/".$url."\" width=\"720\" height=\"500\" autoplay="true" 
        controller=\"true\" loop=\"true\" pluginspage='http://www.apple.com/quicktime/download/'>";
	echo "</EMBED>";
        echo "</OBJECT>";
        echo "</td></tr>";
        echo "<tr><td>";
	echo "<p>$vdesc</p></td></tr>";
	echo "</table>";		
	echo "<br /><br /><hr />";		
}

?>

</body>
</html>

debugging technique #1 - turn on error reporting so you can see what error you are getting

 

also, im not sure what this is

<?php
mysql_connect($vid_server, $vid_DBusername, $vid_DBpassword) or die ("$DatabaseError - 162"); 

 

I think it should be something like this

<?php
mysql_connect($vid_server, $vid_DBusername, $vid_DBpassword) or die (mysql_error()); 

debugging technique #1 - turn on error reporting so you can see what error you are getting

 

Yes, put this at the top of your script, before the include file but after the opening '<?php' tag.

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

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.