![]() |
|
#1
|
|||
|
|||
PHP MySQL queryI'm a PHP/MySQL Newbie. Just created a database and among other things, I would like to display the number or records in MyTable on the Webpage. Here is what I'm trying but its returning an error. I have other parts of the code that create the connection to the database and another variable, $result which is pulling out the database contents fine.
PHP Code:
OK where do I go wrong? Last edited by JdS : 06-Apr-2004 at 07:27.
Reason: Please enclose PHP code in [php] & [/php] for syntax highlighting
|
|
#2
|
||||
|
||||
|
Hello jgnasser,
Try not to use function names as column/field/alias names... Try using a different ALIAS in your SQL, perhaps; PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
|||
|
|||
|
Actually I used the index and it worked. does mysql_fetch_assoc work like mysql_fetch_array?
Quote:
|
|
#4
|
||||
|
||||
|
mysql_fetch_array() allows you to access both, the array numerically indexed like $row[0], $row[1] or via the column names (associative index) i.e. $row['a'], $row['ttl'] etc. Of course you can use the CONSTANTS available for this function to refine the results either way.
mysql_fetch_row() and mysql_fetch_assoc() does only one or the other (numerical or associative). __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
A Week in Kuwait by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Free Web, Emal, PHP, MySQL Host | avida | Free Web Hosting | 4 | 28-Dec-2006 15:33 |
| PHP, MySQL, WML | skyloon | MySQL / PHP Forum | 0 | 05-Mar-2004 07:53 |
| FREE 25 MB, No Ads, Control Panel, ASP, ColdFusion, PHP, MySQL, Access Hosting | rkmails | Free Web Hosting | 0 | 08-Sep-2003 05:49 |
| [script] Password Protect web pages/site using PHP and MySQL | JdS | PHP Code Library | 0 | 23-Jul-2003 10:02 |
| Windows: From only £20p/y,Linux: from $10p/m. ASP, ASP.NET, PHP, Free MySQL, +More | EyotaHosts | Web Hosting Advertisements & Offers | 0 | 28-Jun-2003 13:54 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The