Adding php block results in errors in all other blocks.

Permalink
I downloaded and installed the simple_php_block from the market and it is awesome. I've successfully connected to a mysql database table and displayed it on my site but as soon as I add the php block all the blocks underneath it start to give a bunch of errors.

An unexpected error occurred.
mysql error: [: ] in EXECUTE("SELECT * FROM CollectionVersionAreaLayouts WHERE cID=169 AND cvID='11' AND arHandle='Footer Column One' ORDER BY position ASC, cvalID ASC")

Fatal error: Uncaught exception 'ADODB_Exception' with message 'mysql error: [: ] in EXECUTE("insert into Logs (logType, logText, logIsInternal) values ('exceptions', 'Exception Occurred: mysql error: [: ] in EXECUTE("SELECT * FROM CollectionVersionAreaLayouts WHERE cID=169 AND cvID=\'11\' AND arHandle=\'Footer Column One\' ORDER BY position ASC, cvalID ASC") #0 /home/content/04/7230504/html/concrete/libraries/3rdparty/adodb/adodb.inc.php(1037): adodb_throw(\'mysql\', \'EXECUTE\', false, false, \'SELECT * FROM C...\', false, Object(ADODB_mysql)) #1 /home/content/04/7230504/html/concrete/libraries/3rdparty/adodb/adodb.inc.php(993): ADOConnection->_Execute(\'SELECT * FROM C...\') #2 /home/content/04/7230504/html/concrete/libraries/3rdparty/adodb/adodb.inc.php(1543): ADOConnection->Execute(\'SELECT * FROM C...\', Array) #3 [internal function]: ADOConnection->GetArray(\'SELECT * FROM C...\', Array) #4 /home/content/04/7230504/html/concrete/libraries/database.php(73): call_user_func_array(Array, Array) #5 / in /home/content/04/7230504/html/concrete/libraries/3rdparty/adodb/adodb-exceptions.inc.php on line 78

This is the basic code I'm using I havent populated the database yet I only put one row of info to see if I could connect and display it.

$con = mysql_connect("host","username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
$result = mysql_query("SELECT * FROM table");
echo "<table border='1'>
<tr>
<th>name</th>
<th>number</th>
<th>address</th>
</tr>";
while($row = mysql_fetch_array($result))
{


Absolutely any help would be great.

If I can provide any more information please let me know.

 
carlremy replied on at Permalink Best Answer Reply
carlremy
I could be wrong, but I think you're creating a new db connection and dropping the connection to your Concrete db.

The recommended method for connecting to other dbs is detailed here:http://www.concrete5.org/documentation/developers/system/database-c...

Hope this helps.
nrod1087 replied on at Permalink Reply
Wow, I honestly did expect an answer so quick! Implemented your suggestions and got it all up and running. I really appreciate the fact that you not only help me find a solution, you(the community) also tell me what could be possibly wrong.Concrete5 as a CMS is the best but IMO The best thing about Concrete5 is the community.
Thanks again, -Nick
Mnkras replied on at Permalink Reply
Mnkras
Yea you are hijacking the database connection, you should use ADODB instead of the base mysql commands, (they are debating deprecating them)