Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: PHP Issue

  1. #1
    Join Date
    Jan 2007
    Posts
    651
    Tokens
    0

    Default PHP Issue

    When i try to echo out of the database, it echos nothing with no error.
    PHP Code:
    <?php
    if(!$_GET[category]){
    echo(
    '
    <a href="products.php?category=soccer">Soccer Trophies</a>
    <br />

    '
    );
    }else{

    $query "SELECT * FROM catalogue WHERE category = '$_GET[category];'"
         
    $result mysql_query($query) or die(mysql_error());

    $row mysql_fetch_array($result) or die(mysql_error());

    echo(


    <table border='1'>
    <tr>
    <td><img src='images/"
    .$row[item_number].".JPG'></td>
    </tr>
    <br>
    <tr>
    <td>Item Number: "
    $row['item_number']."</td>
    </tr>
    </tr><br>
    <tr><td>"
    .$row[price]." GBP (Great Brittish Pounds)</td></tr>
    <br>
    </table>
    <br>
    "
    );
    }
    ?>
    James


    Connected to reality through a proxy server.

  2. #2
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    PHP Code:
    <?php
    if( $_GET[category] == "" )
    {
        echo 
    '<a href="products.php?category=soccer">Soccer Trophies</a> <br /> 
        '
    ;
    }
    else
    {
        
    $query mysql_query"SELECT * FROM `catalogu`e WHERE category = '{$_GET[category]}'" ); 
        while( 
    $row mysql_fetch_array$result ) )
        {
            echo 
    '<table border="1">
            <tr>
                <td><img src="images/' 
    $row[item_number] . '.JPG"></td>
            </tr>
            <br />
            <tr>
                <td>Item Number: ' 
    $row['item_number'] . '</td>
            </tr>
            <br />
            <tr>
                <td>' 
    .$row[price] . " GBP (Great Brittish Pounds)</td></tr>
            <br />
            </table>
            <br/>
            ';
        }
    }
    ?>

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

    Latest Awards:

    Default

    Ryan's was incorrect so:

    PHP Code:
    <?php
    if( $_GET[category] == "" )
    {
        echo 
    '<a href="products.php?category=soccer">Soccer Trophies</a> <br /> 
        '
    ;
    }
    else
    {
        
    $query mysql_query"SELECT * FROM `catalogue` WHERE category = '{$_GET[category]}'" ); 
        while( 
    $row mysql_fetch_array$result ) )
        {
            echo 
    '<table border="1">
            <tr>
                <td><img src="images/' 
    $row[item_number] . '.JPG"></td>
            </tr>
            <br />
            <tr>
                <td>Item Number: ' 
    $row['item_number'] . '</td>
            </tr>
            <br />
            <tr>
                <td>' 
    .$row[price] . ' GBP (Great Brittish Pounds)</td></tr>
            <br />
            </table>
            <br/>
            '
    ;
        }
    }
    ?>

  4. #4
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    My mistake - soz

  5. #5
    Join Date
    Jan 2007
    Posts
    651
    Tokens
    0

    Default

    Its still blank.Im confused.
    Last edited by Mr Macro; 21-07-2007 at 05:03 PM.
    James


    Connected to reality through a proxy server.

  6. #6
    Join Date
    Dec 2006
    Posts
    521
    Tokens
    0

    Default

    Make sure the tables & rows exists.

  7. #7
    Join Date
    Feb 2005
    Location
    Leicestershire / Sheffield
    Posts
    685
    Tokens
    0

    Default

    PHP Code:
    <?php
    if( $_GET[category] == "" )
    {
        echo 
    '<a href="products.php?category=soccer">Soccer Trophies</a> <br /> 
        '
    ;
    }
    else
    {
        
    $query mysql_query"SELECT * FROM `catalogu`e WHERE category = '{$_GET[category]}'" ); 
        while( 
    $row mysql_fetch_array$query ) )
        {
            echo 
    '<table border="1">
            <tr>
                <td><img src="images/' 
    $row[item_number] . '.JPG"></td>
            </tr>
            <br />
            <tr>
                <td>Item Number: ' 
    $row['item_number'] . '</td>
            </tr>
            <br />
            <tr>
                <td>' 
    .$row[price] . " GBP (Great Brittish Pounds)</td></tr>
            <br />
            </table>
            <br/>
            ';
        }
    }
    ?>

  8. #8
    Join Date
    Feb 2005
    Location
    Leicestershire / Sheffield
    Posts
    685
    Tokens
    0

    Default

    Cant Edit Last Post,

    Sorry, i was tired when i looked at that and that wont work either lol,

    This will work:

    PHP Code:
    <?php
    if( $_GET['category'] == "" ){
        echo 
    '<a href="products.php?category=soccer">Soccer Trophies</a> <br />';
    }else{
        
    $category $_GET['category'];
        
    $query mysql_query"SELECT * FROM `catalogue` WHERE category = '$category'" ); 
        while( 
    $row mysql_fetch_array$query ) ){
            echo 
    '<table border="1">
            <tr>
                <td><img src="images/' 
    $row['item_number'] . '.JPG"></td>
            </tr>
            <br />
            <tr>
                <td>Item Number: ' 
    $row['item_number'] . '</td>
            </tr>
            <br />
            <tr>
                <td>' 
    .$row['price'] . ' GBP (Great Brittish Pounds)</td></tr>
            <br />
            </table>
            <br/>'
    ;
        }
    }
    ?>

  9. #9
    Join Date
    Jan 2007
    Posts
    651
    Tokens
    0

    Default

    No, still doesn't work.
    James


    Connected to reality through a proxy server.

  10. #10
    Join Date
    Feb 2005
    Location
    Leicestershire / Sheffield
    Posts
    685
    Tokens
    0

    Default

    Try this and tell me the error which it says:

    PHP Code:
    <?php
    if( $_GET['category'] == "" ){
        echo 
    '<a href="products.php?category=soccer">Soccer Trophies</a> <br />';
    }else{
        
    $category $_GET['category'];
        
    $query mysql_query"SELECT * FROM `catalogue` WHERE category = '$category'" ) or die("MySQL Error: <br>".mysql_error()); 
        while( 
    $row mysql_fetch_array$query ) ){
            echo 
    '<table border="1">
            <tr>
                <td><img src="images/' 
    $row['item_number'] . '.JPG"></td>
            </tr>
            <br />
            <tr>
                <td>Item Number: ' 
    $row['item_number'] . '</td>
            </tr>
            <br />
            <tr>
                <td>' 
    .$row['price'] . ' GBP (Great Brittish Pounds)</td></tr>
            <br />
            </table>
            <br/>'
    ;
        }
    }
    ?>

Page 1 of 3 123 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
  •