Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Wamp phpmyadmin

  1. #11
    Join Date
    Mar 2011
    Posts
    2,145
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default

    Also it's coming up with this

    ( ! ) Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\Documents and Settings\Owner\Desktop\canberra amatuer productions\www\Canberra Amatuer Productions\member.php on line 88
    Call Stack
    # Time Memory Function Location
    1 0.0082 383600 {main}( ) ..\member.php:0
    2 0.0146 393384 mysql_fetch_array ( ) ..\member.php:88


    On this page

    PHP Code:
    <?php 

     mysql_connect
    ("localhost""****""****") or die(mysql_error()); 
     
    mysql_select_db("****") or die(mysql_error()); 
     

     if(isset(
    $_COOKIE['ID_my_site'])) 
     { 
         
    $username $_COOKIE['ID_my_site']; 
         
    $pass $_COOKIE['Key_my_site']; 
              
    $check mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); 
         while(
    $info mysql_fetch_array$check ))      
             { 
     

             if (
    $pass != $info['password']) 
                 {             
    header("Location: login.php"); 
                 } 
     
         
         else 
                 { 
                   

                 } 
             } 
             } 
     else 
     

     {             
     
    header("Location: login.php"); 
     } 
     


    $links "link2.php";




    ?>

    <?php 

     mysql_connect
    ("localhost""****""****") or die('could not connect to database'); 
     
    mysql_select_db("****") or die('Could not select database');

    if (isset (
    $_POST['submit'])) 
    {
        
    $comment nl2br(mysql_escape_string (trim ($_POST['comment']))); 

    $quantity $_POST['quantity'];
    $item $_POST['item'];

    $cheese =  "$username  - $comment  ";



    $sql mysql_query ("INSERT INTO comments (id,comments) VALUES ('0','".$cheese."')");
        
        echo 
    'Your comment has been entered successfully!';
        echo 
    '<a href="member.php">Please click here</a>';
            

        
    else 
    {


    ?>


    <html>
    <head>
    <body style="background-color:lightgreen">
    </head>
    <body>
    <?php include("$links"); 
    echo 
    "Hey ".$username;
    ?>  
    <br /><br />
    <p><b>COMMENTS</b></p>
    <?php
        
    // POST data wasnt entered, so display the comments and comment form 
        // view comments from database
           
    $sql mysql_query ("SELECT * FROM comments");
           while (
    $row mysql_fetch_array ($sql)) {
           echo 
    $row['comments'].'<br />';
    }



        echo 
    '<br /><br />
        <form action="member.php" method="post">
        Comments:<br />
        <textarea name="comment" cols="40" rows="7"></textarea>
        <input type="submit" value="Submit" name="submit">
        </form>'
    ;
    }
    ?>
    </body>
    </html>
    Any help would be great

  2. #12
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    There are actually two php.ini files included with WAMP (I never understood why).

    I found this out the hard way. There was one in the Apache directory, and there's one in the PHP installation directory. I'm not sure which one is the active one, but try modifying both of them.

  3. #13
    Join Date
    Mar 2011
    Posts
    2,145
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default

    Yep, changed the second php.ini and the notices stopped but the warning is still coming up and the comments box won't work.

    The error is

    ( ! ) Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\Documents and Settings\Owner\Desktop\canberra amatuer productions\www\Canberra Amatuer Productions\member.php on line 88
    Call Stack
    # Time Memory Function Location
    1 0.0082 383600 {main}( ) ..\member.php:0
    2 0.0146 393384 mysql_fetch_array ( ) ..\member.php:88

  4. #14
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    In the future, you should be posting these errors under the PHP discussion board to get more attention. Please provide us with the code for member.php so we can diagnose the problem.

  5. #15
    Join Date
    Mar 2011
    Posts
    2,145
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default

    The code above is member.php

  6. #16
    Join Date
    Mar 2011
    Posts
    2,145
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default

    Quote Originally Posted by keyboard1333 View Post
    PHP Code:
    <?php 

     mysql_connect
    ("localhost""****""****") or die(mysql_error()); 
     
    mysql_select_db("****") or die(mysql_error()); 
     

     if(isset(
    $_COOKIE['ID_my_site'])) 
     { 
         
    $username $_COOKIE['ID_my_site']; 
         
    $pass $_COOKIE['Key_my_site']; 
              
    $check mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); 
         while(
    $info mysql_fetch_array$check ))      
             { 
     

             if (
    $pass != $info['password']) 
                 {             
    header("Location: login.php"); 
                 } 
     
         
         else 
                 { 
                   

                 } 
             } 
             } 
     else 
     

     {             
     
    header("Location: login.php"); 
     } 
     


    $links "link2.php";




    ?>

    <?php 

     mysql_connect
    ("localhost""****""****") or die('could not connect to database'); 
     
    mysql_select_db("****") or die('Could not select database');

    if (isset (
    $_POST['submit'])) 
    {
        
    $comment nl2br(mysql_escape_string (trim ($_POST['comment']))); 

    $quantity $_POST['quantity'];
    $item $_POST['item'];

    $cheese =  "$username  - $comment  ";



    $sql mysql_query ("INSERT INTO comments (id,comments) VALUES ('0','".$cheese."')");
        
        echo 
    'Your comment has been entered successfully!';
        echo 
    '<a href="member.php">Please click here</a>';
            

        
    else 
    {


    ?>


    <html>
    <head>
    <body style="background-color:lightgreen">
    </head>
    <body>
    <?php include("$links"); 
    echo 
    "Hey ".$username;
    ?>  
    <br /><br />
    <p><b>COMMENTS</b></p>
    <?php
        
    // POST data wasnt entered, so display the comments and comment form 
        // view comments from database
           
    $sql mysql_query ("SELECT * FROM comments");
           while (
    $row mysql_fetch_array ($sql)) {
           echo 
    $row['comments'].'<br />';
    }



        echo 
    '<br /><br />
        <form action="member.php" method="post">
        Comments:<br />
        <textarea name="comment" cols="40" rows="7"></textarea>
        <input type="submit" value="Submit" name="submit">
        </form>'
    ;
    }
    ?>
    </body>
    </html>
    Any help would be great

    That's it again

  7. #17
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    Sorry, I overlooked that other post and didn't see the code posted before.

    Try changing line 88 to the following:
    PHP Code:
    $sql mysql_query ("SELECT * FROM comments") or die(mysql_error());; 
    mysql_error() will tell us if MySQL is not executing the code properly and what error it is giving if $sql's query fails. When you get the error, post it here.

    Also, you're reconnecting to MySQL twice in your script. You really only should be connecting once. Connecting multiple times when a connection is already open puts a lot of stress on your DB.
    - Josh

Bookmarks

Posting Permissions

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