Trying to insert a value containing a ';' in MySQL, how do I do that? -


i tryin insert mysql following code:

<img src='http://romaniaz.net/forumz/styles/se_gamer_dark/imageset/logo.png' alt='' style='width: 100px; height: 100px; float: left; margin: 20px'>

but wouldn't allow me since i'm using ; symbol. how can insert such values in mysql ? read delimiter it's confusing thing ever came across.

edit:

mysql_query("insert blog_posts (posttitle, postbody, postauthor, postdate, posttags, views) values (         '" . $title . "',         '" . $blogpost . "',         '" . $author . "',         '" . $date . "',         '" . $tags . "',         '" . $views . "')"); 

and yes, i'm aware have switch mysql_*.

so problem $blogpost contains images html style tag , automatically contains 1 or more semicolons...

its not semi-colon causing issue, single-quotes in html. either escape them 2 single quotes or use double quotes:

escaped:

<img src=''http://romaniaz.net/forumz/styles/se_gamer_dark/imageset/logo.png'' alt='''' style=''width: 100px; height: 100px; float: left; margin: 20px''> 

double quotes:

<img src="http://romaniaz.net/forumz/styles/se_gamer_dark/imageset/logo.png" alt="" style="width: 100px; height: 100px; float: left; margin: 20px"> 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -