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 { } }?> 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? 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' "; Link to comment https://forums.phpfreaks.com/topic/278902-sql-select-query-error/#findComment-1434713 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.