代码停止在mysql_connect上执行( [英] Code stops executing at mysql_connect(

查看:73
本文介绍了代码停止在mysql_connect上执行(的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好


我是PHP和MySQL的新手,所以请放轻松我!


以下是一个简单的PHP脚本连接到我的服务器。 MySQL服务正在运行。显示第一个echo语句,但第二个从不显示。对我而言,这意味着我与数据库服务器的连接正在挂起,但我不知道该看什么。我甚至没有收到错误,只显示第一条消息,第二条消息从未出现。


< html>

< head> ;< title>创建数据库和表< / title>< / head>

< body>


<?php


echo" Before";

$ linkID = mysql_connect(" localhost"," martin"," martin");

echoAfter;


?>

< / body>

< / html>

Hi All

I am new to PHP and MySQL, so please go easy on me!

The following is a simple PHP script to connect to my server. The MySQL service is running. The first echo statement displays, but the second one never displays. To me it implies that my connection to the database server is hanging, but I''m not sure what to look at. I don''t even get an error, it just displays the first message and the second message never appears.

<html>
<head><title>Create Database and table</title></head>
<body>

<?php

echo "Before";
$linkID = mysql_connect("localhost","martin","martin");
echo "After";

?>
</body>
</html>

推荐答案

linkID = mysql_connect(" localhost"," martin"," martin");

echo" After";


?>

< / body>

< / html>
linkID = mysql_connect("localhost","martin","martin");
echo "After";

?>
</body>
</html>


尝试更改第二个参数(用户名)罗伯特 toroot。


Shaffer。
Try changing the second parameter (username) "Robert" to "root".


Shaffer.


有很多很好的教程。
http://www.freewebmasterhelp.com/tutorials/phpmysql


在上面的代码中,您要求连接到数据库,但只提供位置,用户和通行证。不再要求了,没有询问。


阅读一些教程。我自己是PHP和MySQL的新手,他们帮助我加载。


我仍​​然有错误,这就是这个论坛非常有帮助的地方。


祝你好运
There are many good tutorials out there.

http://www.freewebmasterhelp.com/tutorials/phpmysql

In your above code you are asking to connect to a DB but only supplying the location, user and pass. Not asking for anymore, no query.

Read up on some of the tutorials out there. I myself am new to PHP and MySQL and they have helped me loads.

I still have errors and that is where this forum has helped tremendously.

Good Luck


这篇关于代码停止在mysql_connect上执行(的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