Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

Copilot 🤖

Members
  • Posts

    107
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.foobar.me.uk

Profile Information

  • Gender
    Male
  • Location
    Berkshire - UK

Copilot 🤖's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, Pull your results sorting by date order so adding a order by <date_field> DESC to your query if you dont have it already. Then you can compare the last date row against the current if its the same just print the row if its different print the header first. Example: $sql = "SELECT * from TABLE order by <date_field> DESC" $old_date = False; $result = mysql_query($sql); while ($row = dbarray($result)) { if ($old_date != $row['date_field']) { echo $row['date_field']."<BR />"; } echo $row."<BR />"; $old_date = $row['date_field']; } Not Tested but should work. Dave
  2. Hey to and from are reserved words in mysql - change to: INSERT INTO pms (`to`, `from`, `contact`, `title`, `message`) VALUES ('7', 'asdf', 'asfd', 'sdf', 'asdf') this will get the query working but I would rename those fields to something else
  3. You have an extra close bracket at the end of this line $query = "INSERT INTO newsletter_signup VALUES ('$form1','$form2','$form3','$form4','$form5','$form6','$form7','$form8','$form9','$form10','$form11','$form12')"); should be $query = "INSERT INTO newsletter_signup VALUES ('$form1','$form2','$form3','$form4','$form5','$form6','$form7','$form8','$form9','$form10','$form11','$form12'); Apart from that no.
  4. Your missing a ; on your include statement include ("connection.php");
  5. Yup you can use "Next Wednesday" as a modifier for the strtotime function. $newDate = strtotime("Next Wednesday", time()); echo date('jS F Y',$newDate); Check out this page for other valid modifiers: http://www.gnu.org/software/tar/manual/html_node/Relative-items-in-date-strings.html#SEC120
  6. I cant see why it would be 2 more but it makes sense that it is 1 more. Your for loop is checking that the value if $counter is equal or less than $num.. if it is not then break the loop - that means the final value of $counter is 1 more than $num. As your loop can only loop through to the value of $num (there is no break condition) you might as well just display Added ".$num." bowls.
  7. if ($ticket == "cool" || $ticket == "not cool" || $ticket == "wow") { $pass = "YES"; } else { $pass = "NO"; }
  8. Hello mate, I have just solved a similar problem on a project I am currently working on. I didnt put the logic in SQL however - I pulled a wide result and then pushed the results in PHP - obviously you can choose how you do it but the following captures all possibilities. IF ((ReqArr < arrival) && (reqdep > arrival) || IF (ReqArr >= arrival) && (reqdep <= departure) || IF (ReqArr > arrival) && (ReqArr < departure)) Not sure whow you would translate that logic to SQL but will hopefully push you in the right direction. Dave
  9. Hi Gazever, Have you tried the single character wildcard? like 'd_t_' Havent tested but I think that would work.
  10. Im not 100% - but cant you just put the $entrye data between the <TEXTAREA></TEXTAREA> Tags - rather than using the Value="" attribute?
  11. You were not far off $result=mysql_query("SELECT sum(total) as total FROM my_table WHERE seller_id=$seller_id"); $total = mysql_fetch_array($result); echo $total;
  12. php_dave

    SQL help

    SELECT MIN(story_historyID) from story_history Group By StoryID Not tested.. but I think the above would work - will select the smallest HistoryID for each storyID.. assuming the smallest historyID is the earliest version?
  13. Hey, You shouldnt be calling the realname function as this only returns the field "name" from cerebra.. change this $thissquadronDBID = $advisee["squadronDB"]; $squadronDBRealName = getRealName($thissquadronDBID); to this $squadronDBRealName = $advisee["squadronDB"]; And your Squad names should display as intended.
  14. Aye it appends 'QUERY_STRING' - my bad - apologies for the bum steer. As for the OPS comparison problem - I cant see any logic problems - I just replicated on my machine and the comparison returns True.
  15. Hi mate, This query $sql = "SELECT id, squadronDB FROM cerebra WHERE approved=\"true\" AND squadronDB IS NOT NULL AND squadronDB != \"\" AND type=\"student\" ORDER BY squadronDB"; what does squadronDB return? is it a number or ALPHA, BETA?
×
×
  • 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.