Skip to main content
Try this whole code...
Source Link
Dev
  • 62
  • 6

Yes you can do like this... but i guess the problem is in your second query and it has syntax problem... Try with this... $search2 = "SELECT a,b FROM DB WHERE x = ".$row['a']."

LIMIT 0 , 100";


$search = "SELECT a,b FROM DB WHERE x LIKE '$var' LIMIT 0 , 30";
$result = mysql_query($search, $connection);
if($result){
while ($row = mysql_fetch_array($result)){
echo $row["a"]." ".$row["b"]." ";
$search2 = "SELECT a,b FROM DB WHERE x = '".$row['a']."' LIMIT 0 , 100";
$result2 = mysql_query($search2, $connection);
if($result2){
while ($row2 = mysql_fetch_array($result2)) {
echo $row2["a"]." ".$row2["b"]." ";
}
} else {
echo "Subject search failed.";
echo mysql_error();
}
}
} else {
echo "Subject search failed. ";
echo mysql_error();
}

Yes you can do like this... but i guess the problem is in your second query and it has syntax problem... Try with this... $search2 = "SELECT a,b FROM DB WHERE x = ".$row['a']."

LIMIT 0 , 100";


$search = "SELECT a,b FROM DB WHERE x LIKE '$var' LIMIT 0 , 30";
$result = mysql_query($search, $connection);
if($result){
while ($row = mysql_fetch_array($result)){
echo $row["a"]." ".$row["b"]." ";
$search2 = "SELECT a,b FROM DB WHERE x = '".$row['a']."' LIMIT 0 , 100";
$result2 = mysql_query($search2, $connection);
if($result2){
while ($row2 = mysql_fetch_array($result2)) {
echo $row2["a"]." ".$row2["b"]." ";
}
} else {
echo "Subject search failed.";
echo mysql_error();
}
}
} else {
echo "Subject search failed. ";
echo mysql_error();
}

Source Link
Dev
  • 62
  • 6

Yes you can do like this... but i guess the problem is in your second query and it has syntax problem... Try with this... $search2 = "SELECT a,b FROM DB WHERE x = ".$row['a']."

LIMIT 0 , 100";