Hello everyone,
I’m building a gaming news, reviews etc website for my last project at the university. Although, I’m a bit bummed right now, I’m stuck and can’t figure out how to handle this.
I’ve got a neat image slider on my index page, with 6 options, and I want it to display the following items from my MySQL’s “news” table: Title (headline), Small_desc (small description), and the Image (the header image, which I configured the slider to auto-size).
My slider’s raw, working (although static) code is as follows:
<ul id="slideshow">
<li>
<h3>Headline 1</h3>
<span>photos/assassins01.jpg</span>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ut urna. Mauris nulla. Donec nec mauris. Proin nulla dolor, bibendum et, dapibus in, euismod ut, felis.</p>
<a href="#"><img src="photos/assassins01.jpg" alt="Thumbnail_1" width="125" height="75"/></a></li>
</ul>
<div id="wrapper">
<div id="fullsize">
<div id="imgprev" class="imgnav" title="Previous Image"></div>
<div id="imglink"></div>
<div id="imgnext" class="imgnav" title="Next Image"></div>
<div id="image"></div>
<div id="information">
<h3></h3>
<p></p>
</div>
</div>
<div id="thumbnails">
<div id="slideleft" title="Slide Left"></div>
<div id="slidearea">
<div id="slider"></div>
</div>
<div id="slideright" title="Slide Right"></div>
</div>
</div>
What I want to work on is the 6 versions of the first part. I will need to replace static items with variables from my database’s table’s items, and display them, meaning I will have to make it look like this:
[php]
$Title
$Image $Small_desc <$Image alt="$Title" width="125" height="75"/>Problem is, I’m getting lots of errors when I try to configure it myself. I’ve already connected to my database, and made the code ask for the last 6 items, sorted by Date. Code is as follows:
[php]
<?php mysql_connect("localhost", "root") or die("Failed to connect."); mysql_select_db("starblind_database") or die("Failed to find database."); $query = "SELECT * FROM news ORDER BY Date LIMIT 6"; $result = mysql_query($query) or die("Failed to execute query."); while($row = mysql_fetch_array($result)) { [b]...[/b] } ?>[/php]
In the bold part, my slider’s code should be present. At this point, I’ve started working on my other pages and abandoned index, but I’m finishing the others, and want to finish the index one, as my project is due for this Tuesday. I’m kindly asking you all, can you please help me? Or at least point me in the right direction, where I can pick up from and continue? It would be very, very appreciated.
Thank you,
Christos