Φωτογραφία Βασίλειος Καπελέρης
Απάντηση: Ζήτημα Β2
από Βασίλειος Καπελέρης - Sunday, 27 May 2012, 6:47 AM
 
Τελικά βρήκα τι έκανα λάθος...

<?php

DEFINE('DB_HOST','localhost');
DEFINE('DB_USER','root');
$lch = @mysqli_connect(DB_HOST,DB_USER,NULL);
if($lch == TRUE )
{
print "the connection to the server was successful<br/>";
print "<br/>";
}else
{
print "the connection to the server was not successful<br/>";
print "<br/>";
@mysqli_connect_error();
}

DEFINE('DB_NAME','azulmediadb');
$dbc = @mysqli_select_db($lch,DB_NAME);
if($dbc == TRUE){
print "the connection to the database was successful<br/>";
print "<br/>";
}else
{
print "the connection to the database was not successful<br/>";
print "<br/>";
}

$q = "SELECT*FROM style";
$results = @mysqli_query($lch,$q);

if($results) {
$rows = @mysqli_num_rows($results);
print "There are $rows rows/records in the database<br/>";
print "<br/>";
}else{
print "there was an error with the execution of the SQL Query<br/>";
print "<br/>";
}

while($retrec = @mysqli_fetch_array($results,MYSQLI_ASSOC))
{
$id = $retrec['id'];
$color = $retrec['color'];
$url = $retrec['URL'];
}

?>

Το αποτέλεσμα που μου βγάζει τώρα είναι...

the connection to the server was successful

the connection to the database was successful

There are 3 rows/records in the database