dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: Warning: oci_fetch_array() expects parameter 1 to be resource, string given

  1. #1
    Join Date
    Sep 2013
    Posts
    5

    Unhappy Warning: oci_fetch_array() expects parameter 1 to be resource, string given

    Please help me to solve this problem. I couldn't understand the error. I read related article, but they show about boolean error, mine is string. Why is that happen? Pleaseee help me..

    PHP Code:
    <?php

    if(isset($_COOKIE['ID_site']) && isset($_COOKIE['Pass_site']))
     {
          
    $_SESSION['id'] = $_COOKIE['ID_site'];
          
    $_SESSION['password'] = $_COOKIE['Pass_site'];
     
           if(isset(
    $_SESSION['id']))
             {
             
    $id $_SESSION['id'];
             
    $pass $_SESSION['password'];
            
                    
    $query2 oci_parse($conn,"SELECT * FROM user1 WHERE id ='".$id."'")or die(oci_error());
            
    $check2 oci_execute($query2);
            
             while(
    $info2=oci_fetch_array(query2,OCI_ASSOC+OCI_RETURN_NULLS)) //the error is from this line
             
    {
            
    //if the cookie has the wrong password, they are taken to the login page
             
    if (($pass != $info2['PASSWORD']) || ($info2['ROLE'] != 'admin') )
                 {
                      
    header('Location: 1.php?error=4');
                 }
             
    //otherwise they are show the admin home
                   
    else
                 {
                                
    ?>

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    21,295
    Code:
    while($info2=oci_fetch_array($check2, OCI_ASSOC+OCI_RETURN_NULLS))
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Sep 2013
    Posts
    5
    OMG, I made a huge mistake. How can I not notice that I just missing the $ sign all this while?

    while($info2=oci_fetch_array($check2, OCI_ASSOC+OCI_RETURN_NULLS))


    admin pls remove this post. I'm too ashamed.

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    21,295
    We all tend to look for complicated reasons instead of the simple reasons when we get an error. It won't be the last time it happens to you.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles