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!


Results 1 to 9 of 9

Thread: PHP Help

  1. #1
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default PHP Help

    Well I am making something so that visitors can enter the habbo name or dj name and it will display the results (Like the Rare search on Habbox).
    But when there isnt any thing been searched I want it to display "", which is working fine, but when I search something I keep getting this error:
    PHP Code:
     Fatal error:  Cannot break/continue 1 level in /home/*****/public_html/folder/page.php on line 18 
    My code is
    PHP Code:
    <?php
    include("../connector.php");

    $search = ($_GET["search"]);

    if(
    $search == "") {
    echo (
    "Please enter a DJ or Habbo Name.");
    } else {

    echo (
    "<table style=\"border-width: 0px\" width=\"450\" align=\"center\">");

    $sql mysql_query(" SELECT * FROM `users` WHERE `username` REGEXP CONVERT( _utf8 '$search' USING latin1 ) COLLATE latin1_swedish_ci OR `habboname` REGEXP CONVERT( _utf8 '$search' USING latin1 ) COLLATE latin1_swedish_ci");
    while(
    $rows mysql_fetch_array($sql))

    if(!
    $a) print ("<tr>");
    $a++;
    print (
    "<td style=\"border-style: none\" align=\"center\"><img src=\"http://www.habbo.com/habbo-imaging/avatarimage?user=$rows[habboname]&action=0&direction=3&head_direction=3&img_format=gif&gesture=0&size=l\"><br><b>$rows[habboname]</b><br><i>DJ $rows[username]</i></td>");
    if(
    $a!=4) continue;
    print (
    "</tr>");
    unset(
    $a);

    echo (
    "</tr></table>");
    ?>
    Line 18 is:
    PHP Code:
    if($a!=4) continue; 

  2. #2
    Join Date
    Mar 2008
    Posts
    173
    Tokens
    0

    Default

    Try this:

    PHP Code:
    <?php
    include ("../connector.php");
    $search = ($_GET ["search"]);
    if (
    $search == "") {
        echo 
    "Please enter a DJ or Habbo Name.";
    } else {
        echo 
    "<table style=\"border-width: 0px\" width=\"450\" align=\"center\">";
        
    $sql mysql_query " SELECT * FROM `users` WHERE `username` LIKE  '%$search%' OR `habboname` LIKE '%$search%'" );
        
    $num mysql_num_rows($sql);
        if(
    $num == "0") {
            
    // Display nothing
        
    } else {
            while (
    $rows mysql_fetch_array($sql)) {
                echo 
    "<tr>";
                echo 
    "<td style=\"border-style: none\" align=\"center\"><img src=\"http://www.habbo.com/habbo-imaging/avatarimage?user=$rows[habboname]&action=0&direction=3&head_direction=3&img_format=gif&gesture=0&size=l\"><br><b>$rows[habboname]</b><br><i>DJ $rows[username]</i></td>";
                echo 
    "</tr>";
            }
        }
        echo 
    "</tr></table>"
    ?>

  3. #3
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    Quote Originally Posted by Navicat View Post
    Try this:

    PHP Code:
    <?php
    include ("../connector.php");
    $search = ($_GET ["search"]);
    if (
    $search == "") {
        echo 
    "Please enter a DJ or Habbo Name.";
    } else {
        echo 
    "<table style=\"border-width: 0px\" width=\"450\" align=\"center\">";
        
    $sql mysql_query " SELECT * FROM `users` WHERE `username` LIKE  '%$search%' OR `habboname` LIKE '%$search%'" );
        
    $num mysql_num_rows($sql);
        if(
    $num == "0") {
            
    // Display nothing
        
    } else {
            while (
    $rows mysql_fetch_array($sql)) {
                echo 
    "<tr>";
                echo 
    "<td style=\"border-style: none\" align=\"center\"><img src=\"http://www.habbo.com/habbo-imaging/avatarimage?user=$rows[habboname]&action=0&direction=3&head_direction=3&img_format=gif&gesture=0&size=l\"><br><b>$rows[habboname]</b><br><i>DJ $rows[username]</i></td>";
                echo 
    "</tr>";
            }
        }
        echo 
    "</tr></table>"
    ?>
    unexpected $end
    Also that one wont display it in columns

    Thanks though
    Last edited by Moh; 08-03-2008 at 03:33 PM.

  4. #4
    Join Date
    Mar 2008
    Posts
    173
    Tokens
    0

    Default

    PHP Code:
    <?php
    include ("../connector.php");
    $search = ($_GET ["search"]);
    if (
    $search == "") {
        echo 
    "Please enter a DJ or Habbo Name.";
    } else {
        echo 
    "<table style=\"border-width: 0px\" width=\"450\" align=\"center\">";
        
    $sql mysql_query " SELECT * FROM `users` WHERE `username` LIKE  '%$search%' OR `habboname` LIKE '%$search%'" );
        
    $num mysql_num_rows $sql );
        if (
    $num == "0") {
            
    // Display nothing
        
    } else {
            while ( 
    $rows mysql_fetch_array $sql ) ) {
                echo 
    "<tr>";
                echo 
    "<td style=\"border-style: none\" align=\"center\"><img src=\"http://www.habbo.com/habbo-imaging/avatarimage?user=$rows[habboname]&action=0&direction=3&head_direction=3&img_format=gif&gesture=0&size=l\"><br><b>$rows[habboname]</b><br><i>DJ $rows[username]</i></td>";
                echo 
    "</tr>";
            }
        }
        echo 
    "</tr></table>"
    }
    ?>
    Yeah it will..

  5. #5
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    Quote Originally Posted by Navicat View Post
    PHP Code:
    <?php
    include ("../connector.php");
    $search = ($_GET ["search"]);
    if (
    $search == "") {
        echo 
    "Please enter a DJ or Habbo Name.";
    } else {
        echo 
    "<table style=\"border-width: 0px\" width=\"450\" align=\"center\">";
        
    $sql mysql_query " SELECT * FROM `users` WHERE `username` LIKE  '%$search%' OR `habboname` LIKE '%$search%'" );
        
    $num mysql_num_rows $sql );
        if (
    $num == "0") {
            
    // Display nothing
        
    } else {
            while ( 
    $rows mysql_fetch_array $sql ) ) {
                echo 
    "<tr>";
                echo 
    "<td style=\"border-style: none\" align=\"center\"><img src=\"http://www.habbo.com/habbo-imaging/avatarimage?user=$rows[habboname]&action=0&direction=3&head_direction=3&img_format=gif&gesture=0&size=l\"><br><b>$rows[habboname]</b><br><i>DJ $rows[username]</i></td>";
                echo 
    "</tr>";
            }
        }
        echo 
    "</tr></table>"
    }
    ?>
    Yeah it will..
    unexpected '}', expecting ',' or ';' on line 20

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

    Latest Awards:

    Default

    PHP Code:
    <?php
    include ("../connector.php");
    $search = ($_GET ["search"]);
    if (
    $search == "") {
        echo 
    "Please enter a DJ or Habbo Name.";
    } else {
        echo 
    "<table style=\"border-width: 0px\" width=\"450\" align=\"center\">";
        
    $sql mysql_query " SELECT * FROM `users` WHERE `username` LIKE  '%$search%' OR `habboname` LIKE '%$search%'" );
        
    $num mysql_num_rows $sql );
        if (
    $num == "0") {
            
    // Display nothing
        
    } else {
            while ( 
    $rows mysql_fetch_array $sql ) ) {
                echo 
    "<tr>";
                echo 
    "<td style=\"border-style: none\" align=\"center\"><img src=\"http://www.habbo.com/habbo-imaging/avatarimage?user=$rows[habboname]&action=0&direction=3&head_direction=3&img_format=gif&gesture=0&size=l\"><br><b>$rows[habboname]</b><br><i>DJ $rows[username]</i></td>";
                echo 
    "</tr>";
            }
        }
        echo 
    "</tr></table>";
    }
    ?>

  7. #7
    Join Date
    Mar 2008
    Posts
    173
    Tokens
    0

    Default

    ****, I forgot a ;

    Should be simple enough to fix without posting it?

  8. #8
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    I have already fixed this, but thanks to every one who helped
    + Rep to you all

  9. #9
    Join Date
    Mar 2008
    Posts
    173
    Tokens
    0

    Default

    No problem!

Posting Permissions

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