Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in C:\xampp\htdocs\pbs\public_html\init.php on line 6

What I have tried:

PHP
<?php 
ob_start();
session_start();
$tabMessage = "PBS";
mysqli_connect("localhost","root","");
mysqli_select_db($tabMessage, "pbsorgpk_pbs");
//mysql_connect("localhost","root","");
//mysql_select_db("ws_pbs");


function checkUser($id)
{
    $Q="SELECT user_id FROM pbs_user WHERE user_id='$id'";
    $myQ=mysql_query($Q);
    $myRows=mysql_num_rows($myQ);
    
    if($myRows<1)
    {
        unset($_SESSION["identy"]);
        header('Location: index.php');
        exit();
    }
}

$securitycode='DT53)GNe{~,wd`/-';
$CAPTCHA_SECRET='6LfKHRQUAAAAANJzAy_zmS1vfIXIyX3ywu0ytqKu';
$CAPTCHA_SITEKEY='6LfKHRQUAAAAABD96PoyeYlF57eGaPKJ7uyQkKRQ';

?>
Posted
Updated 23-Jul-21 10:03am
v3

1 solution

Read the documentation: PHP: mysqli::select_db - Manual[^] it includes example code ...
 
Share this answer
 
Comments
Sajid Imdad 23-Jul-21 15:06pm    
Would you please correct the above coding?
OriginalGriff 23-Jul-21 15:10pm    
No, because you wouldn't learn anything from the exercise if I did.
This is your homework, not mine - and it's pretty trivial if you look at the documentation link I gave you and try to understand what the code is doing and why.

This isn't complicated, but it is something you will be doing a lot on this course - so it's worth your time learning how to do it instead of guessing and hoping as you are at the moment ...
Sajid Imdad 23-Jul-21 15:13pm    
I have been moving my website from static to wordpress. I am trying to using backup of my website for taking content through xampp, local hosting. Just want this little help that localhost can be configured correctly for above purpose. Otherwise thank you very much for productive input.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900