Jump to content

wellscam

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Everything posted by wellscam

  1. $query = odbc_exec($odbc, "SELECT Top 1 * FROM AllInfo WHERE IO = 'Out' AND CO = '51' ORDER BY [DateTime] DESC LIMIT 0,1") or die (odbc_errormsg()); Returns: [Microsoft][ODBC Microsoft Access Driver] Syntax error in ORDER BY clause.
  2. Hey, I'm querying an Access database using PHP with this query to return the last entry in the database and display how current it is. $query = odbc_exec($odbc, "SELECT Top 1 * FROM AllInfo WHERE IO = 'Out' AND CO = '51' ORDER BY [DateTime] DESC") or die (odbc_errormsg()); while($row = odbc_fetch_array($query)) { echo 'Database current as of<strong> '.date("F j, Y, g:i a", strtotime($row['DateTime'])).'</strong> and will update every 23 minutes.'; } The problem is, if there are 2 or 3 identical records in there, it will return all of those records. How do I tell it to only return the first one? Or maybe add a second order by parameter?
  3. I'm not sure, but that's okay, I can just change my query to use the data from the field that it does work on and get the results I need.
  4. That didn't work for my Time date, but I had another column called DateTime that it worked perfectly for...thank you so much!!
  5. Hi! I am retreiving information from an Access database using PHP, and having a problem displaying the time. Here is my Query and the line that returns the time: $sql0 = "SELECT * FROM AllInfo WHERE Extension = '$ex' AND Date=#$id#"; echo '<td><center>'.$row['Time'].'</center></td>'; And this is what it returns: 1899-12-30 06:31:00 I can't figure out how to make the time (1899-12-30 06:31:00) show up with just the time (06:31). I have read the overview in the code repository, but it just deals with MySql timestamps and this is from an Access Database. Everything I try just breaks my page. Help!! ???
  6. Thank you so much for getting me started in the right direction!!
  7. I think so, but If I'm reading that right, it's actually going to combine all of my extensions into one result right? What I'm trying to do is get a total count of dials and talk time for each extension individually. Am I misunderstanding the query?
  8. Wow, you make it sound so simple!! I've never used any of these functions before! I know it's asking a lot, but think you might be able to hepl me with coding this part: I'm so new at this I feel like I'm trying to speak French and I only understand how to say yes, and no, and ask where the bathroom is at! I can usually look at examples and logically figure it out then try to adapt it to my own purposes, but I've been trying to do that for this now for a couple months (as I find the time) and just can't seem to figure it out!
  9. Hello! I'm super stoked I found you guys, this is the quickest, least amount of crap php site I have been able to find and I hope you can help me out. I am running PHP 5.2.4 and connecting to an Access database generated by our phone switch (I would prefer MySql, but the switch software creates and maintains the database, I'm just tapping into it). I am fairly new to PHP and looking to get some help with a large query I set up for our phone system. Basically, what I want to do, is make the huge hand-coded query more dynamic and smaller so that it returns results faster and I don't have to edit a bunch of code every time something changes (which is often!). Here is the query: $sqlCJB = "SELECT Count(*) AS TotalNumberOfCallsCJB FROM AllInfo WHERE Extension = '3911' AND Date=#".$id."#"; $timeCJB = "SELECT Date, Extension, sum(DurationS) AS CountOfDurationCJB FROM AllInfo WHERE Extension = '3911' AND IO = 'Out' AND Date=#$id# GROUP BY Date, Extension, IO "; $queryCJB = odbc_exec($odbc,$sqlCJB) or die(odbc_errormsg()); $timequeryCJB = odbc_exec($odbc,$timeCJB) or die(odbc_errormsg()); /* *** Query Carrie J Boreham*** */ while($row = odbc_fetch_array($queryCJB)) { echo "<tr>"; echo "<td class=\"borderTable\"><center>3911</center></td class=\"borderTable\">"; echo "<td class=\"borderTable\"><center>Carrie Boreham</center></td class=\"borderTable\">"; echo "<td class=\"borderTable\"><center>".$row['TotalNumberOfCallsCJB']."</center></td class=\"borderTable\">"; while($row = odbc_fetch_array($timequeryCJB)){ echo "<td class=\"borderTable\"><center>".minutestoHours($row["CountOfDurationCJB"])."</center></td class=\"borderTable\">"; } } // end while Then I have this in the file 50 times under different query and sql names for all the employees. What I would like to do is figure out how to make this loop on itself based on another file that I can edit on the fly to simple add or remove someone from the list, then have the output sortable by column ( I don't know how to make this sortable. ) echo "<center><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"borderTable\"> <tr><th class=\"borderTable\"> Extension </th><th class=\"borderTable\"> Username </th><th class=\"borderTable\">Total Dials</th><th class=\"borderTable\">Total Talk Time</th></tr>"; Think maybe someone can help me out on this? I know it's probably pretty simple for someone who does this all the time, I just can't figure it out.
×
×
  • 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.