I see, yeah I guess I should be using escapes then.
Fantastic stuff, I can now be a sad bastard and track my weight via a pretty(ish) graph (using PHPGraphLib).
image1.jpg,image2.jpg,image3.jpg,image4.jpg
{$row[images]}
<img src="image1.jpg" /><img src="image2.jpg" /><img src="image3.jpg" /><img src="image4.jpg" />
$blah = split(",", $row[images]); foreach ($blah as $beep) { echo "<img src=\"" . $beep . "\" />"; }
And how do I pop that within a current big echo?
I'm trying (honest :$ )
$car = $_GET['car']; $query = "SELECT * FROM cars WHERE carcode = '$car' "; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) echo " <table> <tr> <th rowspan='5'><a href='#'><img src='./photos/{$row[thumb]}' /></a> <br /> <td colspan='2' width='300px'><a href='car.php?car={$row[carcode]}'>{$row[title]}</a></td> </tr> <tr> <td width='250px'>{$row[year]}<br /> {$row[mileage]}<br /> {$row[engine]}<br /> {$row[fuel]}<br /> {$row[gearbox]}<br /> </td> <td width='250px'>{$row[colour]}<br /> {$row[mot]}<br /> {$row[tax]}<br /></td> </tr> <tr> <td colspan='2'>{$row[extra]}</td> </tr> <tr> <td colspan='2' align='right' valign='bottom'><b>£{$row[price]}</b></td> </tr> <tr> <td colspan='2'>FULL WIDTH</td> </tr> </table> ";
I think I'm doing this totally wrong, because I actually want to do some stuff with the output from the other rows depending on what it is rather than just showing their content.
Back to the drawing board possibly.
$blah = split(",", $row[images]); foreach ($blah as $beep) { $stringading .= "<img src=\"" . $beep . "\" />"; }
$car = $_GET['car']; $query = "SELECT * FROM cars WHERE carcode = '$car' "; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) echo " <table> <tr> <th rowspan='5'><a href='#'><img src='./photos/{$row[thumb]}' /></a> <br /> <td colspan='2' width='300px'><a href='car.php?car={$row[carcode]}'>{$row[title]}</a></td> </tr> <tr> <td width='250px'>{$row[year]}<br /> {$row[mileage]}<br /> {$row[engine]}<br /> {$row[fuel]}<br /> {$row[gearbox]}<br /> </td> <td width='250px'>{$row[colour]}<br /> {$row[mot]}<br /> {$row[tax]}<br /></td>" . $stringading . " </tr> <tr> <td colspan='2'>{$row[extra]}</td> </tr> <tr> <td colspan='2' align='right' valign='bottom'><b>£{$row[price]}</b></td> </tr> <tr> <td colspan='2'>FULL WIDTH</td> </tr> </table> ";
$blah = split(",", $row[images]); $stringading = "tr"; foreach ($blah as $beep) { $stringading .= "<td><img src=\"" . $beep . "\" /></td>"; } $stringading .= "</tr>";
That shows all the images (cheer)
But it breaks everything else and nothing else outputs :C
function func_name() { while (1) { if ($condition) { func_name(); } if ($other_condition) { break; // exit the while loop } } }
$string = '<img src="' . replace( ',' , '" /><img src="' , $string ) . '" />';
$string = preg_replace( '(?:^|,)([^,]+)' , '<img src="$1" />' , $string );