I don't know how to write the simplest query result statement, but now I only have space for PHP,
To create a function, you can easily,
There are two columns in the data table (A & B)
Implementation: I enter A value in the text box to query the value of column B corresponding to this value in column A in the database and return it to the page.
Yes... can you help me write a relatively complete off-the-shelf statement? Which includes the database connection statement
Reply to discussion (solution)
Error_reporting (0 );
$ Conn = mysql_connect ("localhost", "root", "root"); // enter the database connection information.
Mysql_select_db ("test"); // enter the database name
$ ValA = $ _ POST ["valA"];
If ($ valA! = ""){
$ SQL = "select * from test where a =". $ valA;
$ Result = mysql_query ($ SQL );
While ($ arr = mysql_fetch_array ($ result ))
{
Echo $ arr ["B"]."
";
}
} Else {
?>
}
?>
? Yes? Outsourcing, right? Don't you want? ?
You ?? What is the function ??, Hundred or Eighty? ? Someone? You have done it.
Error_reporting (0 );
$ Conn = mysql_connect ("localhost", "root", "root"); // enter the database connection information.
Mysql_select_db ("test"); // enter the database name
$ ValA = $ _ POST ["valA"];
If ($ valA! = ""){
$ SQL = "select * from test where a =". $ valA;
$ Result = mysql_query ($ SQL );
While ($ arr = mysql_fetch_array ($ result ))
{
Echo $ arr ["B"]."
";
}
} Else {
?>
}
?>
Thank you ~ Thank you very much.
? Yes? Outsourcing, right? Don't you want? ?
GA, I will use. net myself, but I have no choice but to know that the logic cannot be changed to php. I am here to ask for advice on php...
Error_reporting (0 );
$ Conn = mysql_connect ("localhost", "root", "root"); // enter the database connection information.
Mysql_select_db ("test"); // enter the database name
$ ValA = $ _ POST ["valA"];
If ($ valA! = ""){
$ SQL = "select * from test where a =". $ valA;
$ Result = mysql_query ($ SQL );
While ($ arr = mysql_fetch_array ($ result ))
{
Echo $ arr ["B"]."
";
}
} Else {
?>
}
?>
Echo $ arr ["B"], should B be replaced by the column name in my column?
Well, yes. a is replaced with your condition field name, and B is replaced with the field name you want to get the result.