You are here: Re: Getting results from MySQL Database in PHP « PHP Programming Language « IT news, forums, messages
Re: Getting results from MySQL Database in PHP

Posted by C. on 05/11/07 21:46

On 11 May, 22:39, christopher_bo...@yahoo.co.uk wrote:

> <?php
> function connectDatabase() {
> $dbhost = 'localhost';
> $dbuser = 'root';
> $dbpass = 'password';
> $db = @mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error
> connecting to mysql');
> echo 'connected';
> $dbname = 'pmoneytest';
> mysql_select_db($dbname);}
>
> echo '
> <form action="#" method="POST" FormName="FormName">
> <title>Test ResultSet Database</TITLE>
> <BODY>
> <B>Hello World</B><B><I> How are you today?</B></I>
> </BODY>
> ';
>
> connectDatabase();
> echo "<table border = '1'>";
> for ($x = 0; $x < $db->m_numRows; $x++) {
> $row = $db->getRow();
> echo
> "<TR><TD>" . $row['first'] . "</td><td>";
> }
>
> ?>
>

$db is out of scope at the time of the call to getRow, you're mixing
up mysql and mysqli commands, and you've not executed any query on the
database. Throw this in the bin, RTFM and start again.

C.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация