The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. August 24, 2019, 12:11:20 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Mysql via php not allowing writing to mysql more than 255 characters in a field.  (Read 2654 times)
tommytx
Expert
****
Offline Offline

Posts: 123


View Profile WWW
« on: October 06, 2013, 07:04:03 PM »

Ok.. super boy and girls.. I always come here when no one else  can answer my question.. so please dont' let me down this time its very important.
I have been playing with this for 2 days now and its got my entire project on work stoppage... not to mention I have no hair left.. course did not have hair when this started.. just sayin'.

So here is the scenario... This is a mysql used with a word press site.. and the culprit not writing is the post_content column... it writes fine below 255 characters so i know my access pw and such is fine.. however the field is for storing huge data.. its the WP content column... and of course i confirmed and its a longtext field... that should do it...
In an attempt to pin the problem down, i set it up to draw the content to be written from another id of the same data base and then once the data is drawn and echoed to make sure its a lot of stuff... then i attempt to turn around and write it back to a new Id.. with no luck unless the data is chopped down to 255 or less... acting like it thinks its a basic 255 character field... but I never told it to act like that.. as far as I know it still thinks its a longtext....
The code is below... and I would be forever indebted if someone has the time to cut and paste it into your site and see what the heck I have wrong.. its has worn me out..
Code:
<?php
include("connect-vicky-info.php");
$id 1;
$sql "SELECT post_content FROM `wp_posts` WHERE ID='$id'";
$result=mysql_query($sql);
$row mysql_fetch_array($result);
$post_content =  $row['post_content'] . "<br>";
echo 
"$post_content<br>";
$id 877;
$sql="UPDATE wp_posts SET post_content='$post_content' WHERE ID='$id'";
$result=mysql_query($sql);
if(
$result){
echo 
"<br><b>Successful!</b><br><br>";
} else {
echo 
"<br><font color=red><b>Negative Result.<b></font><br><br>";
}
?>


I really appreciate any suggestions.. as I am completely out of ideas.. Thanks in advance.
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: October 10, 2013, 04:28:12 PM »

I regret nobody's been able to help yet Tommy.

I'll have to read this again and see if there's something I'm missing tonight, as I really don't get why that's the case.

I'll post back tonight late.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
tommytx
Expert
****
Offline Offline

Posts: 123


View Profile WWW
« Reply #2 on: October 10, 2013, 05:52:34 PM »

Thanks.. but don't spend a whole lot of time one it, but it appears it may be due to some extraneous characters showing up.. stoppping the operation... I will know later tonight.. I am putting together a program to go character by character and removing anything weird... I dumped it into a see non printing characters editor but did not see any then ran an extractor for the following characters and one file actually updated start to finish.. so I may have solved it.. so hold off till the am for more details.. but thanks anyway.. Removing the 160 and the 194 characters seem to be the solution.. but they cannot be seen in a "View non printing characters"
Below is autoit code in case its not recognized but the characters of course can be removed with any programming method... if autoit is not your bag..

Code:
Func doWork($line)
; @@@@@@@@@@@@@@@@ Remove the bad characters 160 and 194 @@@@@@@@@
$content = $line
$content = StringReplace($content, "|", "*&*", 2)
$dat = StringLeft($content, 50)

$mylen = StringLen($content)

ConsoleWrite($dat & "  " & $mylen & @CRLF)
$pd = ""
for $rt = 1 to stringlen($content)
   $pc = StringMid($content, $rt, 1)
   if $pc = "'" then $pc = "\'"
    ; ConsoleWrite($pc)
$pa = asc($pc)
   if $pa = 160 then $pc = ""
   if $pa = 194 then $pc = ""
   $pd = $pd & $pc
Next
$content = $pd
FileWriteLine($file_out, $content)
EndFunc

« Last Edit: October 10, 2013, 06:05:33 PM by tommytx » Logged
tommytx
Expert
****
Offline Offline

Posts: 123


View Profile WWW
« Reply #3 on: October 16, 2013, 04:17:33 PM »

this one is solved.. removing said characters took care of it...
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #4 on: October 16, 2013, 08:12:30 PM »

well done lad. see, u r right - come to the cache and you'll get answers.

maybe not from us ... but they'll come Wink
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!