Upgrade to 5.4.0.5 - custom block stopped working
Permalink
I have a simple block that just displays some records from a database table in Concrete5, and after the update to 5.4.0.5 it no longer displays the data in the table.. it just displays empty rows where the data should be. I checked the table, the CSS, everything, the data is all there, it's still iterating the data it's just every row is blank now
Did something change in ADODB or the way I'm supposed to fetch data from Concrete5?
Thanks,
Joe
Did something change in ADODB or the way I'm supposed to fetch data from Concrete5?
Thanks,
Joe
<?php $db = Loader::db(); $sql = "SELECT * from btEquipmentList WHERE eCategory != 'NULL' ORDER BY eCategory, eManufacturer ASC"; $query = $db->execute($sql) or die(mysql_error); while($row = $query->fetchRow()) { $category = $row[1]; ...
I wonder if some new CSS is hiding your data or changing it to same color as your background. Can you look at it with Firebug or IE8 Developer Tools?
I uninstalled, renamed, and reinstalled my block and still no go.. It's returning all the rows it should, a total of like 87, but they are all blank now. All I did was install the 5.4.0.5 update...
I checked the source code of the returned page, I can see where the data should be (it's set up as a table) but all I get are empty rows... so I know it's not CSS related.
Thanks for the input, I'll keep messing with it.
Joe
I checked the source code of the returned page, I can see where the data should be (it's set up as a table) but all I get are empty rows... so I know it's not CSS related.
Thanks for the input, I'll keep messing with it.
Joe
Sorry, I thought the data was in the appearing source.
Sorry, I should have written that better, if I go look at the table on the server - all the records are there (the ones that used to display fine :) ) however if I look at the page itself and view source, I see no records, but I do however see the html table code that would be surrounding each row.
So it appears as if the database call and query works, it's getting a result set back but for whatever reason - this code no longer spits it out. It's like the
while($row = $query->fetchRow()) {
$category = $row[1];
is kaputt! ;)
joe
So it appears as if the database call and query works, it's getting a result set back but for whatever reason - this code no longer spits it out. It's like the
while($row = $query->fetchRow()) {
$category = $row[1];
is kaputt! ;)
joe
<?php $db = Loader::db(); $sql = "SELECT * from btEquipmentList WHERE eCategory != 'NULL' ORDER BY eCategory, eManufacturer ASC"; $query = $db->execute($sql) or die(mysql_error); while($row = $query->fetchRow()) { $category = $row[1]; $manufacturer = $row[2]; print("<tr><td>$category</td>"); print("<td>$manufacturer</td>"); }
I wonder what $row has in it then, if anything.
while($row = $query->fetchRow()) { var_dump($row); $category = $row[1];
Joe Said: "the data is all there, it's still iterating the data it's just every row is blank now".
If the data is being output to your browser then I think it would have to be HTML/CSS related.
If the data is being output to your browser then I think it would have to be HTML/CSS related.
Just an update: I rewrote the view.php MySQL connector to use regular php mysql functions and it works just fine, the output is correct. (see below in code block)
I can only assume 5.4.0.5 changed something in the way it uses the ADODB stuff or how the loader or fetching works...
Argh, not an elegant solution but it works for now until I figure this out.
Joe
I can only assume 5.4.0.5 changed something in the way it uses the ADODB stuff or how the loader or fetching works...
Argh, not an elegant solution but it works for now until I figure this out.
Joe
$con = mysql_connect("mysqlserver.host.com","myuser","mypass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); $result = mysql_query($sql); while($row = mysql_fetch_array($result)) {
Final update:
For whatever reason, I can't access the data by $row[1] (column number) anymore, I have to do $row["column name"]; and the data shows up.. This makes more sense, especially if there are more columns added to the table, so I won't complain too much :)
This is now fixed. Thanks for all your input, and I hope it helps someone else!
Thanks again,
Joe
For whatever reason, I can't access the data by $row[1] (column number) anymore, I have to do $row["column name"]; and the data shows up.. This makes more sense, especially if there are more columns added to the table, so I won't complain too much :)
This is now fixed. Thanks for all your input, and I hope it helps someone else!
Thanks again,
Joe
They must of switched to "Fetch a result row as an associative array". I also noticed in the release notes c5 updated to the most recent ADODB
This may not even be the issue for you, but it solved the problem for me, so I thought I'd at least throw it out there as a possible solution.