mivec
05-05-2004, 07:04 PM
hi all,
i am building something where searches the database for all related records and then if user wants any particular record shown, the user checks it with a radio button or checkbox. then it updates the members records. here is the code i have done:
$sql = "SELECT id_music, music_dir, artist_name, song_title FROM tblmusic ORDER BY id_music ASC";
$rs = mysql_query($sql);
$numRows = mysql_num_rows($rs);
if ($numRows > 0) {
$i=0;
while ($row = mysql_fetch_object($rs)){
echo("<tr><td class=\"text\" align=center>$row->id_music</td>");
echo("<td class=\"text\" align=center>$row->artist_name</td>");
echo("<td class=\"text\" align=center>$row->song_title</td>");
echo("<td class=\"text\" align=center><u><a href=\"$row->music_dir\">Test Song</a></u></td>");
echo("<td class=\"text\" align=center><input name=\"radSong\" type=\"radio\" value=\"$row->music_dir\"></td>");
echo("</tr>");
}
}
else {
echo("<tr><td colspan=\"2\" class=\"text\">There Are No Backround Music In The Database.</td></tr>");
}
in the next page:
include("dbconnect.php");
$query = "UPDATE tblmembers SET bgmusic= '".$_POST["radSong"]."' WHERE username = '".$_POST["txtUsername"]."'";
$rs = mysql_query($query);
$affRows = mysql_affected_rows($dbc);
if ($affRows > 0){
$message = "SUCCESS: Your Background Music Has Been Successfully Updated.";
}
else{
$message = "ERROR: A problem has occured when you tried to update your background music. " .
"The possible reasons might be your username does not match or " .
"due to the unchecked radio button. Contact the administrators of Foreverus.com for assistence";
}
problem:
it doesn't work.instead it goes to this part:
ERROR: A problem has occured when you tried to update your background music. The possible reasons might be your username does not match or due to the unchecked radio button. Contact the administrators of Foreverus.com for assistence.
what's the problem??i have looked at it and i dunno what's the prob. pls advice.thank you
i am building something where searches the database for all related records and then if user wants any particular record shown, the user checks it with a radio button or checkbox. then it updates the members records. here is the code i have done:
$sql = "SELECT id_music, music_dir, artist_name, song_title FROM tblmusic ORDER BY id_music ASC";
$rs = mysql_query($sql);
$numRows = mysql_num_rows($rs);
if ($numRows > 0) {
$i=0;
while ($row = mysql_fetch_object($rs)){
echo("<tr><td class=\"text\" align=center>$row->id_music</td>");
echo("<td class=\"text\" align=center>$row->artist_name</td>");
echo("<td class=\"text\" align=center>$row->song_title</td>");
echo("<td class=\"text\" align=center><u><a href=\"$row->music_dir\">Test Song</a></u></td>");
echo("<td class=\"text\" align=center><input name=\"radSong\" type=\"radio\" value=\"$row->music_dir\"></td>");
echo("</tr>");
}
}
else {
echo("<tr><td colspan=\"2\" class=\"text\">There Are No Backround Music In The Database.</td></tr>");
}
in the next page:
include("dbconnect.php");
$query = "UPDATE tblmembers SET bgmusic= '".$_POST["radSong"]."' WHERE username = '".$_POST["txtUsername"]."'";
$rs = mysql_query($query);
$affRows = mysql_affected_rows($dbc);
if ($affRows > 0){
$message = "SUCCESS: Your Background Music Has Been Successfully Updated.";
}
else{
$message = "ERROR: A problem has occured when you tried to update your background music. " .
"The possible reasons might be your username does not match or " .
"due to the unchecked radio button. Contact the administrators of Foreverus.com for assistence";
}
problem:
it doesn't work.instead it goes to this part:
ERROR: A problem has occured when you tried to update your background music. The possible reasons might be your username does not match or due to the unchecked radio button. Contact the administrators of Foreverus.com for assistence.
what's the problem??i have looked at it and i dunno what's the prob. pls advice.thank you