/    Sign up×
Community /Pin to ProfileBookmark

Contents truncated when called from MySQL into web page

I have a text field in MySQL with a fairly large portion of text in it (about 10kb). I have viewed the database record boh in PHPMyAdmin and in the console window and can confirm that the full text is stored in the database. It is not truncated in there at all.

The problem is that when I call the text using a query into a web page, only part of it is displayed/returned.

I have tried copying the text using copy and paste from the database field in PHPMyAdmin directly into the HTML of the web page to replace the variable for that field, just to make sure that the page is capable of holding the quantity of text and that there is no limitation on the size that my table is able to grow to. It displayed perfectly in there which indicates that there is a problem with the returning of the text to the page rather than the page not being able to display it.

I’m wondering if there is some setting somewhere which determines the maximum amount of text that MySQL is allowed to return from one field?

I’m using:

MySQL 4.0
IIS5
IE6
PHP4

This my code for calling the column’s contents which is Ed_main that is giving the problem.

[code=php]

<?php

/* Connecting to a database and retrieve data */
$conn=odbc_connect($database,$username,$password);
if (!$conn)
{exit(“Connection Failed: ” . $conn);}

$sql=”SELECT ProdID, NameModel, Manufacturer, Pic_Thumb_100x100, Pic_1, Pic_2, Tagline, Ed_Summary, Ed_Main FROM products WHERE ProdID=’$item'”;

$rs=odbc_exec($conn,$sql);

$ProdID=odbc_result($rs,”ProdID”);
$NameModel=odbc_result($rs,”NameModel”);
$Manufacturer=odbc_result($rs,”Manufacturer”);
$Pic_Thumb_100x100=odbc_result($rs,”Pic_Thumb_100x100″);
$Pic_1=odbc_result($rs,”Pic_1″);
$Pic_2=odbc_result($rs,”Pic_2″);
$Tagline=odbc_result($rs,”Tagline”);
$Ed_Summary=odbc_result($rs,”Ed_Summary”);
$Ed_Main=odbc_result($rs,”Ed_Main”);

echo “<div style=’font-size:0.6em; display: inline-block;’><b>Stock#:</b> $ProdID</div>”;
echo “<H1 style=’display: inline;’>$Manufacturer $NameModel</H1>”;

if (!$Pic_Thumb_100x100==”null”)
{
$Pic_Thumb_100x100=’no_pic.jpg’;
}

echo “<p><img src=’product_pics/$Pic_Thumb_100x100′ alt=’product image $NameModel’ width=’100′ height=’100′ border=’0′ align=’left’ style=’padding-right: 10px;’></p>”;

echo “<b style=’font-size:1.2em;’>$Tagline</b>”;

if (!$Pic_1==”)
{
echo “<p><a href=’product_pics/$Pic_1′ target=’_blank’ title=’Image 1′>
Click for image 1</a></p>”;

if (!$Pic_2==”)
{
echo “<p style=’display: inline;’><a href=’product_pics/$Pic_2′ target=’_blank’ title=’Image 2′>
Click for image 2</a></p>”;
}
}

echo “<div style=’text-align:justify’><p><b>$Ed_Summary</b></p>”;
echo “$Ed_Main</div>”;
odbc_close($conn);
?>

[/code]

This is the text stored in the database upto where it is being truncated, for the field called ‘Ed_Main’ which is being truncated.

[CODE]

<span style=’font-size:1.0em;’><b><i>Elements of a Premium Radio Product…</i></b></span>

<p></p>

<div style=’font-size:1.0em; color:darkgreen;’><b><i>Strength & Durability</i></b></div>

<p style=’display:inline;’><i>Kenwood’s facilities are proud to be internationally recognized as ISO-9001 certified and this means that our radio products follow a strict adherence tohigh standards in design, manufacturing and quality assurance. Whatever the requirement, the excellent exemplified by theTK-270G/370G portables make Kenwood the premier choice.</i></p>

<p></p>

<div style=’font-size:0.8em;’><b>Vertical Layered Design</b></div>

<p style=’display:inline;’>The battery pack forming the entire back of the unit and the transceiver components forming the front, is a fresh departure from the conventional stacked design. This approach results in a stronger chassis and a single PCB, and improves the overall styling and appearance of the radio.</p>

