|
我想在RH8下测试apache+php+mysql 能否正常 运行!
首先我在apache 默认的存放文档的目录下面建立了test.php,内容如下。
<?php>
phpinfo();
?>
在URL中输入http://localhost/text.php
可以看到很多信息。
然后我在Mysql下建立了一个名为test 的库;
并将以下文件导入 test
create table employees ( id tinyint (4) default '0' not null
auto_increment,first varchar (20), last varchar (20), address varchar (255),
positon varchar (50), primary key (id), unique id (id));
insert into employees values (1,'Bob','Smith','128 Here St,
Cityname','Marketing Manager');
insert into employees values (2,'John','Roberts','45 There St,Townvila',
'Telephonist');
insert into employees values (3,'Brad','Johnson','1/34 Nowhere Blvd,Snowston',
'Doorman');
最后建立一个test2.php文件,如下
<html>
<body>
<?php
$dbname = "test";
$db = mysql_connect("localhost", "root", "password");
mysql_select_db("test",$db);
$result = mysql_query("select * from employees",$db);
printf("First Name: %s<br>\n", mysql_result ($result,0,"first"));
printf("Last Name: %s<br>\n", mysql_result ($result,0,"last"));
printf(" osition: %s<br>\n", mysql_result ($result,0,"position"));
?>
</body>
</html>
但在URL中输入http://localhost/test2.php确显示.
\n", mysql_result ($result,0,"first")); printf("Last Name: %s
\n", mysql_result ($result,0,"last")); printf(" osition: %s
\n", mysql_result ($result,0,"position")); ?>
请问各位高手,这是 怎么回事呀? |
|