[PHP] Strange error on mysql_fetch_array
The following code fragment works properly, in that I get the output I'm expecting. However, if I don't disable error messages with @, I get an error message from PHP saying: "Warning: Supplied argument is not a valid MySQL result resource in /var/www/htdocs/cgcm/test2.php on line 9." How can the resource be invalid if I'm getting the results back? I'd appreciate any explaination. $connection_id = @mysql_connect ('localhost', 'root') or die('No connection.'); $database_id = @mysql_select_db ('cgcms', $connection_id) or die('No connection.'); ... $result_id = @mysql_query("DESC $table_name $field_name"); $row = mysql_fetch_array($result_id); # This is line 9 -- Todd A. Jacobs CodeGnome Consulting, LTD -- PHP General 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]
Re: [PHP] locking a mysQL row
On Tue, 11 Sep 2001, Justin French wrote: > I'm currrently developing a dynamic, user-added content site. The > thing is, content can be added and edited my TWO people.. the > original writer, and the editor. Just put a timestamp field into the table, which will automatically track the last update of that row. Prior to doing a write, lock the table, and then compare the timestamp at retrieval time to the current timestamp. If it's identical, write the data and unlock. Otherwise, display an error and unlock, or do whatever else you want to do to handle the error. -- Work: It's not just a job, it's an indenture. -- PHP General 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]