Getting Records using a link
Posted: Sun Sep 21, 2003 3:29 pm
Hi all,
Was wondering if I could get some help. I'm very new to php and want to make a database driven site of horror movies.
So far this is what I have http://www.nearnorthweb.com/one.php
I want to be able to click on the title of the movie, and it will display
the complete record. we have a rating out of 10, comments, cast, directors, and so on. How would I go about doing this....we had it all set up in asp but now are trying to do it in php and mysql because my server won't support access and asp
My page code so far...
Any help would be greatly appreciated
Thanks,
Will Mowat
wmowat@nearnorthweb.com
Was wondering if I could get some help. I'm very new to php and want to make a database driven site of horror movies.
So far this is what I have http://www.nearnorthweb.com/one.php
I want to be able to click on the title of the movie, and it will display
the complete record. we have a rating out of 10, comments, cast, directors, and so on. How would I go about doing this....we had it all set up in asp but now are trying to do it in php and mysql because my server won't support access and asp
My page code so far...
Code: Select all
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php $dbh=mysql_connect ("localhost", "wmowat_horrordb", "horror") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("wmowat_horror");
/* Performing SQL query */
$query = "SELECT Movies.MovieTitle FROM Movies";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
/* Printing results in HTML */
print "<table width=100%>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($line as $col_value) {
print "\t\t</tr><td>$col_value</td><tr>\n";
}
print "\t</tr>\n";
}
print "</table>\n";
/* Free resultset */
mysql_free_result($result);
/* Closing connection */
mysql_close($dbh);
?>
</body>
</html>Thanks,
Will Mowat
wmowat@nearnorthweb.com