note 68549 added to function.mysql-fetch-row

From: Date: Tue, 01 Aug 2006 16:15:26 +0000
Subject: note 68549 added to function.mysql-fetch-row
Groups: php.notes 
Request: Send a blank email to php-notes+get-115418@lists.php.net to get a copy of this message
This took me a little time to find out, so I'm sharing it :) if you do something like this: <?php // needed data $server = 'anyserver'; $username = 'aniceusername'; $password = 'ihopenotsoeasy' $database = 'clients'; // ------ $con = mysql_connect($server, $username, $password); mysql_select_db($database , $con); // --- I'll do two simple examples of the same thing $query_a = "SELECT COUNT(client_id) FROM clients"; $query_b = "SELECT count(client_id) FROM clients"; $result_a = mysql_query($query_a); $result_b = mysql_query($query_b); // You can acces data like this $row_a = mysql_fetch_array($result_a); $row_b = mysql_fetch_array($result_b); // now you can work directly with the result // NOTE, the mysql_fetch_array's function index is case sensitive, // so be carefull echo $row_a['COUNT(client_id)']; echo $row_b['count(client_id)']; ?> ---- Server IP: 66.163.161.117 Probable Submitter: 200.88.42.27 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-row.php Edit -- https://master.php.net/note/edit/68549 Del: integrated -- https://master.php.net/note/delete/68549/integrated Del: useless -- https://master.php.net/note/delete/68549/useless Del: bad code -- https://master.php.net/note/delete/68549/bad+code Del: spam -- https://master.php.net/note/delete/68549/spam Del: non-english -- https://master.php.net/note/delete/68549/non-english Del: in docs -- https://master.php.net/note/delete/68549/in+docs Del: other reasons-- https://master.php.net/note/delete/68549 Reject -- https://master.php.net/note/reject/68549 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#115418) next »