Note that there are some explanatory texts on larger screens.

plurals
  1. POInvalid query: Data too long for column 'x' at row 'y'
    text
    copied!<p>Haven't been able to find a useful solution for this yet, so I'm going to fire away. I keep running into this error whenever I try to run my verification script.</p> <p>We run a database management system for various schools and we collect the data for that entire school when the first user from that school registers (the superadmin, as it were). When subsequent members of staff from that school register, their register-entries are then checked against the database to link the new registree against the correct member of staff (if applicable, of course). </p> <p>To avoid errors whenever members of staff have the same surname/initials (which of course is quite likely), I am working on a verification script that automatically starts up whenever the amount of people with similar initial/surname combinations occur. </p> <pre class="lang-php prettyprint-override"><code>$sql=("SELECT `idStaff`, `Staff` FROM `mldb`.`staff` WHERE `Staff` LIKE '%$in%$sn'"); $qu=mysqli_query($dbc,$sql); id=mysqli_fetch_array($qu); if (mysqli_num_rows($qu) &gt; 1) { load ('duplication.php') ; } </code></pre> <p>On the duplication page, a full loop of all the members of staff (with their full name and subject area) are printed where the user can click on their corresponding name. The hyperlink in these names redirect to the verification script, which looks like this: </p> <pre class="lang-php prettyprint-override"><code>{ echo '&lt;p&gt;We have found multiple entries with that name. Please verify who you are.&lt;/p&gt;' ; { while ($row = mysqli_fetch_array ($r, MYSQLI_ASSOC)) { echo '&lt;br&gt;&lt;a href="verification.php?id='.$row['idStaff']. '"&gt; ' . $row['Staff'] . ', ' . $_SESSION['School'] . ', ' . $_SESSION['SubjectArea'] . ' &lt;/a&gt;' ; } } </code></pre> <p>Below is the verification script which (should) update the registered user table to add the staff ID and full staff name to the registered user so that they will never show up as duplicate anymore. </p> <pre class="lang-php prettyprint-override"><code>if(isset($_GET['id'])) $id = $_GET['id']; { $s = "SELECT DISTINCT `Staff` FROM `mldb`.`staff` WHERE `idStaff` = $id" ; $e=$_SESSION['Email']; // This doesn't work - why? // $q="UPDATE `mldbadmin`.`user` SET `idStaff`='$id', `Staff`='$s' WHERE `Email` = '$e' AND `idStaff` IS NULL"; $r=mysqli_query ($dbc, $q) ; if (!$r) { die('Invalid query:' . mysqli_error($dbc)); } else { header("location:confirmeduser.php") ; } } </code></pre> <p>However, I get the error message shown in the topic header when I run this script, which I can't work out why it happens - because all the columns should be able to handle all this data.</p> <pre><code>Invalid query:Data too long for column 'Staff' at row 1 </code></pre> <p>I feel I am missing out something really obvious here but I've been stuck on this for quite a while now. Is there anybody who could help me out with what I am doing wrong? Many thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload