variable is not showing up outside the function
Posted: Mon Mar 20, 2006 1:52 pm
I have the following and I only get one echo to work
Code: Select all
<?php
function match_sample($id) {
INCLUDE('pconfig.php');
$query = "SELECT dinkcolor1, dinkcolor2, dlining, dmotif, dtypestyle1, dtypestyle2 FROM weddefault WHERE dsample = $id";
$result = mysql_query($query);
$row = mysql_fetch_array( $result );
$selInkcolor1 = $row['dinkcolor1'];
$selInkcolor2 = $row['dinkcolor2'];
$selLining = $row['dlining'];
$selMotif = $row['dmotif'];
$selTypestyle1 = $row['dtypestyle1'];
$selTypestyle2 = $row['dtypestyle2'];
//this one works
echo ($selInkcolor1);
}
match_sample(4);
//this one doesn't why
echo ($selInkcolor1);
?>