tk1 Posted February 18, 2007 Report Posted February 18, 2007 Sveiki.. Nu tā kods - <?php // Connecting, selecting database $link = mysql_connect('localhost', '...', '...') or die('Could not connect: ' . mysql_error()); echo ''; mysql_select_db('warezlv') or die('Could not select database'); // Performing SQL query $query = 'SELECT `member_name` FROM `ibf_sessions` ORDER BY `member_group` DESC LIMIT 0, 30'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Printing results in HTML echo "<table>\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n"; foreach ($line as $col_value) { echo "\t\t<td>$col_value</td>\n"; } echo "\t</tr>\n"; } echo "</table>\n"; // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); ?> Vinjs tagad izvada visus lietotājus kas iegājuši (vinju nikus), bet man vajadzētu lai izvada viņu kopējo skaitu...Kā to var dabūt gatavu??.. Jav iepriekš paldies!!! -TK*1
Kristabs Posted February 18, 2007 Report Posted February 18, 2007 (edited) // Performing SQL query $query = 'SELECT `member_name` FROM `ibf_sessions`'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); $nums = mysql_num_rows($result); $query = 'SELECT `member_name` FROM `ibf_sessions` ORDER BY `member_group` DESC LIMIT 0, 30'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Printing results in HTML echo "<p>Kopā: ".$nums."</p>"; echo "<table>\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n"; foreach ($line as $col_value) { echo "\t\t<td>$col_value</td>\n"; } echo "\t</tr>\n"; } echo "</table>\n"; // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); ?> Edited February 18, 2007 by Kristabs
Recommended Posts