$q=mysql_querry('SELECT * from table')
$qf = mysql_fetch_array;
while($data =$qf){echo $qf['email']."" $qf['time']; }
так цикл получается бесконечным, а нужно вывести все значения в построенную таблицу,
как сделать проще?
$q=mysql_querry('SELECT * from table')
$qf = mysql_fetch_array;
while($data =$qf){echo $qf['email']."" $qf['time']; }
$q=mysql_query('SELECT * from table');
if(mysql_num_rows($q)){
while($row = mysql_fetch_assoc($q)){echo $row['email']."" $row['time']; }
}
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
/* Create table doesn't return a resultset */
if ($mysqli->query("CREATE TEMPORARY TABLE myCity LIKE City") === TRUE) {
printf("Table myCity successfully created.\n");
}
/* Select queries return a resultset */
if ($result = $mysqli->query("SELECT Name FROM City LIMIT 10")) {
printf("Select returned %d rows.\n", $result->num_rows);
/* free result set */
$result->close();
}
/* If we have to retrieve large amount of data we use MYSQLI_USE_RESULT */
if ($result = $mysqli->query("SELECT * FROM City", MYSQLI_USE_RESULT)) {
/* Note, that we can't execute any functions which interact with the
server until result set was closed. All calls will return an
'out of sync' error */
if (!$mysqli->query("SET @a:='this will not work'")) {
printf("Error: %s\n", $mysqli->error);
}
$result->close();
}
$mysqli->close();
?>