Patrick Martin
asked on
PHP echo sql result
I'm not able to get the result of the second query $Result to echo out, what am I missing?
Thanks in advance
Thanks in advance
$sqlstr = mysql_query("SELECT * FROM Roster");
while($row=mysql_fetch_array($sqlstr)){
$Result = mysql_query("Select Count(*) AS 1stMain from Race_Results where `1` = ".$row['Car_Number']."");
echo "<table border=0 align='center'>";
echo "</td><td rowspan=8>";
echo $row['Image'];
echo "</td><th width=300>";
echo "<u>Details</u>";
echo "</th>";
echo "<th width=300>";
echo "<u>YTD Stats</u>";
echo "</th>";
echo "<th width=300>";
echo "<u>Overall Stats</u>";
echo "</th></tr><tr><td>";
echo "<b>Car Number: </b>" .$row['Car_Number'];
echo "</td><td>";
echo "<b>1st in Main: </b>" .$Result;
echo "</td><td>";
echo "<b>1st in Main: </b>";
Try this query:
$Result = mysql_query("Select Count(*) AS 1stMain from Race_Results where `1` = '".$row['Car_Number']."'") ;
Hope this helps,
Addy
$Result = mysql_query("Select Count(*) AS 1stMain from Race_Results where `1` = '".$row['Car_Number']."'")
Hope this helps,
Addy
and then after add this line:
$data = mysql_fetch_row($Result);
So with this line you will get the row you want..
Hope this helps,
Addy
$data = mysql_fetch_row($Result);
So with this line you will get the row you want..
Hope this helps,
Addy
ASKER
szewkam - no change
addywatson - I get "array" outputed
addywatson - I get "array" outputed
$Result = mysql_query("Select Count(*) AS 1stMain from Race_Results where `1` = '".$row['Car_Number']."'");
$data = mysql_fetch_row($Result);
echo "<b>1st in Main: </b>" .$data;
ASKER
Here is the page: http://rmdcra.org/Roster.php
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Andyc75 - It works, that's the way I started but I guess my query was wrong from the get go. This would allow me to pull more results at once as well which I will need to do, then I can just call out the columns that I need.
Thanks!
Thanks!
try
list($Result) = mysql_fetch_row(mysql_quer