I normally program in SQLServer/VB/DAO and I'm just moving in to PHP/MySQL. So far so good, but it can be frustrating at times when there I things I could normally do with my eyes closed and now I can't get them to work at all.
What I want to do is move to the first record and display 5 fields and then loop through the recordset and display the other fields. Think in terms of grouping when report writing.
This code works for reading everything.
if (!$sSQL) {
die('Query failed: ' . mysql_error());
}
while ($row = @mysql_fetch_array($sSQL))
{
print ("<tr>");
$Counter = 1
print ("<td>{$row["Clinic"]}</td>");
print ("<td>{$row["PCP"]}</td>");
print ("<td>{$row["FName"]}</td>");
print ("<td>{$row["LName"]}</td>");
print ("<td>{$row["DOB"]}</td>");
print ("<td>{$row["TestName"]}</td>");
print ("</tr>");
}
I then went to this to try and read just the first row and the loop through the final field. It goes in the If mysql_data_seek block and creates the table row, but it doesn't read the field values. The first row of the table is empty.
if (!$sSQL) {
die('Query failed: ' . mysql_error());
continue;
}
if (mysql_data_seek($sSQL, 0)) {
print ("<tr>");
print ("<td>{$row["Clinic"]}</td>");
print ("<td>{$row["PCP"]}</td>");
print ("<td>{$row["FName"]}</td>");
print ("<td>{$row["LName"]}</td>");
print ("<td>{$row["DOB"]}</td>");
print ("</tr>");
}
while ($row = @mysql_fetch_array($sSQL))
{
print ("<tr>");
print ("<td>{$row["TestName"]}</td>");
print ("</tr>");
Little help!
Greg