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. 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.
  15. @premiso i just wanted to clarify because there seems no way to be able to reward people for coming up with nice solutions. there are tonnes of ways to do things, but there are always better and worse ways. when a few suggestions are presented, i was wondering if there was anyway to put weight behind one suggestion or another. thats why i started this thread...
  16. thought as much, just wanted to check. thanks
  17. is it acceptable to post after someone has offered a solution and say that you like it or you would recommend it?
  18. hows about taking the query out of the url? its probably not the best idea to put the query in the url!! and it doesnt seem to perform any function... remove query=$query from the url in and around lines 145
  19. two choices without messing around with the function too much: we can change the back colour to grey or upload pictures with those exact proportions.
  20. instead of style you could go old school. Down the bgcolor="#000000" instead of style="" route. http://www.w3schools.com/tags/att_tr_bgcolor.asp
  21. can you dump the entire html output?
  22. echo the sql, check there is a topic with the cid and tid
  23. putting the background colour through a class or inline is still giving it a style... and either way works. and in your css, you need to have a dot before row1 and row2 like .row1 .row2 to give it a selector.
  24. Is it still within <table></table>? Have you any CSS styles that could be overriding this? A CSS reset?
×
×
  • 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.