Jump to content

grissom

Members
  • Posts

    166
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

grissom's Achievements

Member

Member (2/5)

0

Reputation

  1. In your main mysql query where you are getting the records from the database, there doesn't appear to be any restriction against it getting all the records .. if you are looking for one specific record, your query should end something like " ..... WHERE id = '$_GET[id]'"
  2. Okayyyy... the error is line 26 which is $fname = $_POST['fname']; The error is telling you that the variable $_POST['fname'] does not exist by the time you get down to this line Your curly brackets around the if($_POST) { ...} section of code end before line 26, so perhaps you need the closing bracket around the whole section of code like this if ($_POST) { ... ALL your PHP in here, because otherwise it will get executed anyway regardless of POST data or not } If that doesn't work, try changing the line to if (!empty($_POST))
  3. Solved it folks ! I had the line 'cols'=array($basicarray) and of course $basicarray already WAS an array ! so it should have been just 'cols'=$basicarray
  4. The problem is that although no errors are being thrown up, the table is not formatting with the column widths I am specifying As a bit of extra info, here's an example of how I would set up and call the function $data = array(); $data[] = array('Date'=>'12-12-2015', 'Name'=>'Alice', 'Postcode'=>'HG1'); $data[] = array('Date'=>'25-11-2015', 'Name'=>'Bob', 'Postcode'=>'SE2'); $widths = array(100, 120, 60); basictableformat($data, $widths);
  5. Hi guys. This one should be really simple but I've got a mental block on it and would really appreciate some help. I'm using some classes from an existing open source class EZPDF to format a table, and their syntax for doing so is like this (here's an example .. here we take an array called $data with fields 'Date', 'Name' and 'Postcode' and assign widths to the columns) $pdf->ezTable($data,'','',array('showHeadings'=>1,'shaded'=>1,'showLines'=>1, 'cols'=>array('Date'=>array('width'=>120), 'Name'=>array('width'=>100), 'Postcode'=>array('width'=>80)) )); Well, that looked a little bit too much work for my lazy brain, so I decided to extend the class and write a new function which basically read in all the data keys and matched them to an array of widths and then did the same thing. But with more convenient shorthand for me ! So here's how I approached it : function basictableformat($data, $widthsarray) { $basicarray = array(); $i = 0; foreach ($data[0] as $key=>$value) { $widthbit = array('width'=>$widthsarray[$i]); $basicarray[$key] = $widthbit; $i++; } $this->ezTable($data,'','',array('showHeadings'=>1,'shaded'=>1,'showLines'=>1, 'cols'=>array( $basicarray ) )); } However, as you can guess .. this didn't work ! It should be EASY but I've just got a Sunday morning mental block on it. Any help folks is massively appreciated.
  6. The first car has a choice of 10 drivers The second car has a choice of 9 drivers (the first driver has been assigned) So the number of ways of filling the first two cars is 10 X 9 = 90 The number of ways of filling the first three cars is 10 X 9 X 8 possibilities = 720 .. and so on. You make yourself look a complete p**** with your above comment. I suggest you take some night classes in maths before you get cocky and post stupid insulting graphics
  7. If you have 10 cars and 10 drivers then there are 10! (ten factorial) ways of assigning each driver to a car, This is 3628800 different ways. Read all the drivers into an array called $drivers[] Then read all cars into an array called $cars[] Randomly shuffle the arrays by using the PHP shuffle command shuffle($drivers); shuffle($cars); Now put driver[0] with car[0], driver[1] with car[1] etc etc.
×
×
  • 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.