Jump to content

Barand

Moderators
  • Posts

    24,566
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. Below is an extract from the mysql reference manual As you can see, with the exceptions of "PRIMARY KEY" and "FOREIGN KEY" (which can be considered to be reserved phrases) the terms "index" and "key" are interchangeable.
  2. That would the meet the requirement for "logical, meaningful and unique". Beware name clashes though. They (constraint names) need to be unique within the scope of the database schema. Table alias name scope is only the query.
  3. As with the example I gave earlier for an index name (idx_xxx_yyy) then use similar for, say, foreign key constraints (FK_xxx_yyy) Keep them logical, meaningful and unique (eg FK_Pinocchio )
  4. Disney character names for constraints
  5. To me it sounds like I don't name them because they will be given reasonable names automatically
  6. I'm surprised it got past the prepare statement before giving an error. Where do $id and $row come from? Are the two sections of code above related in any way? If, say, you want to add 3 records inserting post_id and category_id into each then the query that gets prepared should look like "INSERT INTO posts_category_ids (post_id, category_id) VALUES (?,?),(?,?),(?,?)"
  7. I name mine after Harry Potter characters. However if I create an index without a name using MySQL Workbench it auto names it for me. If I index column yyy in table xxx it gives it the name "idx_xxx_yyy"
  8. Was your friend's ISP kind enough to say why it will only work on version 5.6? And by that statement do they mean the script requires 5.6 or earlier, or do they mean it requires 5.6 or later? (it's unlikely that something will run on one version only)
  9. https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_year
  10. mysql> SELECT monthname(from_unixtime(target)) as Month -> , COUNT(*) as Total -> FROM production -> GROUP BY month(from_unixtime(target)); +----------+-------+ | Month | Total | +----------+-------+ | October | 3 | | November | 5 | +----------+-------+
  11. I have experienced difficulty in adding a new line after a quote at the bottom of a reply. I get round it by inserting a newline above the quote then dragging the quote box above that new line.
  12. I need a little thinking time. You've had weeks on this. PS. This has very little to do with the problem of drawing a signature
  13. Bear in mind that that is only one example. The same situation can occur at other places along the "input/store/output" process.
  14. 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.
  15. 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.
  16. 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.
  17. 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>"; }
  18. 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) )
  19. Wow!
  20. All those languages yet the term "normalize" remains a totally foreign concept.
  21. 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
  22. 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.
  23. One table for likes , one for dislikes and and a third for views Perhaps combine like/dislikes with a flag column to distinguish
  24. more ... than ... one.
  25. And what would you do if they have multiple likes, dislikes and views?
×
×
  • 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.