hey guys,
I need your help for mysql query.let me tell you one thing, it's a dynamic query whatever the user selects in another page, those value will be set in mysql query.

The problem is that it's not giveing me any data from that query.
So Please give me a solution for it or give me some suggestions.

Thanks
Coding part one for fetching data from another page

<?php
error_reporting(0);
if((isset($_GET['filters'])))
{
	$hidn = $_GET['filters'];
}
else
{
	header("Location: serach-agent.php");
}
if((isset($_GET['seearchs'])))
{
	$dropd = $_GET['seearchs'];
}
else
{
	header("Location: serach-agent.php");
}

echo $hidn . ' And ' . $dropd;
?>

Coding part two for fetching data from database
problem occurs on line no. 39

<?php

//if($fnds == 1)
{

error_reporting(0);
echo '<table width="650" border="1.5" bgcolor="#D9EFC2">
  <tr>
    <th scope="col">Publisher Name</th>
    <th scope="col">Website</th>
    <th scope="col">Network</th>
    <th scope="col">comments</th>
    <th scope="col">Date</th>
	<th scope="col">Agent Name</th>
    <th scope="col">Action</th>
    
  </tr>';
// Connects to your Database
mysql_connect("localhost", "root", "") or die(mysql_error()); 
mysql_select_db("db") or die(mysql_error());

$first = 0;

$START=$_GET['start'];
if(!$START)
{
    $START=0;
}

$data = mysql_query("SELECT * FROM pubapp WHERE chked=1 and fpub=1 and achked!=1 ORDER BY date DESC") or die(mysql_error());
$total = mysql_num_rows($data);
echo $total;
$LIMIT = 4;
$NEXT=$START+$LIMIT;
$PREV=$START-$LIMIT;

$last = $total;   

$data_S = mysql_query("SELECT * FROM pubapp WHERE $hidn='$dropd' and chked=1 and fpub=1 and achked!=1 ORDER BY date DESC LIMIT $START,$LIMIT") or die(mysql_error());

while($info = mysql_fetch_array( $data_S ))
{
  
   
 
  if($info['fpub'] == '1' and $info['chked'] == '1')
  {
   	
	echo '<tr>';
    echo '<td>' . $info['pubname'] . '</td>';
    echo '<td>' . $info['site'] . '</td>';
    echo '<td>' . $info['netname'] . '</td>';
   	echo '<td>' . $info['comments'] . '</td>';
   	echo '<td>' . $info['date'] . '</td>';
	if($info['achked'] == '1')
	{
		echo '<td>' . $info['agentname'] . '</td>';
		echo '<td>&nbsp;</td>';
	}
	else
	{
		echo '<td>' . $info['agentname'] . '</td>';
		echo '<td><a href="ag_ed_req.php?ids=' . $info['id'] . '">' . 'Answer</a></td>';
	
	}
	
 	echo '</tr>';
	
  }
 /*  elseif($info['chked'] == '')
  {
  
  } */



}

if($START>0)
{
?>
<a href="?start=<?php echo $first;?>">First</a>&nbsp;&nbsp;
<a href="?start=<?php echo $PREV;?>">Prev</a>&nbsp;&nbsp;
<?php
}
if($NEXT<$total)
{
?>
<a href="?start=<?php echo $NEXT;?>">Next</a>&nbsp;&nbsp;
<a href="?start=<?php echo $last-10;?>">Last</a>&nbsp;&nbsp;
<?php    
}
echo '</table>';
}
?>
Member Avatar for iamthwee

I don't think you can just wack the variable $start into the string like that.

Consider echoing the mySQL query string, I'd wager it is wrong.

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.