Can anyone tell me why this ph code will not return anything when the value of $dbaccno is grater than 999?
//Retrive Members account information from accinfo table
$query = mysql_query("Select * FROM accinfo WHERE AccNumber ='$dbAccNumber' LIMIT 3000");
$numrows = mysql_num_rows($query);
if($numrows >0)
{
while ($row = mysql_fetch_assoc($query))
{
$dbname=$row['Name'];
$dbaccno=$row['AccNumber'];
$dbAccbal=$row['AccountBalance'];
$dbpay=$row['Lastpaid'];
$dbpaydate=$row['Lastdatepaid'];
$dbreading=$row['reading'];
$dbreaddate=$row['readingdate'];
$dbprvread=$row['prevreading'];
$dbusage=$row['usage'];
20950Cannot get your information at this time
9991THIS INFORMATION DOES NOT REFLECT ANY TRANACTIONS AFTER 14TH OF MAY
2095 & 999 are echo of $dbAccNumber
0 & 1 are echo of $numrows
following is the entire php file
<?php
//.$_SESSION ['username'].
//set variable values = to user login form entries
$username=$_POST['username'];
$number=$_POST['accnumber'];
$password=strip_tags($_POST['password']);
//encrypt password
$password=md5($password);
//require entery in all fields
if ($username&&$password&&$number)
{
//connect to database
$connect = mysql_connect("localhost","rwd_job","******") or die("Couldn't connect");
mysql_select_db("rwdnotwo_accinfo") or die ("Couldn't find database");
//Retrive Members user name & password & account number from users table
$query = mysql_query("Select * FROM users WHERE password ='$password' AND username='$username'");
$numrows = mysql_num_rows($query);
if($numrows >0)
{
while ($row = mysql_fetch_assoc($query))
{
$dbusername=$row['username'];
$dbpassword=$row['password'];
$dbAccNumber=$row['AccNumber'];
$dbemail=$row['email_address'];
}
//check to see if they match
if($username==$dbusername)
{
if($number==$dbAccNumber)
{
if($password==$dbpassword)
{
//Retrive Members account information from accinfo table
echo $dbAccNumber;
$query = mysql_query("Select * FROM accinfo WHERE AccNumber ='$dbAccNumber' LIMIT 3000");
$numrows = mysql_num_rows($query);
echo $numrows;
if($numrows >0)
{
while ($row = mysql_fetch_assoc($query))
{
$dbname=$row['Name'];
$dbaccno=$row['AccNumber'];
$dbAccbal=$row['AccountBalance'];
$dbpay=$row['Lastpaid'];
$dbpaydate=$row['Lastdatepaid'];
$dbreading=$row['reading'];
$dbreaddate=$row['readingdate'];
$dbprvread=$row['prevreading'];
$dbusage=$row['usage'];
}
//Print account information to screen
echo "THIS INFORMATION DOES NOT REFLECT ANY TRANACTIONS AFTER 14TH OF MAY";
echo "<br>";
echo "<br>";
echo "Account Name ";
echo $dbname;
echo "<br>";
echo "Account Balance " ;
echo $dbAccbal;
echo "<br>";
echo "Last Payment " ;
echo $dbpay;
echo" Date ";
echo$dbpaydate;
echo "<br>";
echo " Latest Reading " ;
echo $dbreading;
echo "00 Date " ;
echo $dbreaddate;
echo "<br>";
echo "Previous Reading " ;
echo $dbprvread;
echo"00";
echo "<br>";
echo "Usage " ;
echo $dbusage;
echo "<br>";
echo "<br><a href='login.php'>Click here to return to Login</a>";
}
else
echo "Cannot get your information at this time<br><a href='accinfo.html'>Click here to return to Login</a>";
echo $dbAccno;
}
else
echo "Incorrect password!<br><a href='accinfo.html'>Click here to return to Login</a>";
}
else
echo "Account Number does not match username!<br><a href='accinfo.html'>Click here to return to Login</a>";
}
else
echo "Incorrect Username!<br><a href='accinfo.html'>Click here to return to Login</a>";
}
else
echo "Please reenter your Account Number, UserName & Password <br><a href='accinfo.html'>Click here to return to Login</a>";
}
else
echo "Please enter your Account Number, UserName & Password !<b r><a href='accinfo.html'>Click here to return to Login</a>";
?>
I have acc number to 2780, can get variable values for any account up to # 999, above get nothing with no error message. Not sure what LIMIT does.
should i be using mysql_fetch_array($query)) instead of mysql_fetch_assoc($query))?
thanks fory your reply
So, your query returns 0 rows.
Try to run the query manually in PHPMyAdmin, putting the account number where the variable is, and see if it returns anything.
My guess is there aren’t any rows in accinfo for that account number.
Welcome to the SP forums 
Can anyone tell me why this ph code will not return anything when the value of $dbaccno is grater than 999?
Because there are no account numbers greater than 999?
You could do an echo of $numrows to see if anything is returned. And also an echo of $dbAccNumber to see if it contains the value you expect it to have.
It limits the number of rows returned by the query to a max of 3000 rows.
should i be using mysql_fetch_array($query)) instead of mysql_fetch_assoc($query))?
No.
Did you try to echo the two variables as I asked you to? Please post the results here.