Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About bevc

  • Rank
  1. This is related to another question I asked that I haven't managed to resolve, so I'm trying something else! I have an associative array fetched from mysql, and I need to sum values based on the value in a different column. I have created an associative array, and printed to screen and it looks okay. It returns what I need, and looks like [1] => 779700.00 ) Array ( [4] => 868.00 ) Array ( [2] => 102000.00 ) Array ( [2] => 775808.00 My problem is that I need to be able to sum the results for each individual key value pair (so eg '2' would sum to 877808.00) - there are only eight
  2. It wasn't that, but thank you very much for the reply. I also realised that I put the wrong array in the foreach, but that didn't fix it either! I can't figure it out, so I've gone back to the drawing board to try something else. Cheers.
  3. I'm having a problem with a foreach loop that isn't doing what I need it to. I want to take an array of id numbers, fetch the figures related to that id number from my mysql db and sum them. Initially the problem was that my loop was 'overwriting itself' so that the only summing it did was of the last id number. Then after I fixed that, although I have used a 'unique array', it seems that the loop is still summing everything, ie if the array contains the same id number 8 times, it loops through and multiplies that figure x8 (at least I think that's what it's doing). I'm not sure why while(
  4. That worked, thank you very much indeed, I should have been concentrating on the SQL statement(s) and checking them first in phpmyadmin! Once I had got that right I felt much more confident in what I was doing
  5. I'm having a bit of a problem which I think I might know the solution, but I'm really struggling to know the correct syntax. If somebody could point me in the right direction I'd be very grateful. I've created an application where users can create projects, and within the projects there are 'outputs' and 'inputs'. All of which is stored in separate MySql tables. It works fine. I have now been asked to create an addition layer, a 'programme' layer, which sits above projects (ie there can be multiple projects within one programme). I think I have got my table normalisation correct, I c
  6. Thank you very much for the response, your book was EXTREMELY helpful, and was what got me through the project (my first php experience), I’m looking forward to reading your other books on php and Ruby too! I used something called 'html2canvas' and some cribbed javascript which created a pdf but the file was huge, and the content didn’t render property at all. I have been able to use ‘html2pdf’ and ‘dompdf’ to create ‘Hello World’-type pdfs, but I can't figure out how to take the dynamically created content and create a report that looks like what appears in the browser. I know very li
  7. I apologise in advance if I'm committing a faux pas posting here, I couldn't see any forum rules! I read Mr Ullman's PHP for the web book, and it was the best I've read, really clear and easy to follow, it helped me from start to finish on what was (for me) a very big project, but this topic doesn't relate to it. I have what I thought would be small problem, but is causing me endless headaches. The users on my project have requested that the final report (that is created using php and mysql) be downloadable as pdf. The best I have managed is a fuzzy blurry pdf that's hugely bloated a
  • Create New...