PHP-Code:
getComments("1");
mysqli_report(MYSQLI_REPORT_ALL);
mysqli_report(MYSQLI_REPORT_ALL);
mysqli_report(MYSQLI_REPORT_ALL);
$con = mysqli_connect($db_hostname, $db_username, $db_pass, $db_name);
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
function getComments($tutid){
$sql="SELECT * FROM comments WHERE tutorialid='$tutid' ORDER BY date";
if ($result=mysqli_query($con,$sql))
{
// Fetch one and one row
while ($row=mysqli_fetch_row($result))
{
printf ("%s (%s)\n",$row[0],$row[2]);
}
// Free result set
mysqli_free_result($result);
}
}
Uncaught Error: Call to undefined function mysql_query() in /home/p4xch/public_html/riddle/50/inc_rate.php:353 Stack trace: #0 /home/p4xch/public_html/riddle/50/index.php(34): getComments('1') #1 {main} thrown in /home/p4xch/public_html/riddle/50/inc_rate.php on line 353
submitComments("1","$PHP_SELF");
getComments("1");
}
else
{
getComments("1");
}
function getComments($tutid){
//hier folgt viel Layout in CSS
echo "
<style>
</style>
";
//fetch all comments from database where the tutorial number is the one you are asking for
$commentquery = mysql_query("SELECT * FROM comments WHERE tutorialid='$tutid' ORDER BY date") or die(mysql_error());
//find the number of comments
$commentNum = mysql_num_rows($commentquery);
//create a headline
//echo "<div id=\"currentcomments\" class=\"submitcomment\"><h3 class=\"formtitle\">Ranking</h3>\n";
//for each comment in the database in the right category number...
while($commentrow = mysql_fetch_row($commentquery)){
//for security, parse through the bbcode script
//the number corresponds to the column (the message is always stored in column 4
//COUTING STARTS at 0!!!
$commentbb = BBCode($commentrow[4]);
//create the right date format
$commentDate = formatDate($commentrow[6]);
echo "<div class=\"commentbody\" id=\"$commentrow[0]\">\n
<p></p>\n
<p class=\"postedby\">";
{
echo "#$commentrow[0] | $commentrow[2]; $commentbb ";
}
echo "on $commentDate</p>\n
\n</div>";
}
echo "</div>";
}
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/p4xch/public_html/riddle/50/inc_rate.php:12 Stack trace: #0 /home/p4xch/public_html/riddle/50/index.php(14): require() #1 {main} thrown in /home/p4xch/public_html/riddle/50/inc_rate.php on line 12
$db_hostname = "localhost"; //usually "localhost be default"
$db_username = "xxxxx"; //your user name
$db_pass = "xxxxx"; //the password for your user
$db_name = "p4xch_riddle"; //the name of the database
$dbh = mysql_connect($db_hostname, $db_username, $db_pass) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ($db_name);
Einen Kommentar schreiben: