Jump to content

murfitUK

Members
  • Posts

    207
  • Joined

  • Last visited

1 Follower

Recent Profile Visitors

3,334 profile views

murfitUK's Achievements

Member

Member (2/7)

0

Reputation

  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 problem is that I now need to find out how many clients made 1 phone call, how many made 2 calls, how many made 3 calls, etc. I do not need to know which clients called 3 times - just the total number of clients. The output of the query will be displayed something like: 241 clients called 1 time(s) 187 clients called 2 time(s) 45 clients called 3 time(s) 38 clients called 4 time(s) ... etc I've tried many combinations of count, distinct, group by etc but only succeed in getting myself even more confused. I know there is an easy way to do this but I can't find it! If anyone can help I would be very thankful.
  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 you want to achieve and then the steps you can take to reach it. So the first question you should ask (based on your post) if... why do I need two different forms? If you have no good answer than stick to one.
  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. Thanks everyone. graph2.pdf example.pdf
  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; $spoke<=7; $spoke++) { $angle = ($spoke-1) * (360/7); $x2 = (sin($angle) * $s) + $x1; $y2 = (cos($angle) * $s) + $y1; // draw a line from (x1,y1) to (x2,y2) $pdf -> line($x1, $y1, $x2, $y2); } // output the result$pdf -> ezStream();?> The first spoke works OK but it all goes downhill from there. I have attached the pdf output so you can see what I mean. What makes this worse is that my university degree is in mathematics!!! But it was 30 years ago and I've forgotten everything I ever learned. graph.pdf
  6. Try this:body { background-image: url('http://img155.imageshack.us/img155/7028/bebop2rc6.jpg'); background-repeat: no-repeat; background-position: bottom right; }
  7. Yes, just put this in your CSS. This example shows how can have different styles for the different input types (text, select, button).input.textual { background-color: #e6ac73; color: #406480; border: 1px solid #ffffff; padding: 3px; font-size: 100%; font-weight: bold; }select.dropdown { background-color: #e6ac73; color: #406480; border: 1px solid #ffffff; padding: 3px; font-size: 100%; font-weight: bold; }textarea { background-color: #e6ac73; color: #406480; border: 1px solid #ffffff; padding: 3px; font-size: 100%; font-weight: bold; }input.button { background-color: #e6ac73; color: #406480; padding: 3px; font-size: 100%; font-weight: bold; }input.check { background-color: #e6ac73; border: 1px solid #ffffff; padding: 3px; font-size: 100%; font-weight: bold; }Then your html will be something like:<input type="text" name="name" class="textual"> for a line of text<input type="checkbox" name="name" class="check"> for a checkbox<input type="submit" name="name" class="button"> for a button<textarea name="name">bbbb</textarea> (don't need to do a class because textarea is defined in the cssand for the drop down list:<select name="name" class="dropdown"> <option value="value">text bit here</option>..</select>You can leave out the class and just have one defined if you want all your inputs to look the same:input { background-color: # etc;}and then you only need your html<input type="text" name="name"> without having to declare the class.
  8. Ah. My local machine is still on 4.0.24, and I don't really want to go about changing things because it was so much trouble getting php, mysql and phpmyadmin all set up originally.The web host company that I use is on 4.1 and I've tried it online - the sub query works just fine.Thanks Vijay, at least I know where the problem lies now.
  9. murfitUK

    IE6 Bug

    I don't get the same problem when I try with IE6. Anyway, it sounds like it could be one of IE's known bugs. Go to the site below and have a look at the guillotine bug.http://www.positioniseverything.net/explorer.html
  10. Hi Vijay - thanks for the reply. Sorry, but I still can't get it to work.This works:SELECT DISTINCT(catID) FROM details; - gives value 1,3,4This works:SELECT kind FROM category WHERE id IN (1,3,4); - gives values Chairs, Clocks, LightingAnd this works:SELECT kind FROM category WHERE id NOT IN(1,3,4); - gives value BedsBut I just can't combine the two without getting an error 1064 - you have an error in your syntaxSELECT kind FROM category WHERE id IN (SELECT DISTINCT(catID) FROM details);What am I doing wrong? I've tried the ` round the field names but still an error. I'm using mySQL - is the above only valid for SQL?
  11. Two tables:1) called "category" with 3 fields: id, kind, description eg0, "Tables", "We have a wide range of tables..."1, "Chairs", "Our large selection of chairs..."etc2) called "details", has numerous fields including one called "type" which has the id from the category table as all products are slotted into a category (so each category could have a large number of products).Trying to do a query to find which categories are not currently used for any products in the details table, but failing miserably. For example, might have in "category":2, "Beds", "All our beds are made from the finest materials..." etcbut if there are no beds in the details table then its an unused category which is what I'm trying to find.I know this should be simple to do but....Please help!
  12. Thanks for the replies - I think the thumbnail page will be the best way forward.After some experimentation I found that if I do <a href="file:pics"> (or file://pics or something like that) it opens a window in IE but not FF. I'll investigate further when I get time!
  13. Hi everyone. I'm back from my holiday in Australia and have put my travel experiences on my website. (If you want to look: websiteI'm creating a disc to send to my mum who has a computer but no internet access (she can't be trusted) and I've made it autorun so she just needs to stick it in the CD drive. The first page will have two options 1) view the website which is saved on disc and 2) open the pics folder so she can browse the photographs.Here's the problem. If I put a link to the pics folder using <a href="pics/"> it opens the folder in the browser with a list of filenames. I really want it to open up the folder as though she had double-clicked her way from the My Computer icon.This is what I mean...I don't want thishttp://www.murfituk.com/pics/no.jpgThis is what I wanthttp://www.murfituk.com/pics/yes.jpgThe reason is that she can then double-click on the first icon and it will open with Microsoft picture viewer which has the next and previous buttons at the bottom, so she can work her way through.Can anyone tell me how to do this? I'm stuck.Thanks.
  14. You can't do it with html alone. You can use html to lay out the form nicely but you then need some sort of scripting language to process the information that has been entered by the user. php is a scripting language although there are others.What should happen when the submit button is clicked is that "form action" calls a new page eg sendmail.php This page then obtains all the information passed to it by the form and carries out the script on the page. Part of this script will check that a valid email address has been entered. If all is OK, the email is sent - but you need your website hosted on a server that is capable of the emailing function as well as being able to run scripts like php.
  15. DELETE FROM tablename WHERE ...... deletes individual rowsTRUNCATE tablename deletes all rows in the table. In some version of sql it also resets any auto increment back to zero. Its equivalent of DROPping the table (ie deleting it completely) and then recreating it. There are difference depending on version of sql/mysql and also some differences depending on the type of database (innodb, myisam).
×
×
  • Create New...