Summary of php configuration problems when using php + Apache + myslq for programming, there is often a headache, that is, configuring the php. ini file .? Question 1: Fatalerror: Calltoundefinedfunctionmysql_connect () in... use & lt ;? Phpphpinfo ();? & Gt; print the information and check the summary of php configuration problems.
When using php + Apache + myslq for programming, it is often a headache to configure the php. ini file.
?
Problem 1: Fatal error: Call to undefined function mysql_connect () in...
First use Print out the information, and then check whether MYSQL-related options are available. if not, the PHP. INI configuration is incorrect. modify it!
?
Edit php. ini, find extension_dir, and change extension_dir = "E: \ Apache Software Foundation \ php-5.2.5-Win32 \ ext. Note that a single backslash is used, and the double quotation marks are used as a whole,
Note that each letter, including double quotation marks, cannot be fully enclosed by colons or spaces. Then remember to check that the php_mysql.dll file exists in your own directory .? Finally, in the script, note that each letter is half-width. You should also pay attention to the PHP startup method. you must call the php. ini you modified. also note that if it is APACHE + PHP, it is best to restart APACHE after php. ini is changed.
?
The above are some reference methods found on the internet. I am using the appserv installation package. the configuration in ini has been configured in advance, and you do not need to change it any more. unless you change it later, the above Red information will be displayed. Of course, if you are sure you haven't changed anything and the above problem still occurs, you can try to make the changes according to the provided method. basically, you can remove the annotation and path configuration. if not, add e: \ php \ ext to the path of the environment variable. e: \ php \ is the directory where you install php. If not, restart your computer.
?
? Question 2: mysql_fetch_object (): supplied argument is not a valid MySQL result resource
? The main problem is the parameter problem in the mysql_fetch_object () function. Most of them are SQL statement syntax problems. Check whether the SQL statement is empty and whether the syntax format is correct.
$userid=$_GET['userid'];$userid=trim($userid);$link=mysql_connect("localhost","root","root");mysql_query("set names 'gbk'");mysql_select_db(student);$sql="select * from stuinfo where userid='$userid'";$result=mysql_query($sql);while($rs=mysql_fetch_object($result)){$userid=$rs->userid;$password=$rs->password;$sex=$rs->sex;$city=$rs->city;$email=$rs->email;}
?
?
?
?
?