Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 38

Thread: PHP help.

  1. #11
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    PHP Code:
    <?php
    include( 'database.php' );

    if( 
    $mysqlQuery mysql_query'SELECT * FROM `database`' ) )
    {
        if( 
    mysql_num_rows$mysqlQuery ) <= )
        {
            echo( 
    'No data in table' );
        }
        else
        {
            while( 
    $mysqlFetch mysql_fetch_array$mysqlQuery ) )
            {
                echo( 
    'Blah: ' $mysqlFetch'blah' ] );
                
    // print_r( $mysqlFetch );
                // That will show you whats int he array etc ( field name etc )
            
    }
        }
    }
    else
    {
        echo( 
    'Mysql Error' );
    }
    ?>
    Checks rows etc before broadcasting data
    Hi, names James. I am a web developer.

  2. #12
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php
    include 'database.php';

    if(
    $mysqlQuery mysql_query('SELECT * FROM database.`table`')) {
        if(
    mysql_num_rows($mysqlQuery) = ) {
            echo 
    'No data in table';
        }
        else {
            while(
    $mysqlFetch mysql_fetch_array($mysqlQuery)) {
                echo 
    'Blah: '.$mysqlFetch['blah'];
            }
        }
    }
    else {
        echo 
    'Mysql Error';
    }
    ?>
    Tidied up version of protege's.

    Calon what is
    PHP Code:
    '';
    //Why would you concatenate an empty string :S 
    How could this hapen to meeeeeeeeeeeeeee?lol.

  3. #13
    Join Date
    Nov 2005
    Posts
    4,486
    Tokens
    921

    Latest Awards:

    Default

    Looks like it has been fixed.
    Anyway, it could've just appeared in phpmyadmin. So you should've checked their first.
    "RETIRED" FROM HABBO(X)

    :¬:

    TOMSPIT / COWLY05


  4. #14
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    Quote Originally Posted by Hypertext View Post
    PHP Code:
    <?php
    include 'database.php';

    if(
    $mysqlQuery mysql_query('SELECT * FROM database.`table`')) {
        if(
    mysql_num_rows($mysqlQuery) = ) {
            echo 
    'No data in table';
        }
        else {
            while(
    $mysqlFetch mysql_fetch_array($mysqlQuery)) {
                echo 
    'Blah: '.$mysqlFetch['blah'];
            }
        }
    }
    else {
        echo 
    'Mysql Error';
    }
    ?>
    Tidied up version of protege's.

    Calon what is
    PHP Code:
    '';
    //Why would you concatenate an empty string :S 
    You haven't fixed **** all mate, your just trying to be clever and again failing.
    PHP Code:
    <?php
    include_once( 'database.php' );

    if( 
    $mysqlQuery mysql_query'SELECT * FROM `database`' ) )
    {
        if( 
    mysql_num_rows$mysqlQuery ) <= )
        {
            echo( 
    'No data in table' );
        }
        else
        {
            while( 
    FALSE === ( $mysqlFetch mysql_fetch_array$mysqlQuery ) ) )
            {
                echo( 
    'Blah: ' $mysqlFetch'blah' ] );
                
    // print_r( $mysqlFetch );
                // That will show you whats int he array etc ( field name etc )
            
    }
        }
    }
    else
    {
        echo( 
    'Mysql Error' ); // Using brackets, isn't wrong.
    }
    ?>
    Last edited by Protege; 04-08-2008 at 07:29 AM.
    Hi, names James. I am a web developer.

  5. #15
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    This is a better version:
    PHP Code:
    <?php
    include_once( 'database.php' );

    if( 
    $mysqlQuery mysql_query'SELECT * FROM `database`' ) )
    {
        if( 
    mysql_num_rows$mysqlQuery ) >= )
        {
            while( 
    FALSE === ( $mysqlFetch mysql_fetch_array$mysqlQuery ) ) )
            {
                echo( 
    'Blah: ' $mysqlFetch'blah' ] );
                
    // print_r( $mysqlFetch );
                // That will show you whats int he array etc ( field name etc )
            
    }
        }
        else
        {
            echo( 
    'No data in table' );
        }
    }
    else
    {
        echo( 
    'Mysql Error' ); // Using brackets, isn't wrong.
    }

    ?>
    Hi, names James. I am a web developer.

  6. #16
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    What the hell Hypertext? Have you read my code..

    Quote Originally Posted by Calon View Post
    PHP Code:
    <?php
    include "database.php"// Hate single quotes. :P
    $result mysql_query("SELECT * FROM `database`"); // prefer result.
    while($row mysql_fetch_array($result)) { 
    echo 
    "bla: "$row[""] ."";
    }
    ?>
    I left Lucas to put in the row, because some people are capable of doing that.

  7. #17
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    Thanks guys, I've checked in phpmyadmin and it's just not submitting any data to the database. Checked my submit code and nothing has been changed since it worked.

  8. #18
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Charlie, your version is a lot more messier than Protege's.

    Quote Originally Posted by Calon View Post
    What the hell Hypertext? Have you read my code..


    I left Lucas to put in the row, because some people are capable of doing that.
    I think he means where you have:
    PHP Code:
    echo "bla: "$row[""] .""
    You should just have:
    PHP Code:
    echo "bla: "$row[""]; 
    Last edited by Invent; 04-08-2008 at 01:46 PM.

  9. #19
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Invent View Post
    Charlie, your version is a lot more messier than Protege's.



    I think he means where you have:
    PHP Code:
    echo "bla: "$row[""] .""
    You should just have:
    PHP Code:
    echo "bla: "$row[""]; 
    Yeah, input the id's Fixed now, had to delete the whole database and make a new one with new names, weird :S

  10. #20
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Invent View Post
    Charlie, your version is a lot more messier than Protege's.



    I think he means where you have:
    PHP Code:
    echo "bla: "$row[""] .""
    You should just have:
    PHP Code:
    echo "bla: "$row[""]; 
    Oh, I leave it within the quotations.

Page 2 of 4 FirstFirst 1234 LastLast

Posting Permissions

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