wood1e Posted August 10, 2007 Share Posted August 10, 2007 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... Quote Link to comment https://forums.phpfreaks.com/topic/64224-changing-from-alphabetical/ Share on other sites More sharing options...
wildteen88 Posted August 10, 2007 Share Posted August 10, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/64224-changing-from-alphabetical/#findComment-320197 Share on other sites More sharing options...
HuggieBear Posted August 10, 2007 Share Posted August 10, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/64224-changing-from-alphabetical/#findComment-320198 Share on other sites More sharing options...
wood1e Posted August 10, 2007 Author Share Posted August 10, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/64224-changing-from-alphabetical/#findComment-320205 Share on other sites More sharing options...
HuggieBear Posted August 10, 2007 Share Posted August 10, 2007 Is there something above this line in the code? $result = $db->getallisland(); Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/64224-changing-from-alphabetical/#findComment-320207 Share on other sites More sharing options...
wood1e Posted August 10, 2007 Author Share Posted August 10, 2007 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/"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/64224-changing-from-alphabetical/#findComment-320216 Share on other sites More sharing options...
wildteen88 Posted August 10, 2007 Share Posted August 10, 2007 Open propertySQL.inc.php and copy 'n' paste the function getallisland from that file. There is a query in that function which you should be able to edit to change the order. Quote Link to comment https://forums.phpfreaks.com/topic/64224-changing-from-alphabetical/#findComment-320217 Share on other sites More sharing options...
wood1e Posted August 10, 2007 Author Share Posted August 10, 2007 function getallisland() { $query = "select islandid,island from island order by island"; $result = $this->select($query); return $result; } Quote Link to comment https://forums.phpfreaks.com/topic/64224-changing-from-alphabetical/#findComment-320257 Share on other sites More sharing options...
wildteen88 Posted August 10, 2007 Share Posted August 10, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/64224-changing-from-alphabetical/#findComment-320370 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.