Jump to content


New Members
  • Posts

  • Joined

  • Last visited

John84's Achievements


Member (2/5)



  1. Hi all I have a database table that looks like the attached image This is basically a table of original messages and their replies, the `message_id` is the ID of the original message sent (the master) How can I perform a group by on both the 'id' and 'message_id' and the sort by ID (newest to oldest) So in my example it would return the ID's 7 - Message 4 6 - Message 3 Reply 1 4 - Message 1 - Reply 2 3 -Message 2 Any suggestions? I tried GROUP BY id,message_id but that didnt seem to work
  2. Seems to work very well, you are a life saver, thank you for all the help given
  3. WOW! That looks superb! I'll give it a try then let you know, thank you
  4. Yes very sorry, feeling a bit stupid now for my dumb example 😀 If I do a var_dump of the array then it comes out like 0 => string '1,930,9', 1 => string '2,370,3,4', 2 => string '6,930,9', 3 => string '3,930,2', 4 => string '8,370,2,1' so in that example, it would produce 0 => string '7,930,9', 1 => string '2,370,3,4', 2 => string '3,930,2', 3 => string '8,370,2,1'
  5. Also, sometimes it isnt a alphanumeric value for the car, sometimes it's a numeric value such as <input type="text" name="cars[]" value="3,930,2,8"> <input type="text" name="cars[]" value="6,370,7,1">
  6. Hi, thanks for response. The original array is created from a bunch of posted input values, that looks something like <input type="text" name="cars[]" value="1,BMW,15,13"> <input type="text" name="cars[]" value="8,BMW,15,13"> <input type="text" name="cars[]" value="3,Saab,5,2"> Annoyingly I dont have access to change any of the script which produces those inputs, all i can do is post them to my script
  7. Hi I have an array which looks a little like this, the first number in each array is a quantity $cars = array ( array(1,"BMW",15,13), array(8,"BMW",15,13), array(3,"Saab",5,2), array(4,"BMW",11,7), array(5,"Land Rover",17,15), array(6,"Saab",5,2) ); what I want to do is combine any array which matches another, but ignoring the quanitity value (first one). Then creating the array again and adding up the quanitity values and re-inserting them at the start. Therefore the end result would look like $cars = array ( array(9,"BMW",15,13), array(9,"Saab",5,2), array(4,"BMW",11,7), array(5,"Land Rover",17,15), ); Has anyone got any ideas on how I might do this? Thanks
  8. Hi all I have this htaccess code to 1: Remove php from any URLS 2: Add a slash to the URL RewriteEngine On # redirect PHP or HTM to no extension RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.(php|html?) [NC] RewriteRule ^ /%1/ [L,R=301] ## Adding a trailing slash RewriteCond %{REQUEST_FILENAME} !-f RewriteRule [^/]$ %{REQUEST_URI}/ [L,R=301] # check to see if the request is for a PHP file and rewite to no extension: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^/?(.*)$ /$1.php [L] If I go to www.domain.com/file.php then it redrects to www.domain.com/file/ which is good but if I go to www.domain.com/file then it doesnt redrect to www.domain.com/file/ How can I make it so if I go to www.domain.com/file then it adds the slash on the end Lastly. does the code look ok in terms of it conforming to the standards? Thanks, John
  • 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.