php explode mysql row -


i have looked unable find answer need.

i trying explode row in mysql containt multiple banner file names.

<?php $str = 'one|two|three|four';  // positive limit print_r(explode('|', $str, 2));  // negative limit (since php 5.1) print_r(explode('|', $str, -1)); ?> 

i took code php tutorial website. possible use form of echo command print file names in there mysql row.

eg doesnt work is

<?php include '../connect/dbseries.php' ?> <?php include 'sbarray.php' ?>  <a href="series.php">back</a>  <?php $str = print' . $row[bannerfilenames] .';  // positive limit print_r(explode('|', $str, 2));  ?> 

thanks in advance aaron

to print filenames in $row['bannerfilenames'], either loop:

$names = explode ("|", $row['bannerfilenames']); foreach ($names $name) echo "$name <br />"; 

or print them in line separated ,instead of | implode:

echo implode(", ", $names); 

in case can, re-design database , normalize tables, means putting filenames in table. way easier handle, , state of art. example:

table banner ---------------- banner_id name blabla etc.  table filenames ----------------- filename_id banner_id  <--- store banner_id above table here! filename blabla 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -