Jump to content

JKG

Members
  • Posts

    289
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    UK

JKG's Achievements

Member

Member (2/5)

0

Reputation

  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. thanks for this. in the end i used SELECT *, MONTH(`timestamp`) as `Month`, YEAR(`timestamp`) as `Year` FROM `news` order by timestamp desc but your suggestion got me on the right path. much appreciated.
  8. just aesthetically. group by month automatically. thanks again.
  9. Hi WebStyles thanks for the reply. I am talking about news items stored in a database with a timestamp. Thanks.
  10. any one know of any scripts to archive news items by timestamp? google searches just show tonnes of news archives.. not what i want! obviously using php, all news items have a timestamp, how would i go about this? very open ended question but ANY help would really be appreciated. Thanks!
  11. so you are having problems with this script? or does the script work, you just want to add to it? Does it resize the uploaded images?
  12. thats not a very good tut. he has a few errors in the code initially. use curl and go from there. Try this: http://devtrench.com/posts/screen-scrape-with-php-curl
  13. if what you have posted is your entire header then removing the <?php ?> tags will fix it. If you have other content in between the tags then it will not work. You cannot output any character whatsoever before sending a header(). so if you do this: echo ' '; header (foo); it will fail. if you do this: <?php header(foo); ?> it will fail. (notice the space before <)
  14. you are outputting empty chars. if(empty($user) && empty($pass)){ exit; }else{ } ?> <?php $sql should be if(empty($user) && empty($pass)){ exit; }else{ } $sql why open and close the tags?? any characters before a header statement will throw this error.
×
×
  • 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.