hey hey,
i am trying to connect to a mysql database on my local machine through the following script but nothing is shown, not even the error message. any idea why? ( i am logining as root to test for now ). thanks!
<?php
@ $db = new mysqli('localhost', 'root', '******', 'work');
if (mysqli_connect_errno()) {
echo 'Error: Could not connect to database.';
exit;
}
$query = "select * from projects";
$result = $db->query($query);
$num_results = $result->num_rows;
for ($i = 0; $i < $num_results; $i++) {
$row = $result->fetch_assoc();
echo "<div>\n";
echo "<p class='sample'><a href='";
echo $row['link'];
echo "/'>";
echo $row['name'];
echo "</a>\n";
echo "-";
echo $row['description'];
echo "</p>\n";
echo "</div>\n\n";
}
$result->free();
$db->close();
?>
Update 1:
i removed the @ and got this error message:
Fatal error: Class 'mysqli' not found in c:\Inetpub\wwwroot\mywork.php on line 60
do i need to install some php extension or something?? i have got php 5 installed.
Update 2:
wooo! i've solved it. i just had to type in extension=php_mysqli.dll in my php.ini in the dll section. i am so proud of myself now...