looping through fields using variables (newbie problem)
Posted: Thu Nov 27, 2008 9:05 am
had a search around for this particular problem but had no joy, any help would be great.
I'm trying to send some data from MySQL server into flash via PHP.
Problem is the using a variable instead of the exact string in a while loop I think...
==================================================================
here is my code:
<?php
$leilField = $_POST['dataBaseTarget'];
$year = $_POST['yearTarget'];
$connect = mysql_connect("********", "********", "********");
mysql_select_db("********", $connect);
$result = mysql_query("SELECT ID, $leilField FROM booking_dates_2008");
$count=0;
while($row=mysql_fetch_array($result)){
echo "id$count=$row[ID]&date$count=$row[$leilField]&";
$count++;
}
echo "count=$count";
?>
================================================
Any ideas what I'm doing wrong here?
cheers
I'm trying to send some data from MySQL server into flash via PHP.
Problem is the using a variable instead of the exact string in a while loop I think...
==================================================================
here is my code:
<?php
$leilField = $_POST['dataBaseTarget'];
$year = $_POST['yearTarget'];
$connect = mysql_connect("********", "********", "********");
mysql_select_db("********", $connect);
$result = mysql_query("SELECT ID, $leilField FROM booking_dates_2008");
$count=0;
while($row=mysql_fetch_array($result)){
echo "id$count=$row[ID]&date$count=$row[$leilField]&";
$count++;
}
echo "count=$count";
?>
================================================
Any ideas what I'm doing wrong here?
cheers