mrherman Posted August 23, 2010 Share Posted August 23, 2010 Hi -- This query seems to be problematic because the UPDATE is not being performed. Could you please take a gander and let me know what is the problem? BTW, the table "teamy" does contain 630 records. Thanks in advance! $sql = "SELECT COUNT( * ) AS records FROM teamy" ; $result = mysql_query( $sql ) ; if ( ! $result ) { die ( __line__ . "_teamy_" . mysql_error() ) ; } $a_count = mysql_fetch_assoc($result); if ( $a_count['records'] = 0 ) { echo "No records found in teamy." ; } else { /*** Update r_rost_rma ***/ $sql = "UPDATE r_rost_rma JOIN teamy ON r_rost_rma.student_id = teamy.student_id SET r_rost_rma.teachername = teamy.team WHERE RTRIM( UPPER( r_rost_rma.localcourse ) ) = 'HOMEROOM'" ; $result = mysql_query ( $sql ) ; if ( ! $result ) { die ( __line__ . "_update_r_rost_rma_" . mysql_error() ) ; } } Quote Link to comment Share on other sites More sharing options...
arbitter Posted August 23, 2010 Share Posted August 23, 2010 I truly do not understand any of your script (that's not your fault though - I'm not good in php) but one thing I notice is that in the $sql variable there are no ' 's. $sql = "UPDATE r_rost_rma JOIN teamy ON r_rost_rma.student_id = 'teamy.student_id' SET r_rost_rma.teachername = 'teamy.team' WHERE RTRIM( UPPER( r_rost_rma.localcourse ) ) = 'HOMEROOM'" ; I do not know if this helps, only thing I know is after a '=' in a mysql statement I put ' 's around it. Quote Link to comment Share on other sites More sharing options...
mrherman Posted August 23, 2010 Author Share Posted August 23, 2010 Thanks, arbitter -- The -- teamy.student_id -- is actually a table and a field, not a variable (table.field). Thanks for your reply, though. Quote Link to comment Share on other sites More sharing options...
samshel Posted August 23, 2010 Share Posted August 23, 2010 Does the following query return any records: SELECT * FROM r_rost_rma JOIN teamy ON r_rost_rma.student_id = teamy.student_id SET r_rost_rma.teachername = teamy.team WHERE RTRIM( UPPER( r_rost_rma.localcourse ) ) = 'HOMEROOM' Quote Link to comment Share on other sites More sharing options...
mrherman Posted August 23, 2010 Author Share Posted August 23, 2010 Hi, samshel -- Thanks for your reply. In continuing to play with this "problem," I have realized my error...As the script moves on, I had a little piece of code in there that actually deleted certain parts of the table, which made it APPEAR that the UPDATE was not working, when actually it was working. Several hours! Sound of windshield washers: dumb-guy! dumb-guy! dumb-guy! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.