Jump to content

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


udaystrad
Go to solution Solved by 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
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....?????

 

Edited by udaystrad
Link to comment
Share on other sites

  • Solution

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.