Welcome Guest, Not a member yet? Register   Sign In
How to check if the user has the right privilege to install db in php
#1

[eluser]Wondering Coder[/eluser]
I know this might be the right forum to ask this but in the first place I've finished my first ever CI web app and now my adviser told me to create an installer. So here goes

First I want to show the mysql.user table that I query but unable to do this T_T. Then after this I will check if the particular user has enough privileges to create db and insert values. I have this code:
Code:
<?php
    $server_name=$_POST['server_name'];
    $user_name=$_POST['user_name'];
    $user_pass=$_POST['user_password'];
    $database_name=$_POST['database_name'];


    if(!empty($user_name)) {
        $query = "SELECT * FROM mysql.user WHERE user='".$user_name."' AND host='".$server_name."'";
        #print_r($query);
        $result = mysql_query($query);
        $row = mysql_fetch_array($result);

        echo $row['user'];
    }

and this gives me an error:
Code:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\dcs-pps\install\check_step3.php on line 34





Theme © iAndrew 2016 - Forum software by © MyBB