Jump to content

Barand

Moderators
  • Posts

    24,604
  • Joined

  • Last visited

  • Days Won

    830

Everything posted by Barand

  1. Bear in mind that that is only one example. The same situation can occur at other places along the "input/store/output" process.
  2. It could be the HTML markup style when using quotes within quotes For example $name = "O'Sullivan"; echo " <form> Enter surname <input type='text' name='surname' value='$name'> <br> <button type='submit' >Submit</button> </form> "; displays Whereas $name = "O'Sullivan"; echo " <form> Enter surname <input type='text' name='surname' value=\"$name\"> <!-- changed quotes around $name --> <br> <button type='submit' >Submit</button> </form> "; displays You also need to ensure that prepared statements are used when updating your DB tables as this will correctly handle such surname data.
  3. If by "Issue" you are referring to the various item checks then no change would be required. For example, it will be possible to filter all those that fail the "Googly Eyes Check" or "the "Lidar Rotation Check". If, however, by issue you are referring a lower level of detail within these checks then my earlier comment stands and change is needed.
  4. 1. For your Save as CSV Email report Print report You are going to need image files for each of the signatures if they are to be included (via image URL). You will also need to master PDFs for the printed versions. 2. If you want a breakdown by "issue" then your visit_item data needs an issue code. You cannot rely on freeform text - minor mis-spellings corrupt the data. You probably also need a table defining the issues that can arise for each item. Instead of comment text, the tech would select from a menu. You data capture app is in for some significant changes. 3. What is "BAR number"? I do not see it in the data.
  5. try $hashtags = '#adf #234432 #fwerfw'; $array = explode(' ', $hashtags); foreach ($array as $var) { echo "<div style='width: 200px; border: 1px solid red; margin: 8px; padding: 8px'>$var</div>"; }
  6. With care not to use any features that have been added within the last five years, or any that are about to be removed in later versions (to protect against future updates of your implementation), then it can be achieved. However, it's always best to be up to date with version used, and as you are pre 5.6, I would recommend an update. (Having said that, I'm a couple of versions behind (7.2) )
  7. Wow!
  8. All those languages yet the term "normalize" remains a totally foreign concept.
  9. You are using an outdated version of PHP (pre v5.6) Change $act = (sqrt($dx**2 + $dy**2) > 30) ? 'M' : 'L'; // check distance between successive points to $act = (sqrt($dx*$dx + $dy*$dy) > 30) ? 'M' : 'L'; // check distance between successive points
  10. This the function used to create the left-hand side images (uses scaleable vector graphics (SVG) ) function drawImage($xcoords, $ycoords) { $xa = $xcoords[0]=='[' ? json_decode($xcoords, 1) : explode(',', $xcoords); // put x coords into an array $ya = $ycoords[0]=='[' ? json_decode($ycoords, 1) : explode(',', $ycoords); // put x coords into an array $w = max($xa)+10; // get the max coord values so we know the size $h = max($ya)+10; $path = ''; $px = $py = -31; // ensure we Move to first point foreach ($xa as $i => $x) { // loop through arrays $y = $ya[$i]; // pairing the ith x with the ith y $dx = $x-$px; $dy = $y-$py; $px = $x; $py = $y; $act = (sqrt($dx**2 + $dy**2) > 30) ? 'M' : 'L'; // check distance between successive points $path .= "$act $x $y "; // define line to x y } // create svg object $w x $h to display image $im = "<svg width='$w' height='$h'> <path d='$path' stroke='#000' stroke-width='2' fill='none'/> </svg>"; return $im; } The image on the right was an experiment to create a .png version. I don't think the quality is as good as vector ones.
  11. One table for likes , one for dislikes and and a third for views Perhaps combine like/dislikes with a flag column to distinguish
  12. more ... than ... one.
  13. And what would you do if they have multiple likes, dislikes and views?
  14. I am proposing
  15. As an aside, below is a comparison of different versions of the drawImage function. The one on the left looks for successive points that are more than 30 pixels apart and assumes the pen was lifted if they are. The one on the right just joins everything, as now.
  16. If all the item_xxx columns will be empty then don't bother - is was their content I was interested in.
  17. If you don't have that anymore then what will the signature app write to?
  18. Now I've loaded the table I see that it is the wrong one. I wanted the one you are currently using - the one with all those item columns
  19. That's fine. It will save me a lot of time creating the table and my own test data.
  20. Seems like you have a problem somewhere in the first 23 lines.
  21. If you send me a dump (structure and data) of your current pmvisit table (or at least a chunk of the data I can test with) I can create a daily update script to transfer the data into the new tables.
  22. OK, you have my sympathy.
  23. You have put all the items in a single row again. Should be CREATE TABLE `visit_item` ( `visit_id` int(11) NOT NULL, `item_no` int(11) NOT NULL, `pass_fail` tinyint(4) DEFAULT NULL, `comment` varchar(50) DEFAULT NULL, PRIMARY KEY (`visit_id`,`item_no`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; There is more normalization required. In every visit record you have "store_number", "store_name", "store_loc". There should be a "store" table where the name and location are stored once foe each store. Only the store number should be in the visit record.
  24. yes, you will. Look at my code again.
  25. PDO statements (and result objects from a query() ) are traversable, so you can just foreach ($stmt as $row) { echo $row ['user_firstname']; } Unfortunately, mysqli result objects only are traversable, not prepared statements. There is a $stmt->get_result() but it is not available in all implementations (native driver only). Makes you wonder why people use mysqli. You may be stuck with using while ($stmt->fetch() ) { // build array $data[] = [ $fn, $ln, $id, $role ]; }
×
×
  • 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.