Where there's a SQL query where the city has a note
Source: Internet
Author: User
Where there's a SQL query, there's a note.
Notice:use of undefined constant mytime-assumed ' mytime ' in/var/www/html/calsn/calresult.php on line 15
This is the last line (15 lines)
$query = "SELECT * from Empoloyee where empid= ' $empid '";
$result =mysql_query ($query) or Die (Mysql_error ());
$num =mysql_num_rows ($result);
if ($num >0)
{
$row =mysql_fetch_array ($result);
$mytime = $row [MyTime];
------Solution--------------------
$row [MyTime]
No quotes?
------Solution--------------------
Yes, the key names are quoted.
------Solution--------------------
Use of undefined constant mytime
With undefined constants, if the MyTime in $row[mytime] is missing, PHP will default as a constant, if the constant cannot find it as a string, but still throw a notice hint, although the effect is small, but the logic is a bit inconsistent, It also slightly affects a little bit of performance (although this point performance can be indifferent)
------Solution--------------------
$mytime = $row [' MyTime '];
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service