Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

I need MySQL stuff done please help

Custom Title Activated
Loyal Member
Joined
Jun 27, 2009
Messages
1,571
Reaction score
170
I need MySQL code for my news promo

PHP:
<div id="promo-box">

    <div id="promo-bullets"></div>
    <div class="promo-container" id="'.$news["id"].'" style="background-image: url(http://www.habbotimes.net/assets/media/fancenter/topstorys/promo_roombuilding.png)">
            <div class="promo-content-container">
                <div class="promo-content">
                    <div class="title">'.stripslashes($news["title"]).'</div>
                    <div class="body">Welcome To New HobbaCMS :)</div>
                </div>
            </div>
            <div class="promo-link-container">

        <b></b>
    </div>
</div>
            </div>
        </div>


        </div>
        <b></b>

I'm using PhoenixPHP edit to my standard :p so I need help :)
 
Junior Spellweaver
Joined
Feb 7, 2011
Messages
120
Reaction score
12
test this: <?php $news = mysql_query("SELECT FROM * news"); ?>
<div id="promo-box">

<div id="promo-bullets"></div>
<div class="promo-container" id="'" style="background-image: url(http://www.habbotimes.net/assets/media/fancenter/topstorys/promo_roombuilding.png)">
<div class="promo-content-container">
<div class="promo-content">
<div class="title"><?php echo $news['title']; ?></div>
<div class="body">Welcome To New HobbaCMS :)</div>
</div>
</div>
<div class="promo-link-container">

<b></b>
</div>
</div>
</div>
</div>


</div>
 
Upvote 0
Developer
Loyal Member
Joined
Jul 28, 2009
Messages
983
Reaction score
133
Let me help you a bit.
I've no idea what you exactly want, this will get the last inserted news article.
You will have to change some fields.

// Now you have the results from the last inserted news article
$query = mysql_query("select * from news order by id desc limit 1");
$results = mysql_fetch_assoc($query);

You can use the results by doing this:

<php echo $results['newsarticlename']; ?>
 
Upvote 0
Custom Title Activated
Loyal Member
Joined
Jun 27, 2009
Messages
1,571
Reaction score
170
Okay, I can explain it better I want my news to switch from different pics like on habbo or habboon via MySQL :p so it would go like this

 
Upvote 0
Experienced Elementalist
Joined
Aug 28, 2012
Messages
214
Reaction score
137
Here is what I'm using for my CMS, I think it should work for you if you edit some parts.
PHP:
<?php
$news = mysql_query("SELECT * FROM news_promo ORDER BY `order_id` DESC");
if(mysql_num_rows($news) == 0)
{
    echo '';
} 
else
{
    echo '<div id="promo-box">';
    echo '<div id="promo-bullets"></div>';
}
 
while($row = mysql_fetch_array($news))
{
    $id = $row['id'];
    $title = $row['title'];
    $text = $row['text'];
    $image_url = $row['image_url'];
    $url = $row['url'];
    $url_text = $row['url_text'];
           
    echo '<div class="promo-container" style="background-image: url(' .$image_url. ')">
          <div class="promo-content-container">
          <div class="promo-content">
          <div class="title">' .$title. '</div>
          <div class="body">' .$text. '</div>
          </div>
          </div>
          <div class="promo-link-container">
          <div class="enter-hotel-btn">
          <div class="open enter-btn">
          <a href="' .$url. '" target="a02ce3581bfb74fd6b4865171ed64cf3aaccc80e" onclick="HabboClient.openOrFocus(this); return false;">' .$url_text. '<i></i></a>
          <b></b>
          </div>
          </div>
          </div>
          </div>
         ';
}
?>
Here is the the SQL.
Code:
---- Database: `superdb`
--


-- --------------------------------------------------------


--
-- Table structure for table `news_promo`
--


CREATE TABLE IF NOT EXISTS `news_promo` (
  `id` int(11) NOT NULL,
  `title` text NOT NULL,
  `text` text NOT NULL,
  `image_url` text NOT NULL,
  `url` text NOT NULL,
  `url_text` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


--
-- Dumping data for table `news_promo`
--


INSERT INTO `news_promo` (`id`, `order_id`, `title`, `text`, `image_url`, `url`, `url_text`) VALUES
(1, 1, 'Promo #1!', 'text here', '%url%/web-gallery/v2/images/web_promo/diamond_vip.png', 'urlhere', 'Check it out!'),
(2, 2, 'Promo #2', 'txt here', '%url%/web-gallery/v2/images/web_promo/promo_frontPage_pockethabbo_1.png', 'urlhere', 'OMG!'),
(3, 3, 'Promo #3', 'text here', '%url%/web-gallery/v2/images/web_promo/web_promo_02.png', 'urlhere', 'Find out more');
 
Last edited:
Upvote 0
Skilled Illusionist
Joined
Sep 22, 2012
Messages
300
Reaction score
65
Let me help you a bit.
I've no idea what you exactly want, this will get the last inserted news article.
You will have to change some fields.

// Now you have the results from the last inserted news article
$query = mysql_query("select * from news order by id desc limit 1");
$results = mysql_fetch_assoc($query);

You can use the results by doing this:

<php echo $results['newsarticlename']; ?>

Thats wrong syntax.
PHP:
// Now you have the results from the last inserted news article
$query = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 1");
$results = mysql_fetch_assoc($query);
 
Upvote 0
Experienced Elementalist
Joined
Aug 28, 2012
Messages
214
Reaction score
137
It works but it glitches :p

Like I said, you may need to edit some parts for it to work for PhoenixPHP, as it works perfectly on my CMS. I would help you but I'm not familiar with PhoenixPHP.

I'm glad I helped a little bit, though.
 
Upvote 0
Back
Top