websteve Posted September 25, 2010 Share Posted September 25, 2010 I have some data that when I type in a string in a text box, (e.g. John Smith), the data is trunctated when it is inserted into the database (only 'John; would show up). I noticed that it seems to cut the data off after a white space. If I combine the words, then they are inserted properly. Does this sound like something simple I'm missing or is it something more complex? The text size is 20 and the db field is Varchar 30. Any help would be appreciated. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/214350-stings-getting-truncated/ Share on other sites More sharing options...
ignace Posted September 25, 2010 Share Posted September 25, 2010 POST YOUR CODE if you want help. Quote Link to comment https://forums.phpfreaks.com/topic/214350-stings-getting-truncated/#findComment-1115456 Share on other sites More sharing options...
websteve Posted September 25, 2010 Author Share Posted September 25, 2010 It does write to the database, so the problem seems to be when the program reads it back from the db. Here is the code: while ($ResultsArr_pur = mysql_fetch_array($Results_pur)) { $item='item'.$i; $description='description'.$i; $quantity='quantity'.$i; $price='price'.$i; $date='date'.$i; $ampm='ampm'.$i;; $comments='comments'.$i; $status='status'.$i; echo "<tr><td><input type=text size=5 name=".$item ." value=".$ResultsArr_pur['Item']."></td><td><input type=text size=35 name=".$description ." value=".$ResultsArr_pur['Description']."></td><td><input type=text size=5 name=".$quantity ." value=".$ResultsArr_pur['Quantity']."></td><td><input type=text size=10 name=".$price ." value=".$ResultsArr_pur['Price']."></td><td>$".$ResultsArr_pur['Price'] * $ResultsArr_pur['Quantity']."</td><td><input type=text name=".$date ." value=". $ResultsArr_pur['Date'] . "></td><td><select name=".$ampm ."><option>" . $ResultsArr_pur['AMPM'] . "</option><option>AM</option><option>PM</option></select></td><td><input type=text name=".$comments ."size=35 value=". $ResultsArr_pur['Comments'] ."></td><td><select name=".$status . "><option>Undelivered</option><option>Delivered</option>".$ResultsArr_pur['Status']."</option></select></td></tr>"; $i=$i+1; $n=$n+1; } Quote Link to comment https://forums.phpfreaks.com/topic/214350-stings-getting-truncated/#findComment-1115488 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.