I need a small logic which i can't able to get here
i need to get MySQL data from db and echo on .php file before that i need to check whether data is available or not if available goto one.php file to show results if data not available retunt back to previos page i used below code but no use please help
<?php
$connection = mysql_connect('localhost','asd_asd','13wda121asSS') or die ("Couldn't connect to server.");
$db = mysql_select_db('asdasd_asds', $connection) or die ("Couldn't select database.");
$warno=$_POST['search'];
$data = 'SELECT * FROM `cases` WHERE `warno` = "'.$warno.'"';
if (mysql_num_rows($result)==0) { header('Location: http://asdas.in/wcdsa.php')
}
else
{
//We have no results and can't find the warranty, return a different page saying no warranty results exist
header('Location: http://asdsd.in/wcasd.php'); //redirect
}
?>
here i need
$data = 'SELECT * FROM cases WHERE warno = "'.$warno.'"'; $result = mysql_query($data,$connection); //execute query
i need to execute query in other page like results.php where i will show the results
if data not exist in database show "NO DATA FOUND" in same page where query executed itself please help on this