Jump to content

Recommended Posts

Hello all

 

I have make one program which parse a XML file and then insert selected entries into the database. It is not inserting all the entries there r few entries which it is not entering into the database. I am not able to figure out the reason.

please help me regarding this.

 

Thank u

 

Rashmi

Thanks for the reply

here I am pasting the code i used to parse and then to insert data...

 

if(isset($_POST['show']))

{

$conn=mysql_connect("localhost","root","root") or die("Could not connect");

mysql_select_db("pubmeddb",$conn) or die("Could not select db");

 

foreach($_POST['checkB'] as $val)

{

#print $val;

foreach($xml->PubmedArticle as $pubmart)

{

$pubmedid=$pubmart->MedlineCitation->PMID;

if($pubmedid == $val)

{

$pubID=$pubmedid;

$vol=$pubmart->MedlineCitation->Article->Journal->JournalIssue->Volume;

$journal=$pubmart->MedlineCitation->Article->Journal->Title;

$year=$pubmart->MedlineCitation->Article->Journal->JournalIssue->PubDate->Year;

$month=$pubmart->MedlineCitation->Article->Journal->JournalIssue->PubDate->Month;

$day=$pubmart->MedlineCitation->Article->Journal->JournalIssue->PubDate->Day;

$pubdate=$year;

$title=$pubmart->MedlineCitation->Article->ArticleTitle;

$abstract=$pubmart->MedlineCitation->Article->Abstract->AbstractText;

$authorlist='';

# print  $pubID ."volume". $vol. $journal . "year".$year . $title . "    ".$abstract;

$i=0;

foreach($pubmart->MedlineCitation->Article->AuthorList->Author as $auth)

{

$authorlist1= $auth->LastName . " " . $auth->ForeName.$auth->FirstName;

$authorlist=$authorlist . $authorlist1."; ";

if($i == 0)

{

$firstauth=$authorlist1;

}

$i=1;

}

# print $firstauth. " " . $authorlist;

 

$query5="INSERT INTO 'pubmed_record'('pubmedID', 'volume', 'journal', 'pubdate', 'title', 'abstract', 'firstauth', 'authorlist') VALUES('$pubID', '$vol', '$journal', '$pubdate', '$title', '$abstract', '$firstauth','$authorlist')";

$result5=mysql_query($query5,$conn);

if(!$result5)

{

print "Result failed";

}

$num1=mysql_num_rows($result5);

print $num1;

}

}

Thank u for the reply

 

I knw code is correct because it is giving porb with few entries only. First I thought these entries could hav bad characters so i tried all the functions to remove those char still prob is same. here I send one example....

 

 

7476849

248

Molecular & general genetics : MGG

  1995

A maize DNA-binding factor with a bZIP motif is induced by low temperature.

We have isolated a low temperature-induced maize gene, mlip15, via cross hybridization using rice lip19. The longest cDNA isolated comprised 1179 bp and coded for a 135 amino acid bZIP (basic region/leucine zipper) protein. The gene showed 61.4% and 68.9% identity with the rice gene at the DNA and amino acid sequence levels, respectively, and is distinct from other maize genes that code for bZIP proteins. The level of mlip15 transcript was positively regulated by low temperature in the same way as the lip19 transcript. The levels of the transcript were also strongly increased by salt stress and exogenous abscisic acid, and slightly increased by anaerobiosis, but were not affected by heat shock and drought. The mLIP15 protein and truncated derivatives, produced in rabbit reticulocyte lysates or in an Escherichia coli expression system, were able to bind to a fragment of the wheat histone H3 gene promoter. This binding was diminished by addition of a molar excess of the hexamer sequence 5'-ACGTCA-3' found in the promoter and of the G-box-like sequence, but not by the addition of the ocs sequence or a mutated hexamer sequence. The factor bound to a promoter region of the maize Adh1 gene, expression of which is also induced by low temperature. These results lead to the conclusion that mlip15 is a strong candidate for a low temperature-induced transcription factor in maize.

Aguan K

Kusano T; Berberich T; Harada M; Suzuki N; Sugawara K

 

Do u find any error with this entry?

 

Thanks

All string data that is placed into a query must be escaped so that any special sql characters in the string don't break the sql syntax of the query.

 

See the mysql_real_escape_string function.

 

I'm also going to guess you are getting the "Result failed" message that your code outputs when a query fails? If you bother to mention what you see in front of you, you can get faster and better solutions to your problem.

Yes Dear

 

u r right I m getting result failed msg only. Now i used this function.. still it is showing same error.

 

$pubID=$pubmedid;

mysql_real_escape_string($pubID);

$vol=$pubmart->MedlineCitation->Article->Journal->JournalIssue->Volume;

mysql_real_escape_string($vol);

$journal=$pubmart->MedlineCitation->Article->Journal->Title;

mysql_real_escape_string($journal);

$year=$pubmart->MedlineCitation->Article->Journal->JournalIssue->PubDate->Year;

mysql_real_escape_string($year);

$month=$pubmart->MedlineCitation->Article->Journal->JournalIssue->PubDate->Month;

mysql_real_escape_string($month);

$day=$pubmart->MedlineCitation->Article->Journal->JournalIssue->PubDate->Day;

$pubdate=$year;

$title=$pubmart->MedlineCitation->Article->ArticleTitle;

mysql_real_escape_string($title);

$abstract=$pubmart->MedlineCitation->Article->Abstract->AbstractText;

mysql_real_escape_string($abstract);

$authorlist='';

# print  $pubID ."volume". $vol. $journal . "year".$year . $title;

$i=0;

foreach($pubmart->MedlineCitation->Article->AuthorList->Author as $auth)

{

$authorlist1= $auth->LastName . " " . $auth->ForeName.$auth->FirstName;

$authorlist=$authorlist . $authorlist1."; ";

if($i == 0)

{

$firstauth=$authorlist1;

}

$i=1;

}

mysql_real_escape_string($firstauth);

mysql_real_escape_string($authorlist);

 

 

Thank u

 

Rashmi

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.