Dear All,,

My php page having a search query is not displaying the result when it is loaded...

But when i check this same query in php my admin it is working correctly...

for ex: If i search with the field "Marital Status" Single... There are totol 3 records having marital status "single", but the result will be getting only of 1...

The miracle is that when i test this same query in the php myadmin then i get the full 3 records.....

This means there is no prob in mysql_connection();
Please help me i am very confused!!!!!!!!!

Jino.

Code please.

This is the query

$query ="SELECT SQL_CALC_FOUND_ROWS * FROM reg_personal inner join reg_english_level inner join reg_services inner join reg_status ON(reg_personal.personal_code=reg_english_level.english_code AND reg_english_level.english_code=reg_services.services_code AND reg_services.services_code=reg_status.status_code)WHERE $query_string LIMIT 0, 30";

and it is working in php myadmin correctly and not working when the page is loaded!!!!!!

///echo statements are given below..

echo"
<tr>
<td width='503' height='19'><font face='Arial' style='font-size: 9pt'>
$row[personal_name];<b>($row[personal_code])</b>,$row[personal_present_address],Tel:&nbsp;$row[personal_phone], E-mail:
<a href='mailto:$email'><font color='#000000'>
$email</font></a>,<b>Joined&nbsp;$course_name1,$course_name2,$course_name3,&nbsp; at
$eng_date - Total Paid $total_paid/-. Balance $balance/- payment $payment_date.</b></font></td>
<td width='169' height='19'>
<font face='Arial' style='font-size: 10.5pt'><b>
<a href='registration-result-reports.php?id=$p_code'>Continue to Payment &gt;&gt;</a></b></font></td>
</tr>";


waiting for ur reply.!!!
Jino.

Hi jino, you are not returning your query. try adding this line directly after your query.

$result = mysql_query($query) or die(mysql_error());

and see if this works:)

Where is the while loop ? Let me show you an example.

$query="select * from table";
$result=mysql_query($query);
$row=mysql_fetch_array($result); //This will fetch only 1 record
echo $row['name'];
...
//to fetch all the records, loop through it.
while($row=mysql_fetch_array($result)){
echo $row['name'];
....
}

Well, thats the way to fetch all the records.

Thank u nav....
As it was a very big coding.. i hardly noticed that

Thank u once more..
chears....

You are welcome :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.