MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 27th, 2014, 09:03 AM
Ezkiel Ezkiel is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2014
Posts: 1 Ezkiel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 24 sec
Reputation Power: 0
MySqli errors

Hi everyone,
I can’t understand what happens… When I try my site in WAMP, I have the follow errors:

Deprecated: mysql_query(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO (…)

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in (…)


The same happened with the connect to mysql, but I solved using mysqli extension. But in this case is totally diferent. When I use the mysqli_query or mysqli_num_rows that are the alternatives presented I receive again other error, in PHP Manual says: "function.mysqli-query doesn't exist. Closest matches:"

Someone know solve this problem???


using MySQL


PHP Code:
<?php
session_start
();
if (isset(
$_SESSION["manager"])){
    
header("location:index.php");
    exit();
}
?>
<?php
if(isset($_POST["username"])&&isset($_POST["password"])){
    
    
$manager=preg_replace('#[^A-Za-z0-9]#i','',$_POST["username"]);
    
$password=preg_replace('#[^A-Za-z0-9]#i','',$_POST["password"]);
    
    
    
$cnn= include "../lojascript/connect_mysql.php";
    
$sql=mysql_query($cnn"SELECT id FROM admin WHERE username='$manager' AND password='$password' LIMIT 1");
    
    
$existCount=mysql_num_rows($sql);
    if (
$existCount==1){
        while (
$row mysqli_fetch_array($sql)){
        
$id=$row["id"];
    }
    
$_SESSION["id"]=$id;
    
$_SESSION["manager"]=$manager;
    
$_SESSION["password"]=$password;
    
header("location:index.php");
    exit();
  }else {
    echo 
'Informação incorrecta <a href="index.php"> Click here</a>';
    exit();
    }
}
?>


Using MySQLi
PHP Code:
<?php
session_start
();
if (isset(
$_SESSION["manager"])){
    
header("location:index.php");
    exit();
}
?>
<?php
if(isset($_POST["username"])&&isset($_POST["password"])){
    
    
$manager=preg_replace('#[^A-Za-z0-9]#i','',$_POST["username"]);
    
$password=preg_replace('#[^A-Za-z0-9]#i','',$_POST["password"]);
    
    
    
$cnn = include "../lojascript/connect_mysql.php";
    
$query"SELECT id FROM admin WHERE username='$manager' AND password='$password' LIMIT 1";
    
$resultmysqli_query($cnn,$query) or die(mysqli_error());
    
$num_row mysqli_num_rows($result);
     
    if (
$num_row==1)
    {
    while (
$row mysqli_fetch_array($result)){
        
$_SESSION["id"]=$row["id"];
    }
    
    
    
$_SESSION["id"]=$id;
    
$_SESSION["manager"]=$manager;
    
$_SESSION["password"]=$password;
    
header("location:index.php");
    exit();
  }else {
    echo 
'Informação incorrecta <a href="index.php"> Click here</a>';
    exit();
    }
}
?>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > MySqli errors


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap