Re: simple issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm pretty new to this stuff myself but try this:

while ($row = $result->fetch_array())
{
 $compname=$row["CompanyName"];
 $conname=$row["ContactName"];
 echo "<tr><td>$compname</td>";
 echo "<td>$conname</td></tr>";
}




Chris Carter wrote:
my code:

<html>
<body>

<?
$username="chris";
$password="carter";
$database="chris_phpb1";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM phpbb_banlist";
$result=mysql_query($query);

if (!$result)
  {exit("Error in SQL");}
echo "<table><tr>";
echo "<th>Companyname</th>";
echo "<th>Contactname</th></tr>";
while (odbc_fetch_row($result))
{
  $compname=odbc_result($result,"CompanyName");
  $conname=odbc_result($result,"ContactName");
  echo "<tr><td>$compname</td>";
  echo "<td>$conname</td></tr>";
}
odbc_close($conn);
echo "</table>";
?>

</body>
</html>

My error:

Fatal error: Call to undefined function: odbc_fetch_row() in
/home/chandan/public_html/deb.php on line 19
Companyname	Contactname

Also .. I am trying this live on cPanel compiler coz I could not install the
PHP thing on my localhost. I have apache-tomcat-5.5.17 which works perfectly
with jsp files but I do not understand what does it take to run a php using
apache.

chris smith-9 wrote:
Chris Carter wrote:
Hi,

I am new to PHP, just trying a peace of code to access mySQL database to
fetch and show result on web page. But getting errors. Can you help me
with
this code please. Or if you have a very basic code where in I can do some
insertion in the database.
There are hundreds of mysql + php tutorials on the 'net - do a search in your preferred search engine.

If you *still* can't work it out post a sample of the code you're trying to use and the errors you get.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux