PDA

View Full Version : code challenged


edbr
08-20-2007, 09:54 AM
what am i doing wrong here!!
I am trying to make a link to a detail page so if i were to write
echo " <a href= \"job_details.php?recordID=64
\"> Details </a>";
that works except every record would pass the value 64
if I echo
echo $row["id"];
the correct id is shown but i cant manage to code correctly. I thought it was
echo " <a href= \"job_details.php?recordID=\"$row["id"]\"
\"> Details </a>";
but I am clearly being dense. how should i return the id?

davidj
08-20-2007, 10:16 AM
try this...


echo " <a href= \"job_details.php?recordID=$row['id']\"> Details </a>";

remember that $row['id'] is an array so will need to be inside a do while loop for it to return a relevant ID for a line of db data or it would only return the first db row

edbr
08-21-2007, 09:35 AM
got it thanks david. it is in a while loop. I declared $row['id']as a variable and then it worked yet it wouldnt work as above ???