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
    19,220
    Code:
    while($info2=oci_fetch_array($check2, OCI_ASSOC+OCI_RETURN_NULLS))
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  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
    19,220
    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.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

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