Hi,
I need to store database data in variables so I can work with it.
Please se below what I am trying to do in my script....
If you echo the stuff out is work fine. Meaning if I go echo $row['a5]; I get the data I want but I can't get the data to store in a vairable.
I need something that goes from $a1 to $a18 and in each of then store the data from one field in the database name a5.
Thanks
[PHP]
<?php
$con = mysql_connect(" localhost","*** **","******") ;
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db ("*******", $con);
$result = mysql_query("SE LECT * FROM hole ORDER BY a5");
while($row = mysql_fetch_arr ay($result))
{
$a1 = $row['a5'];
$a2 = $row['a5']; /////// needs to give second result
$a3 = $row['a5']; /////// needs to give third result
}
echo "<img name=\"Hole\" src=\"$a1.jpg\" width=\"32\" height=\"32\" alt=\"Hole\">";
mysql_close($co n);
?>
[/PHP]
I need to store database data in variables so I can work with it.
Please se below what I am trying to do in my script....
If you echo the stuff out is work fine. Meaning if I go echo $row['a5]; I get the data I want but I can't get the data to store in a vairable.
I need something that goes from $a1 to $a18 and in each of then store the data from one field in the database name a5.
Thanks
[PHP]
<?php
$con = mysql_connect(" localhost","*** **","******") ;
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db ("*******", $con);
$result = mysql_query("SE LECT * FROM hole ORDER BY a5");
while($row = mysql_fetch_arr ay($result))
{
$a1 = $row['a5'];
$a2 = $row['a5']; /////// needs to give second result
$a3 = $row['a5']; /////// needs to give third result
}
echo "<img name=\"Hole\" src=\"$a1.jpg\" width=\"32\" height=\"32\" alt=\"Hole\">";
mysql_close($co n);
?>
[/PHP]
Comment