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 4 1234 LastLast
Results 1 to 10 of 31

Thread: Php Help Please

  1. #1
    Join Date
    Apr 2008
    Posts
    39
    Tokens
    0

    Default Php Help Please

    I need help with this, i've tried and tried but i just keep getting error upon error, can anybody help?

    Code:
    <?php 
    // Connects to your Database 
    mysql_connect("localhost", "", "") or die(mysql_error()); 
    mysql_select_db("") or die(mysql_error()); 
    $data = mysql_query("SELECT * FROM ads") 
    or die(mysql_error()); 
    if ($data[Paid]) == "Yes" {
    echo " ?>
    <a href=\"<?php $result=mysql_query('select * from ads');while($row=mysql_fetch_array($result)){echo $row[Site]. \"\";} ?>\">
    <img src=\"<?php $result=mysql_query('select * from ads');while($row=mysql_fetch_array($result)){echo $row[bannerurl]. \"\";} ?>\" border=\"0\"><?php "; } else { echo ""; }?>
    Its probobly all messed up but thats why i posted here, can anybody help

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

    Latest Awards:

    Default

    Quote Originally Posted by Johnnikins View Post
    I need help with this, i've tried and tried but i just keep getting error upon error, can anybody help?

    Code:
    <?php 
    // Connects to your Database 
    mysql_connect("localhost", "", "") or die(mysql_error()); 
    mysql_select_db("") or die(mysql_error()); 
    $data = mysql_query("SELECT * FROM ads WHERE Paid = 'Yes'") 
    or die(mysql_error()); 
    if ($data[Paid]) == "Yes" {
    echo " ?>
    <a href=\"<?php $result=mysql_query('select * from ads');while($row=mysql_fetch_array($result)){echo $row[Site]. \"\";} ?>\">
    <img src=\"<?php $result=mysql_query('select * from ads');while($row=mysql_fetch_array($result)){echo $row[bannerurl]. \"\";} ?>\" border=\"0\"><?php "; } else { echo ""; }?>
    Its probobly all messed up but thats why i posted here, can anybody help
    PHP Code:
    <?php
    mysql_connect
    ("localhost""""") or die(mysql_error()); // Try putting in your username and password
    mysql_select_db("") or die(mysql_error());  // Try putting in your database

    $query mysql_query("SELECT * from `ads` WHERE Paid = 'Yes'");

    while(
    $data mysql_fetch_array($query)) { 
    echo 
    "<img src=\""$data["bannerurl"] ."\" /><br /><!-- I imagine that you wanted a breakspace -->";
    echo 
    $data["Site"];
    }
    ?>
    Last edited by Calon; 23-08-2008 at 11:43 PM. Reason: Remove space

  3. #3
    Join Date
    Apr 2008
    Posts
    39
    Tokens
    0

    Default

    Thank you so much, and i have put in my username and password & db, but removed them for obvious reasons

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

    Latest Awards:

    Default

    Quote Originally Posted by Johnnikins View Post
    Thank you so much, and i have put in my username and password & db, but removed them for obvious reasons
    Fair do'

    Please reply if it works, I didn't try it but I re-wrote it completely.

  5. #5
    Join Date
    Apr 2008
    Posts
    39
    Tokens
    0

    Default

    Yes it works perfectly thanks.

    I know my attempt was very very poor

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

    Latest Awards:

    Default

    Quote Originally Posted by Johnnikins View Post
    Yes it works perfectly thanks.

    I know my attempt was very very poor
    Ah, w3 schools is good for tutorials, and so is Tizag.com

  7. #7
    Join Date
    Apr 2008
    Posts
    39
    Tokens
    0

    Default

    Thanks for the advice also, i'll be sure to look on there before i give in :]

  8. #8
    Join Date
    May 2008
    Posts
    605
    Tokens
    0

    Default

    There wasn't any need to close php to give the link nor string an if statement with yes, as Calon showed you can just do that with a simple query and loop the links

    It's not a big error but you may want to read up on PHP a bit more

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

    Latest Awards:

    Default

    Quote Originally Posted by Excellent1 View Post
    There wasn't any need to close php to give the link nor string an if statement with yes, as Calon showed you can just do that with a simple query and loop the links

    It's not a big error but you may want to read up on PHP a bit more
    Agree'd.

  10. #10
    Join Date
    Apr 2008
    Posts
    39
    Tokens
    0

    Default

    With the one you gave me, is there a way to show a certain banner if there is none with Paid = yes?

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