mysqli_connect问题 [英] mysqli_connect problem

查看:88
本文介绍了mysqli_connect问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的登录脚本;

<?php
$username = $_POST['username']; //kullanici adi
$password = $_POST['password']; //parola
$msg ='';
if(isset($username, $password)) {
    ob_start();
    include('ayar.php');
    // güvenlik amaçli sql injection önlemek için sinirlama koy
    $dbC = mysqli_connect($vthost, $vtkullanici, $vtsifre, $vtadi)
    or die('Veritabanina baglanilamadi');
    $myusername = stripslashes($username);
    $mypassword = stripslashes($password);
    $myusername = mysqli_real_escape_string($dbC, $myusername);
    $mypassword = mysqli_real_escape_string($dbC, $mypassword);
    $sql="SELECT * FROM login_admin WHERE user_name='$myusername' and user_pass=SHA('$mypassword')";//SHA çöz
    $result=mysqli_query($dbC, $sql);
    // kayit kontrol et
    $count=mysqli_num_rows($result);
    // kayit eslemesi kontrol et
    if($count==1){
        // esmeleme varsa oturum aç ve yönlendir 
        session_register("admin");
        session_register("password");
        $_SESSION['name']= $myusername;
        header("location:raporla.php");
    }
    else {
        $msg = "Yanlis kullanici adi yada parola";
        header("location:index.php?msg=$msg");
    }
    ob_end_flush();
}
else {
    header("location:index.php?msg=Kullanici adi yada parola girmediniz");
}
?>

中的

我有主机,用户名等.那里没有问题.但是问题在于,它在本地主机和任何其他主机上都运行良好,但在此主机上却无法运行.这是服务器错误日志中显示的内容.

in ayar.php I have host, username etc. There is no problem up there. But the problem is that it's working great on local and any other host but not on this one. Here is the what server error log says.

[11-Jun-2011 02:01:26] PHP Fatal error:  Call to undefined function  mysqli_connect() in /home/bankalar/public_html/rapor/giris.php on line 9

mysqli_connect().我已经在我的php conf上搜索了这个模块.但是,没有这样的人.任何的想法?

mysqli_connect(). I've searched for this module on my php conf. But there's no such one. Any idea?

推荐答案

在您的 php.ini (在Windows下)中,您应该具有以下几行:

In your php.ini (this under Windows) you should have the lines:

...
;extension=php_ming.dll
;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
...

确保已将mysqli注释掉(删除;之前)

be sure to have the mysqli commented out (remove the ; before)

,如@datasage所指出的,如果您正在运行Linux发行版,则行的名称将有所不同,例如:

as pointed out by @datasage if you're running a Linux distro lines will have a different naming, like:

;   extension=msql.so
;
; ... or with a path:
;
;   extension=/path/to/extension/msql.so

如果您位于共享主机上,并且无法访问php.ini,建议您将它们放一行并要求将其启用.

If you are on a shared hosting and can't access the php.ini, I suggest you drop them a line and ask to have it enabled.

如果您有私有服务器,并且没有安装mysqli扩展名,请遵循php手册说明此处以获取有关如何安装它的指南.

If you have a private server, and don't have mysqli extension installed, follow the php manual instruction here for a guide on how to install it.

否则,您可能要使用 PDO 类(位于自php 5.1以来的dafault安装),它甚至比mysqli都具有很大的优势,对确保数据库的安全性确实很有用.

Otherwise, you might want to use the PDO class (which is in the dafault installation since php 5.1), which has big advantages even over mysqli and it's really useful to make safer your database.

这篇关于mysqli_connect问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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