Jump to content

not able to retrieve data...pls help...


udaystrad

Recommended Posts

Got stuck with some coding..

the same sort of code is working somwhere else .....but not able to trace why this isnt workin?

 

 

Here's the code...

 

 
<?php
 
$host="localhost"; // Host name 
$username="root"; // Mysql username 
$password="india123"; // Mysql password 
$db_name="test"; // Database name
$members="members";
$mid=009;
$sa="Potekar";
 
$sql="sdadsaasd";
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");
 
 
$then=mysql_query("SELECT * FROM $members WHERE MID='$mid' and Surname='$sa'");
$array = mysql_fetch_array($then);
$count=mysql_num_rows($array);
 
 
if (!$array) {
    echo "$sql<br>" . mysql_error();
}
 
else {
    // check if any records found
    if ($count==0) {
        echo "No matching records<br>";
    }
    else {
         
 $ra="sid";
        $sid=$array['FirstName'];
        echo $sid.'<br/>';    
    echo $ra;
 
}
}
 
 
?>
Link to comment
https://forums.phpfreaks.com/topic/284042-not-able-to-retrieve-datapls-help/
Share on other sites

  • phpMyAdmin 2.11.11.3 

NO errors

 

i think i m not able to retrieve data at selection of table....

i want it to retrieve data n display it out

 

there has to be somethin in the array i dont kno y its not showing n giving output ....

sdadsaasd

 

even if i manage to get smethin in array...

the count should cum 1.... which is 0 as it enters that loop and gives output....

 

no matching records

 

both of which are wrong.... is it syntax error .... or what i m not able to trace it out....?????

 

k. i did find the mistake. i jus had to place the value in inverted comas ie

$mid='009';

as the value insterd in the table was text value.

 

Error reporting was already ON and like i said so there were no errors from the code.

 

thank you for the help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.