Re: Problems getting data out from the database

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

 



Is it displaying the no. of rows
from the line

echo "$numOfRows <br>";//return num of rows


2ndly try using this:

echo $row['choice'];
///or it may be echo $row['ans.choice'];


3rdly you should also use
if($numoflRows>0)
{
   //print the data

}
else
{
          echo "no records ";

}
i hope this wil help u out

regards umeed



Micah Stevens wrote:


Do you get error messages? Try this:

<? $host='localhost'; $username='root'; $password='asd'; $connection = mysql_connect($host,$username,$password) or
die(mysql_error());
mysql_select_db("testing") or die(mysql_error());

$ans = mysql_query ("select ans.choice from ans, info where info.choice=ans.value;") or die(mysql_error());

$numOfRows = mysql_num_rows ($ans); $row = mysql_fetch_array($ans);

echo "$numOfRows <br>";//return num of rows echo $row["ans.choice"]; ?>

On Wednesday 17 August 2005 1:40 am, Chin Yan Yan wrote:
I had try using the fetch arrays things or the fetch rows but it nv show
anything out. The ans and info are two different table but in the same
database. Below is the coding.

<?
$host='localhost';
$username='root';
$password='asd';
$connection = mysql_connect($host,$username,$password);
mysql_select_db("testing");

$ans = mysql_query ("select ans.choice from ans, info where
info.choice=ans.value;");

$numOfRows = mysql_num_rows ($ans);
$row = mysql_fetch_array($ans);

echo "$numOfRows <br>";//return num of rows
echo $row["ans.choice"];
?>

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