Jump to content

searls03

Members
  • Posts

    906
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://troop078.net46.net

Profile Information

  • Gender
    Not Telling

searls03's Achievements

Advanced Member

Advanced Member (4/5)

1

Reputation

  1. I am trying to run two queries within one I guess you could say. What I am trying to do is build a scoring system where each person gets two chances. The least number is their best. What I need to have happen is for the php query to select the smallest number for each person, then display the 3 names of the people with the 3 smallest numbers. I am guessing I need to use a query like this to get the smallest number for each person: $sql = mysql_query("SELECT LEAST(MIN(COL1),MIN(COL2))FROM yourtable;"); but after this I am stumped as to how to make it display the names associated with the 3 smallest numbers. Can anyone help me out?
  2. and this is in a PHP insert query btw.
  3. Hi, I am completely stuck on this. I am trying to allow the user to select a start day and end day. then the system adds two weeks to the start day and each previous calculation (ie intervals of 0 weeks, 2 weeks, 4 weeks, etc. from the start day) until the end date is reached. I would also like each of these dates to be inserted into my database. I have no clue as to where to even start with this. I know I will need some kind of loop based on days, but I am not sure how I would write this. I suppose this would be the basic structure of the query, but not sure how to incorporate this loop that I need. mysql_query("INSERT INTO events (title, date) VALUES ('$title', '(current date that the loop is in)')"); mysql_error(); can anyone help me out with this? thanks in Advance!
  4. sorry, I was thinking in the current query it says date, not start. start IS in the query....like it says right after that. sorry
  5. hi I have a code that puts events into a calendar. I am doing a new calendar for a new client and have some different issue that are arising. the original code I have is meant for a "one day" event. I am now trying to place in a "multi-day" event. how can I change this query to a multi-day selector. $result = mysql_query("SELECT * FROM events where start='".$m1."/".sprintf ("%02u", $d)."/".$year."'"); I need to keep everything after "start =" the same. However, start is nolonger in my database, it is start and end. How can I generate a query that selects it for multiple dates where it is between start and end. does this make sense? thanks
  6. my php query: <?php $sql1 = mysql_query("SELECT * FROM attendance ORDER BY id ASC"); while($row1 = mysql_fetch_array($sql1)){ $current = $row1["id"]; $name = $row1["name"]; echo $current; echo "<br>"; } is not sorting properly. it is putting all 6 digit numbers before 5 digit numbers....here is what it is returning 100000 ... 311655 311657 311711 311789 311790 311791 311792 311793 311794 311795 69326 69390 69451 69547 99985 99989 99990 99991 99992 99993 99995 99996 99997 99998 99999 does it have anything to do with the numbers not being consecutive? I can't have this.......I have another insert query that adds one to the last number output....which clearly it won't do because the new would be the same as the first number. can anyone help me with this?
  7. hi all. I am looking for a way to order a php query result by a specific value, not like an id ASC, but like first column 1=red(there could be multiples, so all that have column 1 as red display first), then column2=blue. I have been looking all day and havent been able to find anything. any help?
  8. Actually that fate won't be there anymore, the "date" for reference will be created via php.
  9. hello all, I have been working on a calendar system for someone, and they were using one date events....now they want events with a range. I have this code working to select one date $result = mysql_query("SELECT * FROM classes where date='".$m1."/".sprintf ("%02u", $d)."/".$year."'");....this is fine, don't critique it please. My data base now has a start date and an end date fields in them. I need to know how I can pull the data if the date that I want to display falls inbetween or on those startdate and enddate field. so for example, May 1st through the 5th is an event called test i would like it to pull data and then display it similar to this: 1-test 2-test 3-test 4-test 5-test the numbers being the May "date". can anyone help me with this?
  10. no, cURL stays on current page
  11. and I don't want to do it via a form because it would contain prepopulated sensitive info
  12. Wish I could, but I need a way where it will actually go to the page with the posted variable present. So the same page an HTML form would go to.
  13. this may be a vague question, but is there a way for PHP to generate a POST variable and then send that variable to a page on a different server? so PHP creates lets say a POST variable for "name" (this should be equivalent to an html form with the name of "name"), so then it can submit to a form on an external server that only accepts specific names of elements? does this make sense?
  14. so I finally have this working! <?php date_default_timezone_set('America/Los_Angeles'); error_reporting(E_ALL); ini_set("display_errors", 1); $offset = isset($_GET['offset']) ? intval($_GET['offset']) : 0; $currMonth = date('n'); $list = array(); $list[] = mktime(0, 0, 0, $currMonth+$offset, 1); $list[] = mktime(0, 0, 0, $currMonth+$offset+1, 1); $list[] = mktime(0, 0, 0, $currMonth+$offset+2, 1);?> <table> <?php foreach ($list as $dateTS){ echo '<tr style="background-color:#CCC"><td>'; echo '<strong>'.date('F Y', $dateTS) . '</strong><br /> </td></tr>'; $sql = mysql_query("SELECT * FROM events where public='yes' order by id ASC"); while($row = mysql_fetch_array($sql)){ $start1 = $row["start"]; $end1 = $row['end']; $event = $row['name']; $id = $row['id']; $start = new DateTime($start1); $end = new DateTime($end1); $inc = DateInterval::createFromDateString('first day of next month'); $end->modify('+1 day'); $p = new DatePeriod($start,$inc,$end); foreach ($p as $d) if($d->format('M Y')==date('M Y', $dateTS)){ $originalDate = $start1; $newDate = date("m/d/Y", strtotime($originalDate));$originalDate1 = $end1; $newDate1 = date("m/d/Y", strtotime($originalDate1)); echo '<tr><td><a href="event.php?id='.$id.'">' .$newDate.' - '.$newDate1.' '.$event.'</a><br /></tr></td>'; } } } $prev = $offset-3; $next = $offset+3; echo "<br><a href='?offset={$prev}'>Prev</a> <a href='?offset={$next}'>Next</a>"; ?> I do have one issue though, how and where do I place a message that will display no events scheduled if the month has no events scheduled?
  15. I gues that isn't all, I also want to then grab all the columns from table one, event_id, qty, event. and then also spots, name from "events"
×
×
  • 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.