How to put articles into mysql database

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

inoob
New php-forum User
New php-forum User
Posts: 31
Joined: Tue Nov 06, 2012 12:20 pm

How to put articles into mysql database

Postby inoob » Tue Feb 19, 2013 6:19 am

I am looking at websites and they seem to have articles placed in their databases with img and link formats.

I am wondering how to put articles with formatting (link to images, hyperlinks) into a mysql database for each article written. I heard something about SQL injections related to this issue as well?

thanks in advance.

User avatar
kiash001
New php-forum User
New php-forum User
Posts: 16
Joined: Wed Feb 27, 2013 2:49 am
Location: Dhaka, Bangladesh
Contact:

Re: How to put articles into mysql database

Postby kiash001 » Wed Feb 27, 2013 3:32 am

Well! if you want to store image in database you need to encode it into base64 format. It returns image into text form. And if you want to store hyperlinks it is possible directly but need to do some formatting using addslashes(). It adds '/' character like this <a href=\"http:\/\/google.com\">

inoob
New php-forum User
New php-forum User
Posts: 31
Joined: Tue Nov 06, 2012 12:20 pm

Re: How to put articles into mysql database

Postby inoob » Wed Feb 27, 2013 4:33 am

Can't I just copy and paste the HTML as TEXT into mysql instead and this solves the problem?


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest

cron