This is my code. I know this number(02177736) is stored in database. I'm completely new in php and mysql.
$sqll="SELECT * FROM netbarg WHERE r_number='02177736'";
$result=mysql_query($sqll,$connection);
$ro= mysql_fetch_array ($result);
var_dump($ro);
but it returns false to me. I have no idea. Any help will be appreciated.
You should check for errors and report them, eg
$sqll="SELECT * FROM netbarg WHERE r_number='02177736'";
$result=mysql_query($sqll,$connection);
//check for errors!
if (!$result) {
die('Invalid query: ' . mysql_error());
}
$ro= mysql_fetch_array ($result);
var_dump($ro);
Also, you should using something other than the mysql_ functions as are deprecated - see http://php.net/manual/en/mysqlinfo.api.choosing.php
User mysqli_query insted of mysql_query and the first pass connection and then your query.
$sqll="SELECT * FROM netbarg WHERE r_number='02177736'";
$result=mysqli_query($connection,$sqll);
//check for errors!
if (!$result) {
die('Invalid query: ' . mysqli_error());
}
$ro= mysqli_fetch_array ($result);
var_dump($ro);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.