what I want to do is take a field from my database which was imploded as an array of peoples favorite bands with a pipe seperator:
IE: nirvana|tool|led zepplin
I want to give them 6 input boxes to add in their bands, but they don't have to do all six and the first time the user goes here, their field is empty because they sign up then add the bands, I keep getting the error:
<br><b>Warning</b>: Uninitialized string offset: 4 in <b>c:\inetpub\wwwroot\dd\st_lists.php</b> on line <b>81</b><br>
Code: Select all
$result = query_db("select * from st_bands where username = '$valid_user'");
$num_rows = mysql_num_rows($result);
$row = mysql_fetch_array($result);
$bands = explode('|', ($rowї"bandlove"]));
$num = 0;
$ct = 1;
for($i=0; $i < 6; $i++){
echo $ct.". ";
?>
<input type="text" name="favbandї]" size="30" value="<? echo $bandsї$num]; ?>"><BR>
<?
$num++;
$ct++;
}
?>
<BR><BR>
<input type="submit" value="Update »" name="submit">
</form>I know the error comes from not having a value there but I'm not sure on how do do value checks for the array