Jump to content
Fórum Script Brasil
  • 0

Erro de script


Georits
 Share

Question

Não estou conseguindo desvendar um erro. Tenho o seguinte código:

$redirect = $_SESSION['PrevUrl']; 
$query = sprintf("SELECT login, pass_md5, gid, id FROM usuarios_incaper WHERE login='%s' AND pass_md5='%s'",$login,$pass_md5); 
$requestBD = mysql_query($query,$conn1) or die(mysql_errno()); 
$ok = mysql_num_rows($requestBD); 

if ($ok) 

$linha = mysql_fetch_assoc($requestBD); 
$_SESSION['aceito']=true; 
$_SESSION['gid']=$linha['gid']; 
$_SESSION['uid']=$linha['id']; 

 

O arquivo de conexão com o banco está da seguinte maneira?


   $user="usuario"
   $pass="senha"
   $host="host"

   $bd="nome"

   $conn1 = new mysqli($host, $user, $pass, $bd);
   if (mysqli_connect_errno()) trigger_error(mysqli_connect_error());

 

Alguém pode me ajudar?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Estás a misturar mysql com mysqli. Tenta assim:

<?php
    $redirect = $_SESSION['PrevUrl']; 
    $query = sprintf("SELECT login, pass_md5, gid, id FROM usuarios_incaper WHERE login='%s' AND pass_md5='%s'", $login, $pass_md5); 
    $requestBD = mysqli_query($query, $conn1) or die(mysqli_errno($conn1)); 
    $ok = mysqli_num_rows($requestBD); 
    
    if ($ok) 
    { 
        $linha = mysqli_fetch_assoc($requestBD); 
        $_SESSION['aceito'] = true; 
        $_SESSION['gid']= $linha['gid']; 
        $_SESSION['uid']= $linha['id']; 
    }
    

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.2k
×
×
  • Create New...