I have a snippet using this code:
<?php
require(’dbConn.php’);
$cv_str_db = ’’; // @type STRING
$cv_link = ’’;
$cv_str_query = ’’; // @type STRING
$cv_rs_result = ’’; // @type RESULT SET
$cv_str_html = isset($cv_str_html)?$cv_str_html:’’; // @type HTML STRING
$cv_array_row = ’’; // @type ARRAY
$cv_str_db = ’modx’;
$cv_link = dbConn($cv_str_db);
$cv_str_query = ’SELECT `modx`.coverage_nation.id,
`modx`.coverage_nation.name,
`modx`.coverage_national_region.id,
`modx`.coverage_national_region.name
FROM `modx`.coverage_nation_part
RIGHT JOIN `modx`.coverage_national_region ON (`modx`.coverage_nation_part.nation_regionID = `modx`.coverage_national_region.id)
RIGHT JOIN `modx`.coverage_nation ON (`modx`.coverage_nation_part.nationID = `modx`.coverage_nation.id)
ORDER BY `modx`.coverage_nation.name ASC, `modx`.coverage_national_region.name ASC;’;
$cv_rs_result = mysql_query($cv_str_query) or die(mysql_error());
$cv_str_html .= ’<ul>’;
while($cv_array_row = mysql_fetch_array($cv_rs_result)){
$cv_int_parent_id = $cv_array_row[0];
$cv_int_parent_name = $cv_array_row[1];
if(!empty($row[3])){
$cv_int_child_id = $cv_array_row[3];
}
if(!empty($row[4])){
$cv_int_child_name = $cv_array_row[4]
}
$cv_str_html .= ’<li><a href=\’\’>’.$cv_int_parent_name.’</a>’;
$cv_str_html .= ’</li>’;
}
$cv_str_html .= ’</ul>’;
print($cv_str_html);
unset($cv_str_db);
unset($cv_link);
unset($cv_str_query);
unset($cv_rs_result);
unset($cv_str_html);
unset($cv_array_row);
?>
Called using [[snippet_name]] that when viewed in browser gave an error:
"Parse error: parse error in C:\wamp\www\SnapShot\manager\includes\document.parser.class.inc.php(770) : eval()’d code on line 27"
Help Please!!
Perhaps change these parts:
if(!empty($row[3])){
$cv_int_child_id = $cv_array_row[3];
}
if(!empty($row[4])){
$cv_int_child_name = $cv_array_row[4]
}
to this:
if(!empty($cv_array_row[3])){
$cv_int_child_id = $cv_array_row[3];
}
if(!empty($cv_array_row[4])){
$cv_int_child_name = $cv_array_row[4];
}
You definitely need a semicolon to the end of this line:
$cv_int_child_name = $cv_array_row[4]
Thanks for you help. I have solved this issue. It was a combination of a missing ’;’, a ’\’ where there should be ’/’, and my require didn’t go to the file.