Note that there are some explanatory texts on larger screens.

plurals
  1. POmysql results truncated here, but not there
    text
    copied!<p>My first post here. I have a mysql table, - InnoDB - latin1-bin There are about 300 rows/9 columns. This is a choral library, so most of the columns are varchar, except for an auto-incremented key index column. Much like a book collection; title, author, composer, etc.</p> <p>There are two types of views, list view and record view in the CMS. They are much like typical list and record views in a desktop app such as Lotus Approach or MS Access.</p> <p>The list view is build on a table with headers (th), rows(tr) and data (td). 30 results per page. The record views are built on text inputs, where data can be modified, records created/deleted, or searched, and display only one record at a time.</p> <p>The problem is that on the list views titles that contain subtitles (double quoted strings) are not truncated, and the data is displayed perfectly, (Santus and Bendictus from "St. Cecilia Mass").</p> <pre><code>echo "&lt;td class='whiteData'&gt;$row[TITLE]&lt;/td&gt;"; </code></pre> <p>However, the same code in a text input doesn't work: Allowing for escaping characters, changing the code to:</p> <pre><code>echo "&lt;input type='text' name='title' id='title' value= \"$row[TITLE]\" style='width:390px; margin-right:150px; maxlength:75; margin-top:15px' /&gt;"; </code></pre> <p>Yields "Santus and Benedictus from". Bear in mind, the first code snippet was from an index view, and the second is from the browse/edit view. I've tried other combinations such as:</p> <pre><code>...'$row[TITLE]' or $row["TITLE"] or $row['TITLE'] </code></pre> <p>Either of the last two statements throw a php error and just kill the page. The escape character with double quotes yields everything up to the double quotes. Enclosing the expression in single quotes corrects the problem, but then creates another problem with the title, "God's Wondrous Love" where it is truncated at the apostrophe. Again, the problem only exists on the record views, (text inputs) and not on the table (list view).</p> <p>My question: why the difference in behavior? The data is not getting truncated by the query. I know that I can simply instruct the users to not use double-quoted strings, and that seems to solve the problem. But I just thought it curious.</p> <p>Hope I haven't missed something. First post wouldn't allow me to post images, so I hope nothing is out of context.</p> <p>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