it's amazing.. I've been banging my head for over an hour on this, then as
soon as I send for help, I see the obvious - first of all, my error checking
was done *before* the query executed... then, to make it even more of an
effort in mindlessness, the table name capitalization was throwing it all
off!!

Sorry for the waste of good bandwidth...

~BD~



http://www.bustdustr.net
http://www.rfbdproductions.com
Home Of Radio Free BD
For The Difference.


----- Original Message -----
From: BD <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 18, 2001 12:21 PM
Subject: [PHP-DB] Help with update...


> 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
> UPDATE ALBUMS SET COVER = "1.jpg" WHERE ALBUM_ID = 1
> 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 =
> $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...
>
> ~BD~
>
> http://www.bustdustr.net
> http://www.rfbdproductions.com
> 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]


-- 
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