my environment:
=============== ============
-php ver 5.2.0
-mysql 5
-windows xp
-apache 2
-all of these are on the same machine
my code:
=============== ===========
<html>
<body>
<?php
echo "browsing users";
$conn=new mysqli("localho st","dba","mast erkey","tms");
if(mysqli_conne ct_errno()){
echo "Connection Error";
exit;
}
$query="select username from reg_user";
$result=$conn->query($query );
$num_results=$r esult->num_rows;
echo "<p>num of records found: ".$num_results. "</p>";
for($i=0; $i<$num_results ; $i++){
$row=$result->fetch_assoc( );
echo "<br/Username: ";
echo stripslashes($r ow['username']);
}
$result->free();
$conn->close();
?>
</body>
</html>
problem
=============== ===========
-if i run the code the only thing that shows is "browsing users".
-this line >echo "<p>num of records found: ".$num_results. "</p>"; <<
is not also showing up
-is there something wrong with my code...logic..o r syntax?
-or i wasnt able to obtain communication with mysql that's why nothing
appears. and if so, what have gone wrong why i cannot to mysql?
=============== ============
-php ver 5.2.0
-mysql 5
-windows xp
-apache 2
-all of these are on the same machine
my code:
=============== ===========
<html>
<body>
<?php
echo "browsing users";
$conn=new mysqli("localho st","dba","mast erkey","tms");
if(mysqli_conne ct_errno()){
echo "Connection Error";
exit;
}
$query="select username from reg_user";
$result=$conn->query($query );
$num_results=$r esult->num_rows;
echo "<p>num of records found: ".$num_results. "</p>";
for($i=0; $i<$num_results ; $i++){
$row=$result->fetch_assoc( );
echo "<br/Username: ";
echo stripslashes($r ow['username']);
}
$result->free();
$conn->close();
?>
</body>
</html>
problem
=============== ===========
-if i run the code the only thing that shows is "browsing users".
-this line >echo "<p>num of records found: ".$num_results. "</p>"; <<
is not also showing up
-is there something wrong with my code...logic..o r syntax?
-or i wasnt able to obtain communication with mysql that's why nothing
appears. and if so, what have gone wrong why i cannot to mysql?
Comment