<p></p>

<div style=’font-size:0.8em;’><b>MIL-STD 810 C/D/E</b></div>

<p style=’display:inline;’>The TK-270G/370G are manufactured along Kenwood’s demanding technical and industrial standards, meeting or exceeding the tough environmental standards used b the U.S. MIL-STD 810 C/D/E standards covering shock, vibration, humidity, dust, and rain, for reliable performance in even the toughest conditions.</p>

<p></p>

<div style=’font-size:0.8em;’><b>Die-Cast Chassis and Polycarbonate Case</b></div>

<p style=’display:inline;’>The monocoque aluminium die-cast chassis-heat sink borrows a principal from aircraft construction for rigid strength. Surrounding this and forming an integral part of the chassis, is the super-tough polycarbonate case to provide years of durability. The heavy-duty belt clip and antenna mount are also integrated into the chassis for strengthened unit construction.</p>

<p></p>

<div style=’font-size:0.8em;’><b>Die-Weather-Resistant</b></div>

<p style=’display:inline;’>Integrated elements like gasket seals and the polyvinyl speaker cone prevent moisture penetration for confident wet weather use.</p>

<p></p>

<div style=’font-size:1.0em; color:darkgreen;’><b><i>Performance</i></b></div>

<p style=’display:inline;’><i>A premium radio design like the TK-270G/370G portables use state-of-the-art surface mount technology, multiple layer epoxy PC boards, high-level integrated circuits and hybrid components to create a symphony of compact, rugged and power-efficient performance.</i></p>

<p></p>

<div style=’font-size:0.8em;’><b>Companded Audio</b></div>

<p style=’display:inline;’>The compandor noise-reduction feature, enhances audio clarity on narrow bandwidth systems and is programmable per channel. Voice intelligence components are amplified and compressed at the transmit end then re-expanded on the receive end to reproduce the original audio signal.</p>

<p></p>

<div style=’font-size:0.8em;’><b>Heavy-Duty Antenna Mount</b></div>

<p style=’display:inline;’>The antenna’s industry-standard SMA connector provides improved mechanical and electrical performance.</p>

<p></p>

<div style=’font-size:0.8em;’><b>High Output Audio</b></div>

<p style=’display:inline;’>A large 36mm speaker provides 500mW audio output. This enables the user to hear transmissions clearly even in the noisiest environments.</p>

<p></p>

<div style=’font-size:1.0em; color:darkgreen;’><b><i>Easy User Interface</i></b></div>

<p style=’display:inline;’><i>A premium radio product must be easy to set-up, use and maintain. The TK-270G/370G is a perfect example of this philosophy, as it combines user-friendly ergonomics in a lightweight and well-balanced package.</i></p>

<p></p>

<div style=’font-size:0.8em;’><b>Alphanumeric LCD Display</b></div>

<p style=’display:inline;’>The 8-character display panel provides quick recognition of operating status and present settings, with alphanumeric and icon characters. For enhanced night time viewing, pressing the backlight key illuminates the LCD display and keypad, and if no other keys are operated, the backlighting shuts off after 5 seconds.</p>

<p></p>

<div style=’font-size:0.8em;’><b>Busy Channel Lockout</b></div>

<p style=’display:inline;’>Lockout further improves channel management by preventing transmission if another talk group is already on the air.</p>

<p></p>

<div style=’font-size:0.8em;’><b>Built-in QT and DQT Signalling</b></div>

<p style=’display:inline;’>QT and DQT functions segregate talk groups so users only hear calls from their own group for clearer, improved, communications. Selectable QT means the user can temporarily change the QT frequency set for each channel.</p>

<p></p>

<div style=’font-size:0.8em;’><b>Built-in 2-Tone Decoder and Encoder</b></div>

<p style=’display:inline;’>The decoder and encoder functions ofter a 2-tone paging code assignable to any channel. An incoming message is signalled with audible and visible alerts.</p>

<p></p>

<div style=’font-size:0.8em;’><b>Call Alert</b></div>

