PHP-MYSQL HELP CONNECTION
Posted: Sat Jun 05, 2010 1:34 pm
Hi everybody who is master php and the mysql i have created these code but nor working correctly what is wrong can any one help me here are what i did
popup player.php
[syntax]<<?php if (empty($id)) { ?>
<?php } else {
// you can fetch data from database result set using mysql_fetch_assoc()
$row = mysql_fetch_assoc($result);
?>
<table>
<tr>
<td><h1><?php echo $row['title'] ." by " . $row['artist']; ?></h1></td>
</tr>
<tr>
<td>
<td valign="top"> <div align="center"> <embed src="mydomail.com/path/<?php echo $row['filepath']; ?>
" type="audio/x-pn-realaudio-plugin" CONSOLE="Clip1"
CONTROLS="ControlPanel,StatusBar" HEIGHT="57" WIDTH="400" AUTOSTART="true"></div>
</td>
</tr>
</table><br>
<?php } ?>
<?php
if (isset($_GET['id'])) {
$id = $_GET['id'];
$link = mysql_pconnect('localhost','peter','123456');
mysql_select_db('audio');
$query = "INSERT INTO mp3s (id,artist,title,filepath)
VALUES (1,'John','I need','/path/music.mp3')";
$result = mysql_query($query);
$query = "SELECT * FROM mp3s WHERE id=".$id." LIMIT 1";
$result = mysql_query($query);
}
?>[/syntax]
when i upload it shows me a blank page whats wrong
here is the linten link
i created a database and table and stored id title artist filepath in mysql
thanks am waiting your help please
popup player.php
[syntax]<<?php if (empty($id)) { ?>
<?php } else {
// you can fetch data from database result set using mysql_fetch_assoc()
$row = mysql_fetch_assoc($result);
?>
<table>
<tr>
<td><h1><?php echo $row['title'] ." by " . $row['artist']; ?></h1></td>
</tr>
<tr>
<td>
<td valign="top"> <div align="center"> <embed src="mydomail.com/path/<?php echo $row['filepath']; ?>
" type="audio/x-pn-realaudio-plugin" CONSOLE="Clip1"
CONTROLS="ControlPanel,StatusBar" HEIGHT="57" WIDTH="400" AUTOSTART="true"></div>
</td>
</tr>
</table><br>
<?php } ?>
<?php
if (isset($_GET['id'])) {
$id = $_GET['id'];
$link = mysql_pconnect('localhost','peter','123456');
mysql_select_db('audio');
$query = "INSERT INTO mp3s (id,artist,title,filepath)
VALUES (1,'John','I need','/path/music.mp3')";
$result = mysql_query($query);
$query = "SELECT * FROM mp3s WHERE id=".$id." LIMIT 1";
$result = mysql_query($query);
}
?>[/syntax]
when i upload it shows me a blank page whats wrong
here is the linten link
Code: Select all
<a href="/player.php?id=1">listen music</a>thanks am waiting your help please