Reputation: 453
looked around and everything seems to be more complex that what I am trying to do.
I have queried an item from a previous page and brought it forward.
$varVeh=$_POST['Veh_num'];
I echo that and it show the proper number....
I then want to use the name associated with that number in a table title. so I do another query:
$sql_vehName="select Veh_name from hc_vehicle_type where Veh_num=$varVeh";
$result_vehName = mysql_query($sql_vehName);
$vehName=mysql_fetch_assoc($result_vehName);
echo $vehName;
echo "<table border='1'>";
echo "<tr><td>Best Scores for</td><td>$vehName</td> </tr>";
Without using the fetch I get resource #6.
Upvotes: 0
Views: 170
Reputation: 1679
$sql_vehName = "select Veh_name from hc_vehicle_type where Veh_num=$varVeh";
$result_vehName = mysql_query($sql_vehName);
$vehName = mysql_result($result_vehName,0);
echo "<table border='1'>";
echo "<tr><td>Best Scores for</td><td>$vehName</td> </tr>";
Upvotes: 1
Reputation: 12139
You assign $vehName as an associative array. What you can do is use the key that corresponds to your field name:
echo "<tr><td>Best Scores for</td><td>".$vehName['Veh_name']."</td> </tr>";
Upvotes: 1