<div class="grid--cell fl1 lh-lg">
<div class="grid--cell fl1 lh-lg">
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, <a href="/help/reopen-questions">visit the help center</a>.
</div>
</div>
</div>
<div class="grid--cell mb0 mt8">Closed <span title="2013-06-02 19:35:40Z" class="relativetime">6 years ago</span>.</div>
</div>
</aside>
I am not an expert in PHP. I want to implement a star rating script. Accordingly, I want to implement at the start of the page for rating:
<?php require_once("ratings.php"; $rr = new RabidRatings(); ?>
However, this gives me a server error.
This is my PHP code before the opening HTML tag (in the page that I wish to impelement the star rating script):
<?
include "admin/configuration/config.php";
include "admin/configuration/main_class.php";
function en_string($str)
{
return strtolower(str_replace(" ", "_", trim($str)));
}
function de_string($str)
{
return str_replace("_", " ", trim($str));
}
;
$id = en_string($_GET['id']);
$id2 = en_string($_GET['id2']);
;
$path = "../";
if($id2)
{
$sql = "SELECT * FROM fh_categories AS a JOIN fh_subcategories AS b ON a.fh_Cid=b.fh_Cid JOIN fh_software AS c ON b.fh_SCid=c.fh_SCid JOIN fh_version AS d ON d.fh_Sid=c.fh_Sid WHERE d.fh_Sid='$id' and d.fh_Vid='$id2' ";
$path = "../../";
}
else
{
$sql = "SELECT * FROM fh_categories AS a JOIN fh_subcategories AS b ON a.fh_Cid=b.fh_Cid JOIN fh_software AS c ON b.fh_SCid=c.fh_SCid JOIN fh_version AS d ON d.fh_Sid=c.fh_Sid WHERE d.fh_Vfront=1 and d.fh_Sid='$id'";
}
$query1 = mysql_query($sql);
$rec = mysql_fetch_array($query1);
$cid = $rec['fh_Cid'];
$scid = $rec['fh_SCid'];
$sid = $rec['fh_Sid'];
$description = $rec['fh_Sdescription'];
$technical = $rec['fh_Vtechnical'];
$changelog = $rec['fh_VchangeLog'];
$caption = $rec['fh_Sid'];
$company = $rec['fh_Scompany'];
$homepage = $rec['fh_Shomepage'];
$icon = $rec['fh_Sicon'];
$version = $rec['fh_Vcaption'];
$shot = $rec['fh_Vscreenshot'];
$size = $rec['fh_Vsize'];
$license = $rec['fh_Vlicense'];
$extension = $rec['fh_Vextension'];
$platform = $rec['fh_Vplatform'];
$did = $rec['fh_Did'];
$date = strftime("%d %b %Y", $rec['fh_Vdate']);
$language = "English";
$j = 1;
for($i = 0; $i < (strlen($shot)); $i++)
{
if($shot[$i] != ';')
{
$screenshot[$j] .=$shot[$i];
}
else
{
$j++;
}
}
?>
This is the code to show the rating <div>
containing start:
<?php $rr->showStars("anotherGreatArticle"); ?>
When I add this to my page, it doesn't show anything on the page, and the page is only loaded halfway.
How would I sort things out and make it work?
</div>
There is a syntax error:
<?php require_once("ratings.php"; $rr = new RabidRatings(); ?>
should be
<?php require_once("ratings.php"); $rr = new RabidRatings(); ?>
// ^ forgot to close this
You forgot to close require_once("ratings.php")
You forgt a closing brace after require_once().
This cannot happen if you use an editor / IDE with syntax and error highlighting. Any decent editor should immediately underline the errorneous code. Free editors with such capability are Notepad++, Netbeans, Eclipse (sorted from easy to hard in learning curve - arguably.)