satbir Posted June 7, 2013 Share Posted June 7, 2013 coding below is not working for selecting data from mysql ______________________________________________ <?php $name=$_REQUEST['name']; $password=$_REQUEST['password']; $connect=mysql_connect('localhost','root','') or die("Error to Connect Database"); if ($connect) { mysql_select_db('dental',$connect) or die("Error in DB Select"); $qury="select * from admin where name=$name"; $run=mysql_query($qury, $connect) or die("error in sql query"); $count=mysql_num_rows($run) or die ("error in rows"); if ($count == 1) { $rows=mysql_fetch_assoc($runQury); if ($rows['password'] == $password) { header("location:adminarea.php"); } else { header("location:welcome.php"); } } else { } }?> Quote Link to comment https://forums.phpfreaks.com/topic/278902-sql-select-query-error/ Share on other sites More sharing options...
Philip Posted June 7, 2013 Share Posted June 7, 2013 Where is $runQury being defined? Did you mean $run? Quote Link to comment https://forums.phpfreaks.com/topic/278902-sql-select-query-error/#findComment-1434696 Share on other sites More sharing options...
Barand Posted June 7, 2013 Share Posted June 7, 2013 and if $name is a string value it needs to be in single quotes $qury="select * from admin where name='$name' "; Quote Link to comment https://forums.phpfreaks.com/topic/278902-sql-select-query-error/#findComment-1434713 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.