Jump to content

murfitUK

Members
  • Content Count

    207
  • Joined

  • Last visited

Community Reputation

0 Neutral

About murfitUK

  • Rank
    Member
  1. My brain has gone to sleep and I cannot work out how to write this simple query! Note, this is for mysql. I have a table called `calls` which is used to collect telephone call information. Some of the fields are: `id` `client_id` `date` There are others such as what the call was about, but that's not important right now. I can get the total number of phone calls received during a specified period with the query: SELECT COUNT(*) AS `total` FROM `calls` WHERE `date` BETWEEN '{$rsd}' AND '{$red}' [rsd and red are report start date and report end date] So far, so good. My prob
  2. Mudsaf is correct that your website host has probably disabled this function. If you can call a script on one of your websites from a different website then it means others can do so to - and you don't want that to happen. You should google for cURL and look at some of the tutorials available. You might be able to do it that way instead, although some hosts disable this as well.
  3. murfitUK

    2 function or 1?

    Will your users know if they are regular or business users before they fill the form in? What if they fill in a business form and then find out they should have filled in the regular form (or the other way round)? To make it easier for your users - and for you - why not have just one form. Some fields will always have to be filled in (name, email etc) and some will be optional and these can all be on the same form. One of the things I have learned since taking up programming and web design is that the best way of starting a project is to get a pen and paper and write down EXACTLY what it is
  4. I'm so glad it turned out to be a php problem and not that I'd forgotten everything I had ever learned! I didn't realise that sin and cos needed radians and not degrees. Interestingly, my apache server returns PI as 0. I have to use M_PI. Don't know why. The succesful result is attached as graph2. The eventual aim is for my users to be able to generate a chart like that attached as example. At the moment they use excel but want the data stored on their client database instead. I have already got the database set up for them to enter the data and now concentrating on creating the results.
  5. murfitUK

    Mathematical help

    I am attempting to use php and a pdf creator to generate a chart. It is the mathematical bits I need help with. Basically, the chart has 7 lines (spokes) radiating at equal angles from the centre. <?php// create the pdfinclude ("class.ezpdf.php");$pdf =& new Cezpdf();$pdf -> selectFont("./fonts/Helvetica.afm"); // these value determine the position and size of the graph// (0,0 is the bottom left hand corner of the page)// x1 is the x centre of the graph$x1 = 200;// y1 is the y centre of the graph$y1 = 200;// s is the scalar$s = 100; // create the skeleton of the graphfor ($spoke=1
  6. After much hair-pulling and gritting of teeth I have finally solved my problem. I realised I wasn't counting sessions properly. I had COUNT(`item`.`desc`) instead of COUNT(*) which was giving incorrect results. The query I've produced is: SELECTCONCAT(`children`.`lastname`, ', ', `children`.`firstname`) AS `Name`,IFNULL(`item`.`desc`, 'Total--->') AS `Activity`,COUNT(*) AS `Sessions`,SUM(`item`.`hours`) AS `Total`FROM`record`, `children`, `item`WHERE`record`.`child_id`=`children`.`id`AND`item`.`record_id`=`record`.`id`AND`record`.`end`='0000-00-00'GROUP BY`Name`,`item`.`desc`WITH ROLLUP T
  7. I need some help setting up a query. There are three tables and the relevant fields are shown below: CHILDREN (id, firstname, lastname)RECORD (id, child_id, startdate, enddate) [enddate will be 0000-00-00 if not yet ended]ITEM (id, record_id, date, desc, hours) Children table might show something like17, Peter, Brown22, Sammy, Watkins Whenever a child is accepted into our service we create a record with the start date and eventually an end date when they leave. The record table will also show their support worker and other info but that's not important right now. Record table might show:6, 2
  8. This related to MYSQL (not SQL).I have a table with a field called HBRef. This value can be null but if a value is entered it must be unique. In mysqladmin I have set the field's default value to null and the attribute to unique. Now I cannot enter a new record with HBRef as null because such a value already exists.How do I set it up so that the field HBRef has a unique value unless it is null?Thanks.
  9. It's been a while since I've used jquery but I think you do something like this:$("#date").datepicker( "option", "yearRange", '1950:2011' );
  10. Thanks Deirdre's Dad. I am updating my php as we speak - I was still on some old version. The new function certainly goes some way to simplifying things.
  11. Yes, I suppose I am just venting but my point remains: working with dates in php is not as straightforward as it should be.justsomeguy's 4 lines of code does exactly what is required and is the way I've been doing it for ages but... its still 4 lines of code just to work out next week's date.
  12. I know I can put it all into a function - ready to call up whenever its needed. But why can't it be simpler? Look at mysql. If I type this inSELECT DATE_ADD('2011-08-23', INTERVAL 7 DAY);it gives the answer. Surely php should be able to do the same just as easily? Working with dates must be a really common task when using php but it isn't really as easy as it should be.I think I am getting more impatient in my old age!
  13. I have a string with a date: $date="2011-08-23". All I want to do is add seven days to this to get "2011-08-30".There must be an easy way to do this with php. I'm fed up messing around with mktime and strtotime and exploding strings and all the rest. Please help otherwise it won't just be the string that explodes!
  14. murfitUK

    Array problem

    Sounds as though that could be the solution but not sure were I start the iteration? Do I put the for loop inside the while statement or the other way round? I've just got myself so confused with this that I can't think straight now!
  15. murfitUK

    Array problem

    Maybe there is a way to do this that is so easy I can't see it!Have a database with a table of staff schedules. The table has an ID field, a field to identify the user, a date field and a text field. Each user obviously has a unique ID. If I want to see what William's schedule (user number 12) is for April 2011 I run the querySELECT * FROM `schedule` WHERE `user`=12 AND `date` LIKE '2011-04-%' ORDER BY `date`;Then I can do the usual while ($row = mysql_fetch_array($result)){print substr($row['date'],8,2) . " - " . $row['note'] . "<br />";}which will give me something like04 - Annual L
×
×
  • Create New...