Jump to content

jaymc

Members
  • Posts

    1,521
  • Joined

  • Last visited

    Never

Everything posted by jaymc

  1. jaymc

    GROUP BY ORDER

    I want to pull out a row from a table by its primary ID, then join another table which has multiple rows with the same ID as the primary, but not unique table 1: id-1 id-2 id-3 table 2: ticketID-1 ticketID-1 ticketID-1 ticketID-2 ticketID-3 ticketID-3
  2. jaymc

    GROUP BY ORDER

    That works on the individual field you apply MIN() or MAX() to but it does not pull put the entire row of the MAX(date) The other fields are still random..
  3. jaymc

    GROUP BY ORDER

    SELECT t.id, t.subject, t.department, tm.date FROM fred.client_tickets t INNER JOIN fred.client_ticket_messages tm GROUP BY t.id ORDER BY tm.date ORDER BY tm.date becomes useless because of the GROUP BY
  4. When doing a GROUP BY how is it possible to ORDER eached GROUPED results? It appears to ignore the ORDER BY and just return the first row it finds as part of the GROUP BY
  5. Im trying to do a CROSS JOIN as shown below My issue is inside the CROSS JOIN code it will not process this value t.id which is part of the initial table How can I allow the CROSS JOIN to use field values from the primary table I'm querying? SELECT t.id, t.subject, t.department, tm.date FROM fred.client_tickets t CROSS JOIN ( SELECT date FROM fred.client_ticket_messages WHERE tm.ticketID = t.id // HERE IS ISSUE, IT SAYS UNKNOWN t.id ORDER BY tm.date DESC ) tm WHERE t.clientID = '$client[id]' GROUP BY t.id ORDER BY tm.date DESC
  6. I have now used your example but its still doing the same? There are no other instances oF .ready
  7. <script type="text/javascript" src="/lite/cp/js/jquery.js"></script> <script type="text/javascript">$(document).ready(function(){$('.bann').addClass('clicked');});</script> <script type="text/javascript" src="/lite/cp/js/plugins.js"></script> <script type="text/javascript">$(document).ready(function(){$("#page_content_title").show(500);});</script> For some reason when I call $(document).ready(function(){$("#page_content_title").show(500);}); as shown above it works intermittently in chrome upon page refresh. In firefox it never works and in IE it works perfect Im guessing its the order/speed in which the browser is processing, hence it may try and run that code when the #page_content_title div has not been fully registered Any ideas? Anything I can do to test / make it reliably work
  8. I am using background: to use an icon in a menu using no-repeat and position right I can float the icon to the right hand side of the menu Works great However, I want the position of the icon to be aligned to the right but with a bit of extra padding from the right hand side Is it possible to do this? background-position:right aligns the background image tight to the right. I need padding/margin
  9. yEh I'm not a fan of templates probs only useful if a lot of people working on development
  10. Yes sometimes hehe Why did you move from the method you have included as an example?
  11. Here is a better insight on what I am probably going to design it like http://www.blinding-light.com/tutorials/read/7 Look at the screenshot of his directory structure and then of course the code used to build the page Is there any bad logic with this method? I get annoyed making things then getting stick on irc for not doing it the 'correct way' or most logical way this id prefer to design it the way the books/documentation advises.
  12. its the including page content bit Im asking about e.g <? include("header.inc"); // content here $dir = $_GET['dir'] $page = $_GET['page'] include("$dir/$page"); include("footer.inc"); ?> Thats how I do it at the moment, of course with security added in to ensure cant open what every dir/file they input. Im just wondering if thats the most logical way?
  13. I'd like to see how other people design a dynamic website using php which will have its content changed via url get parameters such as www.site.com/?dir=a&page=1 Can anyone point me to a good tutorial that takes you through the correct way to go about this The way I currently do it is using a master index with header.inc php code to determine the content file/script to include footer.inc
  14. Yeh your correct thats the answer Cheers
  15. A) Sometimes it makes its better to just use global B) But surely using global $clientID; gives the function access to its contents?
  16. Here is a slimmed down example, please try <? function first() { $beans = 50; second(); } function second() { global $beans; echo $beans; echo "The function works, but did it echo 50 above?"; } first(); ?>
  17. Its not just that function. Here is a brief layout of my code <? include_once(HOMEDIR."funcs/random_password.php"); include_once(HOMEDIR."funcs/copy_dbStructure.php"); include_once(HOMEDIR."funcs/credits_add.php"); include_once(HOMEDIR."funcs/credits_transfer.php"); function create_client() { global $my, $mobile, $email, $companyName, $firstName, $lastName; $clientID = 12; credits_transfer(); // using this as an example. see below for its contents } Here is the test function function credits_transfer() { global $clientID; echo $clientID } Its not because I have already called global inside the base function because I have tested without Then only thing I can think is maybe because im executing a function within a function it loses its right to use global?
  18. For some reason when executing a function which uses global $variable_name the $variable_name is empty echo $clientID; // Outputs the value of $clientID fine credits_add("1", "6", "FREE", "0.00"); // Does not output $clientID echo $clientID; // Outputs the value of $clientID fine credits_add() function is shown below function credits_add($userID, $credits, $paymentType, $rate) { global $clientID; echo $clientID; }
  19. Ignore this I overlooked something Sorted now
  20. THanks for input anyone else like to share with the class hehe
  21. How do you guys build a html page which is generated dynamically through php/mysql with pagination etc.. * I have seen people use html class to deal with fully populating the page * Someone else used arrays e.g $html['head'] .= "<script type=text/javascript></script>"; then just echo each of the array elements out What way do you use and what way is the 'correct' in terms of todays standards I have been playing around with doing it via html class but also like the idea of doing it using arrays to store key parts that make up the end result of the page Any basic examples would be nice too
  22. Ok cool I will just use global Thanks for input.
  23. Ha that still requires to call $my in some kind of additional way whether its using global, the example above or as a paramater I guess there is no way to be able to access $my inside a function without have some kind of reference inside the function or passed in as a param?
×
×
  • 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.