Forum Moderators: coopster
if ($row = mysql_fetch_array($result)) {
$output = "
Name: " . $row['song_name'] .
Artist: " . $row['artist_name'] .
Year: " . $row['pub_year'];
}
if ($output) { echo $output; }
else { echo "That is not a valid record on our database"; }
rocknboilThanks a lot! I think this one might "work! Im just getting one error one the
if (isset($_GET['id'] and is_numeric($_GET['id']) and ($_GET['id'] > 0)) {
$song_id = $_GET['id'];
}
else { die("Invalid input"); } part. It returns "Parse error: syntax error, unexpected T_LOGICAL_AND, expecting ',' or ')' in /home/iphonehe/public_html/data/mf/ns.php on line 30" when i try to access the page. (line 30 is the code that i posted above). <html>
<head>
<title>Song Page</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="pic"></div>
<?php
//connect to our database
mysql_connect("localhost","iphonehe_mf","****");
mysql_select_db("iphonehe_musikfusion");
//get data
$title = $runrows['title'];
$artist = $runrows['artist'];
$url = $runrows['url'];
$year = $runrows['year'];
$duration = $runrows['duration'];
$genre = $runrows['genre'];
if (isset($_GET['id'] and is_numeric($_GET['id']) and ($_GET['id'] > 0)) {
$song_id = $_GET['id'];
}
else { die("Invalid input"); }
$output=null;
$query = "select * from table where id=$song_id;
$result = mysql_query($query) or die ("Error attempting query");
if ($row = mysql_fetch_array($result)) {
$output = "
Name: " . $row['title'] .
Artist: " . $row['artist'] .
Year: " . $row['year'];
Duration: " . $row['duration'];
}
if ($output) { echo $output; }
else { echo "That is not a valid record on our database"; }
</body>
</html> $query = "select * from table where id=$song_id";
will it display the correct things, or does it need more code?