Jump to content

Stings Getting Truncated


websteve

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/214350-stings-getting-truncated/
Share on other sites

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;

}

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.