<p style=’display:inline;’>Notifies you as to whether the call received had DTMF or 2-tone signalling.</p>

<p></p>

<div style=’font-size:0.8em;’><b>DTMF Transpond</b></div>

<p style=’display:inline;’>Transmits a code telling the caller that your radio received their DTMF paging signal.</p>

<p></p>

<div style=’font-size:0.8em;’><b>Signalling and/or Logic</b></div>

<p style=’display:inline;’>For improved response when using combinations of signalling systems, squelch is activated when either one, or all, signal requirements are met.</p>

<p></p>

<div style=’font-size:0.8em;’><b>Dialing Features</b></div>

<p style=’display:inline;’>Convenient dialing functions include, <b>Manual Dial</b>, <b>Auto-Dial</b>, <b>Redial</b> and <b>Store & Send</b> (display shows the input DTMF code before it is sent).</p>

<p></p>

<div style=’font-size:0.8em;’><b>Three-Color LED</b></div>

<p style=’display:inline;’>The three-color LED provides traditional transmit/warning (red), receive (green), and alert (orange) visual indications. This LED is recessed to limit omni-directional visibility to everyone except the radio operat

[/CODE]

I have attached a .txt file containing the entire text contained in that database column.

Any suggestions would be greatly appreciated!

Thanks.

pete

[upl-file uuid=7b3f1faa-32f3-461c-8527-8a1acc40a4b2 size=10kB]Full_Text.txt[/upl-file]

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@chazzyJan 20.2006 — my initial guess would be that the problem has to do with the ODBC setup. up to where is the data coming back, is it porperly escape?
Copy linkTweet thisAlerts:
@NogDogJan 20.2006 — Could be that max_allowed_packet on the server and/or client is too small to handle it, although I would have expected you to get an error, not just truncated data. See: http://dev.mysql.com/doc/refman/4.1/en/packet-too-large.html
Copy linkTweet thisAlerts:
@snowwebauthorJan 20.2006 — my initial guess would be that the problem has to do with the ODBC setup. up to where is the data coming back, is it porperly escape?[/QUOTE]

Thanks Chazzy.

Hmm... interesting point about 'escapeing'. I've not heard about that before. I'll need to look into that, maybe that's the problem. I'll check it out and get back to you.

pete
Copy linkTweet thisAlerts:
@snowwebauthorJan 20.2006 — Could be that max_allowed_packet on the server and/or client is too small to handle it, although I would have expected you to get an error, not just truncated data. See: http://dev.mysql.com/doc/refman/4.1/en/packet-too-large.html[/QUOTE]

Thanks also NogDog. I'll look into that too. I have to go to a meeting now, so will probably get back to you tomorrow.

Thanks again

pete
Copy linkTweet thisAlerts:
@snowwebauthorJan 22.2006 — Could be that max_allowed_packet on the server and/or client is too small to handle it, although I would have expected you to get an error, not just truncated data. See: http://dev.mysql.com/doc/refman/4.1/en/packet-too-large.html[/QUOTE]

I've checked the link and it would seem that it can't be that, since my text is only 10kb and it would need to be over 16mb to be affected by it.

I'm gonna carry on looking, I guess it's gonna be something pretty simple since I'm a newbie :-)

Thanks for you help.
Copy linkTweet thisAlerts:
@snowwebauthorJan 22.2006 — my initial guess would be that the problem has to do with the ODBC setup. up to where is the data coming back, is it porperly escape?[/QUOTE]

OK Chazzy, thanks for your reply. I've been reading about 'escapeing' and it all looks pretty complicated and scary! However, I have learnt that my server has 'magic_quotes' turned on and so should be automatically escaping dangerous characters.

Also, I can see that this is working, as the FULL data does exist in the database. It was not truncated on the insert. It seems to be when pulling the data from the database that the problem occurs.

Wouldn't it be great if things 'Just worked'!! I guess we'd all find life dull then though :rolleyes:

Someone has suggested that I use the 'native mysql method' for connecting to the database instead of the odbc method. I'll need to search for reading material on that before I can implement it (seen that i'm a newbie).

In the mean time, any further suggestions would be greatly appreciated!

Thanks.
×

Success!

Help @snowweb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...