/    Sign up×
Community /Pin to ProfileBookmark

save the result data into mysql db

Hi,

I have this script to read the result data:

[CODE]
$note = “”;
echo “<h3>Data Dump</h3>”;
$data = file($tmp) or die(‘Could not read file!’);
//loop through array and print each line
foreach ($data as $line) {
$note = $note.$line.”<br>”;
}
[/CODE]

If I do this, it writes to the page with all the data:

[CODE]echo $note;[/CODE]

However, somehow when I stored in the database, the field NOTE has no data (BLANK). Other fields (hr, mr, interface, action) are fine. Also then datatype for NOTE field is set to TEXT.

[CODE]
mysql_select_db(“infs”, $MySQLconn);
mysql_query(“INSERT INTO inband_conversion_log (hr, mr, interface, action, [B]note[/B]) VALUES (‘$hrname’, ‘$clli’, ‘$interface’, ‘Remove Interface Confirm’, ‘[B]$note[/B]’)”);
mysql_close($MySQLconn);[/CODE]

Please help,
Thanks.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@trymbillNov 21.2007 — What kind of a field / column is "note" in your MySQL table?
Copy linkTweet thisAlerts:
@SunnyVuauthorNov 21.2007 — I use Datatype = Text for field "NOTE" in my table. I also tried Datatype = BLOG for field "NOTE", but no luck.
Copy linkTweet thisAlerts:
@SunnyVuauthorNov 21.2007 — Figured it out. In the string has single quote ('), that screwed me up.

this works:
mysql_query("INSERT INTO inband_conversion_log (hr, mr, interface, filelink, action, note) VALUES ('$hrname', '$clli', '$interface', '$tmp', 'Outband Interface Confirm', '" [B]. str_replace("'","''",$note) . [/B]"')");[/QUOTE]
×

Success!

Help @SunnyVu 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,
)...