Can I use a syntax like mysql_fetch_array ($ SQL) [field name? I have already determined whether this record exists in the Database. Now I just want to retrieve the record in a field and write it in this way. $ is the syntax like $ username mysql_fetch_array ($ SQL Execution statement) [username field name? The output $ username is correct, because it is a beginner contact with PHP
Can I use a syntax like mysql_fetch_array ($ SQL) [field name? I have already determined whether this record exists in the Database. Now I just want to retrieve the record in a field and write it in this way. $ username = mysql_fetch_array ($ SQL Execution Statement) ['username field name'] Can I use this syntax? The output $ username is correct, because it is a beginner contact with PHP
Can I use a syntax like mysql_fetch_array ($ SQL) ['field name?
This record already exists in the Database
Now I just want to retrieve records from a field.
Is it appropriate to write this Code directly?
$ Username = mysql_fetch_array ($ SQL Execution statement) ['username field name'] Can I use this syntax?
The output $ username is correct. Many functions are not familiar with PHP since it is a beginner.
If you have better code, please highlight it. Thank you!
The complete code is as follows:
$ Defined ID = 88;
$ SQL = mysql_query ("select User Name field from table where ID = '$ defined id'", $ conn );
If (! Mysql_num_rows ($ SQL )){
$ Username = "empty ";
}
Else
{
$ Username = mysql_fetch_array ($ SQL) ['username field'];
}
Is there anything wrong with the above Code? Thank you very much for your simple and clear code!
------ Solution ----------------------
Yes, but php5.4 and above are required.
------ Solution ----------------------
Now mysqli is used more .... See http://www.jb51.net/article/28103.htm