SamLiu Posted May 18, 2007 Share Posted May 18, 2007 Please help me here Ok so heres the deal. I program a text based game but recently on my development server I reinstalled linux (Ubuntu 7.04 Fiesty Fawn). It automatically uses PHP 5.2 so I have no say in the matter (I could find a way to downgrade but I figured hey I should start using PHP5.) So I did and now I'm stuck with all these backwards compatibility issues. And right off the bat my stupid database setup script isnt working. I tested the same script on my external PHP 4 server and it works fine. Now on PHP5 it is giving me this crap Catchable fatal error: Object of class ADORecordSet_empty could not be converted to string in /var/www/ApocCore/reset.php on line 26 So heres my script line 26 /*****************Drop tables******************* ************************************************/ $result1 = $connect->Execute("DROP TABLE IF EXISTS $db[info] , $db[ipbank], $db[updater], $db[counter], $db[structures], $db[score], $db[army], $db[p_messages_table], $db[log], $db[war], $db[time], $db[bonus], $db[building], $db[awayunits]"); print "Dropped tables. Returned a $result1<br>"; I'm using ADOdb Lite 1.4.2 (Latest version). People report that it works fine with PHP 5.2 so I'm going by that. I did read somewhere that I should try "[".print_r($query)."]" or something like that and separate the query from the statement, but when I did that it didnt throw an error and didnt execute either. So I was at a loss of what to do and figured I should start here. I also read that this has to do with how PHP5.2 handles strings. Theres some sort of "magical __tostring()" or whatever. So I need someone to explain what I should do to fix errors of this type as they're all over my code. Thanks in advance! I'm counting on you guys, I'm completely nub to PHP5. ??? :'( [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
utexas_pjm Posted May 18, 2007 Share Posted May 18, 2007 I'm guessing that, here: $result1 = $connect->Execute("DROP TABLE IF EXISTS $db[info] , $db[ipbank], $result1 is a ADORecordSet_empty instance. So then here: print "Dropped tables. Returned a $result1<br>"; You're trying to print an object instance as if it were a string, and PHP doesn't know how to do that. Try this: print "Dropped tables. Returned a " . print_r($result1, true) . "<br>"; Best, Patrick Quote Link to comment Share on other sites More sharing options...
SamLiu Posted May 18, 2007 Author Share Posted May 18, 2007 Oooo thanks man! So thats the problem. 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.