php - when i insert of description and img_url data behave differently? -


php

$rss = new simplexmlelement($xml, libxml_nocdata);  foreach ($rss->channel->item $item) {    foreach ($rss->channel->item $item) {      $guid = $item->guid  ;    $title = $item->title ;    $url = $item->link;    $description = (string)$item->description ;    $date = $item->pubdate;    $img_url = $item->enclosure['url'] ;     $category =  $item->category[1] ;       insert($guid,$title,$description,$url,$date,$img_url) ; }      function insert($g,$t,$des,$u,$d,$imgu) { global $connection ; echo $g,"<br>",$t,"<br>",$des,"<br>",$u,"<br>",$d,"<br>",$imgu,"<br>" ; $insert_sql = "insert rssfeed (guid,title,description,url,date,img_url) values (?,?,?,?,?,?)" ; $stmt = $connection->stmt_init() ; $stmt->prepare($insert_sql) ; $stmt->bind_param('isssss',$g,$t,$des,$u,$d,$imgu); $stmt->execute() ;  }  

when echo in function shows clear output in database in description , img_url , url coulmns have different data entry .both urls haven't full url information show in output file .

second question how can sanitize before input db dates ,url , tittle etc.

both images of output , database

output of function

database input


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -