Expand|Select|Wrap|Line Numbers
- mysql_query("CREATE TABLE $value (Subject VARCHAR(200), External int(3))");
- preg_match_all('/<i>(.*?)<\/i>/si', $matches[0], $submatch, PREG_SET_ORDER);
- mysql_query("INSERT INTO $value (Subject) VALUES ('$submatch[2][1]')");
$matches[0] contains html data with tags
i'm matching the data between the <i> and </i> tags
and i guess its been stored in $submatch array
now i want to knw a way through which i can insert each match into a different row using mysql query
i tried running two foreach loops and tried inserting like this
Expand|Select|Wrap|Line Numbers
- foreach ($submatch as $tempone) {
- foreach ($tempone as $key=>$temptwo)
- {
- mysql_query("INSERT INTO $value (Subject) VALUES ('$temptwo')");
- }
- }
that is for each match there are two array positions like
$submatch[0][0] contains <i>xysdbhdg</i> and
$submatch[0][1] contains xysdbhdg
and both are getting inserted... i wanna insert oly ones which are like $submatch[0][1] contains xysdbhdg i mean ones without the tags :)