Jump to content

JKG

Members
  • Posts

    289
  • Joined

  • Last visited

Everything posted by JKG

  1. Hi there again, I tried to implement your suggestion but I'm getting a Duplicate column name 'ID' error #1060. Should I be using a different JOIN? Thanks for your continued help, Joe.
  2. That looks spot on, thanks so much for taking the time to reply. I will report back with my results asap. Im not too great with SQL as you can tell!
  3. hi there, it would be great if you could help, i have hit a brick wall. I have two queries (hence UNION), the first query is to return all the rows with a certain ID, in a certain order, this SQL works (i have removed some unnecessary bits): SELECT SQL_CALC_FOUND_ROWS * FROM `users` JOIN `u_data` ON `users`.`ID`=`u_data`.`ID` WHERE `users`.`ID` in (4,5,6,7) AND `u_data`.ID NOT IN (1,2,3) ORDER BY FIELD(`u_data`.ID, 4,5,6,7) the second query is to return the rest of the rows in a random, weighted order, this SQL works (i have removed some unnecessary bits): SELECT * FROM `users` JOIN `u_photographers` ON `users`.`ID`=`u_photographers`.`ID` WHERE `users`.`Level_access`=2 AND `users`.`active`=1 AND `users`.`ID` NOT IN (1,2,3) ORDER BY ((`u_data`.`referral_points` + 60) * RAND(5330)) DESC when i join these two queries together i am trying to use this SQL: (SELECT SQL_CALC_FOUND_ROWS * FROM `users` JOIN `u_data` ON `users`.`ID`=`u_data`.`ID` WHERE `users`.`ID` in (4,5,6,7) AND `u_data`.ID NOT IN (1,2,3) ORDER BY FIELD(`u_data`.ID, 4,5,6,7)) UNION (SELECT * FROM `users` JOIN `u_photographers` ON `users`.`ID`=`u_photographers`.`ID` WHERE `users`.`Level_access`=2 AND `users`.`active`=1 AND `users`.`ID` NOT IN (1,2,3) ORDER BY ((`u_data`.`referral_points` + 60) * RAND(5330)) DESC) this code works fine in phpMyAdmin however this does not quite work in that when going through the pagination on the site, the first query always returns, whatever page (1,2,3,4 etc), but it should only return the selected id's, then move onto the second query... any thoughts or clarification, please ask, thanks for reading.
  4. there is a nice one i used for a quick wordpress job too: http://wordpress.org/extend/plugins/booking/screenshots/ its free. by the way, i modified the epoch calculator to be db driven too.
  5. i modified this: http://www.meanfreepath.com/javascript_calendar/examples.html for this site based on availability: theweddingsearch.co.uk / .com
  6. you need to know what page you are on. i wouldn't do it this particular way (i would use a tiny function) but as its only 4 pages, put this above the include statement somewhere on the three.php page. <?php $page = 'three'; ?> and in your nav include: <ul id="nav"> <li><a <?php if($page == 'three') echo 'id="selected"';?> href="index.php">Home</a></li> <li><a href="one.php">One</a></li> <li><a href="two.php">Two</a></li> <li><a href="three.php">Three</a></li> </ul>
  7. mysql_query("SELECT * FROM table ORDER BY date DESC LIMIT (10, 9999)"); you could return a numrows to change the 9999 to a real number. EDIT: select * isnt great, declare the columns you need.
×
×
  • 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.