Jump to content

Recommended Posts

Hi, I have had a developer to create a back end for my website.  I can't get hold of him, and to be fair I have bothered him enough, as I am trying to learn as well :)  That was not his job to teach me!!

 

What I have is three pictures and text title sitting next to each other, and they are in alphabetical order...What I want to do is place the picture and text title in a different order.

 

This is the code

 

  <h2><?php print "$island"; ?></h2>

  </div>

<div class="content">

<div class="item"><img src="./photo/<?php print "$island"; ?>.jpg" name="imgprop" vspace="2" id="imgprop" width="175" height="116" />

 

HOpefully someone can tell from that how/what i would need to change.

I actually change the order in which they are displayed buy changing the names of the images, to a.jpg/b.jpg/c.jpg which works...but the text title then doesn't reflect the image underneath...

 

 

Link to comment
https://forums.phpfreaks.com/topic/64224-changing-from-alphabetical/
Share on other sites

How are they ordered in your php code? Posting those few lines doesn't give me much information on how the images get ordered. You'll need to post more code.

 

NOTE: when you post code within post please use the code tags (


), thank you.

There must be some more php code somewhere else.  Further up the page maybe, if it doesn't look like it then maybe something like this:

 

<?php
include('something.php');
?>

Or

<?php
require('something.php');
?>

 

That's the code we'd need to see.

 

Regards

Huggie

The code at the very top of the page is

 

$result = $db->getallisland();
$PicturePath = "./photo/";

 

Above the code previously posted is this:

 

<div id="right">
 <?php include("inc_indexsearch.php");?>
 <?php include("inc_indexweek.php");?>
  </div>
<div id="left">
  <?php include ("top.php3");?>
  <div id="toptext">
		  <p><?php print "$lang_formtitle";?> </p>
 </div>
  <table>
  <?php
  if (!empty($result)) {
  	$countresult=count($result);
  	$k=0;
  	while($k<$countresult) {
  		?>
  		<tr>
  		<?php
  		$i=0;
  		while($k<$countresult&&$i<3){
  		$islandid = stripslashes($result[$k]["islandid"]);
  		$island = stripslashes($result[$k]["island"]);
  		       $propertyresult=$db->getpropertybyislandid($islandid);
  		       $num=count($propertyresult);
  		       $j=0;
  		      
   ?>
    <td>
	<div id="box5">
	  <div class="title">
		  <h2><?php print "$island"; ?></h2>
	  </div>
		<div class="content">
			<div class="item"><img src="./photo/<?php print "$island"; ?>.jpg" name="imgprop" vspace="2" id="imgprop" width="175" height="116" />
				<a href="island.php?islandid=<?php print "$islandid"; ?>&island=<?php print "$island"; ?>" title="Quick Search " class="quickSearch"><?php print "$lang_quicksearch";?> </a>

		  </div>

 

Apologise for not placing code inside brackets previously :)

The code at the very top of the page is this...should have put this in earlier..apologise.

 

<?php
session_start();
require("./PropertySQL.inc.php");
$db = new PropertySQL($DBName);

$langfile = "./language/".$userlang."/index.php";
include ($langfile);

$result = $db->getallisland();
$PicturePath = "./photo/";
?>

Ok now that we got the query. How do you want the islands ordered. Can you post an illustration/example.

 

Basically depending on how you want them ordered you just got to change the ORDERY BY clause in the query to the field you want your results to be ordered by.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.