Another newbie who needs some help.
Im creating a database of Flash movies on my homepage.
It seemed that it was working well, but I realised that if the flash object didnt have the right width and length, the movie would look very good :p
So I had to add "Width" and "Height" in the database.
The problem was to fetch the info inside the database and add it to the php code.
The first page displaying the Flash movies is working well:
<?
$host= "localhost";
$username= "***";
$password= "***";
$dbname = "***";
$dbTable = "flash";
mysql_connect($host,$username,$password) OR die("Can't connect to database");
mysql_select_db("$dbname") or die("Unable to select database");
$result = @mysql_query("SELECT DATE_FORMAT(dato, '%d.%m.%Y') AS NEW_DATO, name, info, link FROM flash ORDER BY DATO DESC LIMIT 50");
if (!$result) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
echo"<div align=\"left\">
<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" width=\"878\" bordercolor=\"#000000\" bgcolor=\"#c0c0c0\">
";
while ($row = mysql_fetch_array($result))
{
echo"<tr>
<td width=\"16%\" height=\"18\">" . $row["name"] . "</td>
<td width=\"26%\" height=\"18\">" . $row["info"] . "</td>
<td width=\"14%\" height=\"18\"><a href=test2.php?kollen=" . $row["link"] . ">Kjør Flash!</a></td>
</tr>";
}
echo"</table>
</div>";
?>
But then the newbie gets some problems.
I need to get the "Width" and "Height" from the right movie, and put it in the object code.
This is what I tried, that didnt work:
<?php
$host= "localhost";
$username= "***";
$password= "***";
$dbname = "***";
$dbTable = "flash";
mysql_connect($host,$username,$password) OR die("Can't connect to database");
mysql_select_db("$dbname") or die("Unable to select database");
$wh = @mysql_query(""SELECT width, height FROM FLASH WHERE name = '" . $kollen . "'";
if (!$wh) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
while ($row = mysql_fetch_array($wh))
{
$run="flash/$kollen";
?>
<body bgcolor="c0c0c0">
<table align="center" width="100%" border="0">
<tr align="center"><a href="flash.php">Tilbake til Flash Oversikt</a></tr>
<tr align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0 width="<?php echo $row["width"]; ?>" height="<?php echo $row["height"]; ?>",0">
<param name=movie value="<?php echo $run; ?>">
<param name=quality value=high>
<embed src="<?php echo $run; ?>" quality=high
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
type="application/x-shockwave-flash" width="<?php echo $row["width"]; ?>" height="<?php echo $row["height"]; ?>">
</embed> </object></tr>
<tr align="center"><a href="flash.php">Tilbake til Flash Oversikt</a></tr>
Im sure I have screwed up big time, and that there is a simple explination here.
But some help would be nice 🙂
Best regards,
M-Jay