[SOLVED] After updating row result is 0
Posted: Wed Jul 06, 2005 7:34 am
Anyways, thanks!
Hey, new here.. I have a problem wich I can't seem to solve. The result of the 'name' field in the following code is '0' afer updating. All the time. I have a similar problem with another code, that's why I have written this one. But the problem still exists.
here's the code:
Code: Select all
<?
function updateArtist($id,$name,$genre,$description)
{
$timestamp=time();
$artist_update=mysql_query("e;
UPDATE artists
SET
artist_name='$name' AND
artist_genre='$genre' AND
artist_description='$description' AND
artist_timestamp='$timestamp'
WHERE
artist_id='$id'
"e;)or die("e;"e;.mysql_error());
};
if($_POSTїaction]=="e;update"e;)
{
updateArtist($_POSTїid],$_POSTїname],$_POSTїgenre],$_POSTїdescription]);
}
?>Code: Select all
<?
$artist_get=mysql_query("e;
SELECT *
FROM artists
ORDER BY artist_name ASC
"e;)or die("e;"e;.mysql_error());
if(mysql_num_rows($artist_get)==0)
{
echo"e;No artists found!"e;;
}
else
{
while($artist_row=mysql_fetch_array($artist_get))
{
echo'<form action="e;"e; method="e;post"e; name="e;update_'.$artist_rowїartist_id].'"e; id="e;update_'.$artist_rowїartist_id].'"e;>
<input name="e;name"e; type="e;text"e; id="e;name"e; value="e;'.$artist_rowїartist_name].'"e;>
<select name="e;genre"e; id="e;genre"e;>
<option selected>Genre:</option>';
$genre_get=mysql_query("e;
SELECT *
FROM genres
ORDER BY
genre_name ASC
"e;)or die("e;"e;.mysql_error());
while($genre_row=mysql_fetch_array($genre_get))
{
echo"e;<option value=\"e;$genre_rowїgenre_id]\"e;"e;;
if($genre_rowїgenre_id]==$artist_rowїartist_genre])
{
echo' selected';
}
echo"e;>$genre_rowїgenre_name]</option>"e;;
};
echo'</select>
<input name="e;description"e; type="e;text"e; id="e;description"e; value="e;'.$artist_rowїartist_description].'"e;>
<input name="e;id"e; type="e;hidden"e; id="e;action"e; value="e;'.$artist_rowїartist_id].'"e;>
<input name="e;action"e; type="e;hidden"e; id="e;action"e; value="e;update"e;>
<input type="e;submit"e; value="e;Update"e;>
</form>';
}
}
?>