Jump to content

[SOLVED] Annoying Upgrade, PHP 4.4.2 to PHP 5.2 -- String Issues and all that


SamLiu

Recommended Posts

Please help me here  8)

 

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]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.