I have following code to connect MySQL and database.
I see 'connected to database',
I would like to know that which code do I need to show my data on the text
box?
Your help and information is great appreciated,
Regards,
Iccsi,
<?php
/*** mysql hostname ***/
$hostname = 'MyHost';
/*** mysql username ***/
$username = 'MyUser';
/*** mysql password ***/
$password = 'password';
try {
$dbh = new PDO("mysql:host=$hostname;dbname=iccsimd", $username,
$password);
/*** echo a message saying we have connected ***/
echo 'Connected to database';
}
catch(PDOException $e)
{
echo $e->getMessage();
}
$result = mysql_query("SELECT invid, invdate, note, amount FROM invheader");
//fetch tha data from the database
while ($row = mysql_fetch_array($result)) {
echo "ID:".$row{'invid'}." Inv Date:".$row{'invdate'}."Note: ". //display
the results
$row{'Note'}."<br>";
}
//close the connection
mysql_close($dbh);
?><br />
<body>
<table width="200" border="1">
<tr>
<td><input name="mytext" type="text" /></td>
<td> </td>
<td> </td>
</tr>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php