|
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]
|