kaihou
08-23-2006, 03:15 PM
Hi, I'm trying to make a preview/view page for my layout database using frames, php, and mysql. How can I make it so that the URL will be http://www.mysite.net/view.php?id=#, while the id # corresponds to the id of the layout/database row? This is what I have so far, without any $_GET variables or whatever.
<?php
$hostname='localhost';
$user='hello';
$pass= 'world';
$dbase='yay';
$connection = mysql_connect("$hostname" , "$user" , "$pass") or die ("Can't connect to MySQL");
$db = mysql_select_db($dbase , $connection) or die ("Can't select database.");
$q = "select * from newlayout";
$result= mysql_query($q, $connection) or die
("Could not execute query : $q." . mysql_error());
while ($row=mysql_fetch_array($result))
{
$id=$row["id"];
$title=$row["title"];
$icon=$row["icon"];
$layoutid=$row["layoutid"];
$dateadded=$row["dateadded"];
$series=$row["series"];
$layouttype=$row["layouttype"];
$email=$row["email"];
$name=$row["name"];
$indexurl=$row["indexurl"];
$downloadurl=$row["downloadurl"];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>View Layout <?php echo "$layoutid"; ?> / <?php echo "$id"; ?> - <?php echo "$title"; ?> by <?php echo "$name"; ?></title>
<link rel="stylesheet" href="http://www.mysite.net/style.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<frameset rows="40,*" frameborder="0" >
<frame name="topFrame" scrolling="no" noresize src="http://www.mysite.net/viewtop.php" >
<frame name="mainFrame" src="<?php echo "$indexurl"; ?>">
</frameset>
<noframes></noframes>
</html>
<?php
} #end of while
?>
$layoutid is a manual variable I made for the IDs... ignore it for now. So can anyone help? :confused:
<?php
$hostname='localhost';
$user='hello';
$pass= 'world';
$dbase='yay';
$connection = mysql_connect("$hostname" , "$user" , "$pass") or die ("Can't connect to MySQL");
$db = mysql_select_db($dbase , $connection) or die ("Can't select database.");
$q = "select * from newlayout";
$result= mysql_query($q, $connection) or die
("Could not execute query : $q." . mysql_error());
while ($row=mysql_fetch_array($result))
{
$id=$row["id"];
$title=$row["title"];
$icon=$row["icon"];
$layoutid=$row["layoutid"];
$dateadded=$row["dateadded"];
$series=$row["series"];
$layouttype=$row["layouttype"];
$email=$row["email"];
$name=$row["name"];
$indexurl=$row["indexurl"];
$downloadurl=$row["downloadurl"];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>View Layout <?php echo "$layoutid"; ?> / <?php echo "$id"; ?> - <?php echo "$title"; ?> by <?php echo "$name"; ?></title>
<link rel="stylesheet" href="http://www.mysite.net/style.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<frameset rows="40,*" frameborder="0" >
<frame name="topFrame" scrolling="no" noresize src="http://www.mysite.net/viewtop.php" >
<frame name="mainFrame" src="<?php echo "$indexurl"; ?>">
</frameset>
<noframes></noframes>
</html>
<?php
} #end of while
?>
$layoutid is a manual variable I made for the IDs... ignore it for now. So can anyone help? :confused: