I would like to ask if my code is correct.
I have these 2 explode commands:
$url = 'http://google.com, http://yahoo.com, http://msn.com, http://yahoo.com, http://msn.com, http://yahoo.com, http://msn.com';
$key = 'google, yahoo, msn';
$xurl = explode( ',', $url );
$xkey = explode( ',', $key );
foreach ( $xurl as $hyperlink ) {
foreach ( $xkey as $keyword )
$sqlHyperLink = mysql_query( "INSERT INTO jon_hyperlink VALUE( '', '$hyperlink', '$keyword', NOW() )" ) or die ( mysql_error() );
}
echo 'Hyperlink Created';
UPDATE*
If you'll notice, the $url
variable has 7 url's listed and I have 3 keywords. How can I make the keyword repeatedly...
How can I insert the string with one foreach
because I used 2 foreach
for my query and it inserted it 2 times. Is there a better way to do this?