[Solved] Explode problems...
Posted: Thu Jul 12, 2007 1:16 pm
Ok, so I'm using the explode() tag to make an array each side of the | character.
eg;However when I launch the little script to make it easier for me to add it into a database it just messes up, shows the first line and a tiny bit of the next title, only showing this:
Here is the code I'm using:
Any ideas?
(Oh and it basically prints the INSERT information on the page so I can just copy and paste it into phpMyAdmin's SQL box.
eg;
Code: Select all
First Day at School|http://www.foo.bar/image1.html
Sports Day at School|http://www.foo.bar/image2.html
Dale in Newspaper|http://www.foo.bar/image3.htmlCode: Select all
INSERT INTO `pics` VALUES('','First Day at School','http://www.foo.bar/image1.html
Sports Day at School');Code: Select all
<?php
if($_POST[tgpst]) {
$rep = explode("|", $_POST[tgpst]);
$re = "INSERT INTO `pids` VALUES('','$rep[0]','$rep[1]');";
?><textarea cols="100" rows="15" name="tgpst" style="border:5px solid #990000;padding:5px;"><?php print $re; ?></textarea><hr /><?php
}
?>
<form action="<? echo $_SERVER['PHP_SELF'] ?>" method="POST"><textarea cols="100" rows="15" name="tgpst"></textarea><br /><input type="submit" name="search" value="Generate..." /></form>(Oh and it basically prints the INSERT information on the page so I can just copy and paste it into phpMyAdmin's SQL box.