-
☆ A M B ☆
- 24,524 Posts
Looks to me like you forgot to close your function definition block (i.e. missing } ).
Also, if you enclose your code samples in the
tags (you can automatically create them from the # button on the editing menu) it makes things much easier to see.
-
☆ A M B ☆
- 24,524 Posts
I have never had that "unexpected $end" without having missed a closing brace somewhere. And in your code, the function closing brace is missing.
ok i finally managed to get it right with this format:
$global_dbh = mysql_connect(’JONSERV’, ’thegent’, ’gringo’);
mysql_select_db(’formula1’, $global_dbh);
function display_db_table($connection )
{
$query_string = "SELECT * FROM drivers";
$result_id = mysql_query($query_string);
$column_count = mysql_num_fields($result_id);
print("<table border=1>\n");
while ($row = mysql_fetch_row($result_id))
{
print("<tr align=left valign=top>");
for ($column_num = 0;
$column_num < $column_count;
$column_num++)
print("<td>$row[$column_num]<td/>\n");
print("<tr/>\n");
}
}
Problem is that for some reason MODx is putting an empty column in between the real ones.
Anyone know a reason for this please
-
☆ A M B ☆
- 24,524 Posts
Without knowing what is in your table in the database, or maybe even a screenshot of what you are getting as a result output, it’s impossible to say what’s going on.
You can put that code in a stand-alone .php file and run it directly from the browser’s address bar, and see if it behaves any differently outside of MODx.
Cheers Garryn
Well spotted that man
thank you that did the trick