I'm working under the gun here, so please excuse me if this turns out to be
something really simple, but it's got me stumped... I'm trying to update the
"cover" field in a table by using the album_id field in the table and adding
a ".jpg" extention to it...
For example:
"Update albums set cover = "1.jpg" where album_id = 1"

For some reason, however, the update isn't working when executed... here are
the results I get:

album_id: 1 - cover: 1.jpg
mysql_errno: 0:   mysql_error:
Update Failed!

As you can see, there's no error code generated, and the update statement
works great from the command line...

here's the relevant code (i'm connecting to the database as root, so i don't
think it's a permissions thing...):
$query = "SELECT * FROM albums ORDER BY album_id";

$stuff = mysql_query($query) or die("Select Failed!");

while ($results = mysql_fetch_array($stuff)) {

  $cover = $results['album_id'].".jpg";
  $album_id = $results['album_id'];
  echo $album_id." - ".$cover."<br>";
  $update = "UPDATE ALBUMS SET COVER = \"$cover\" WHERE ALBUM_ID =
  echo $update."<BR>";
  echo mysql_errno().": ".mysql_error()."<BR>";
  mysql_query($update) or die("Update Failed!");

Simple... right? But it's beating me up this morning.. I would greatly
appreciate it if anyone could show me the error of my ways...


Home Of Radio Free BD
For The Difference.

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to