Jump to content

[SOLVED] .row help


Clinton

Recommended Posts

Not sure why my information is not parsing. I'm pretty sure it has something to do with the coded line below but I'm not sure what.

Any help would be appreciated. Thanks.

 

$dbhandle = mysql_connect($hostname, $username, $password)

or die("Unable to connect to MySQL");

 

$selected = mysql_select_db("clintona_SLC",$dbhandle)

or die("Can not open SLC Database");

 

$result = mysql_query("SELECT * FROM training ORDER BY lname");

 

?>

 

<html>

<head>

<title>Salt Lake City Training Report</title>

</head>

 

 

<body bgcolor="#FFFFFF">

<table border="1">

<tr>

<td><b><u>Name:</b></u></td> <td><b><u>Date of Birth:</b></u></td> <td><b><u>License Expiration:</b></u></td>

 

<? while ($row = mysql_fetch_array($result)) { ?>

 

<td><? (".$row{'lname'}.' '.$row{'fname'}.' '.$row{'mname'}."); ?></td>

<? } ?>

 

 

 

</body>

 

 

</html>

Link to comment
https://forums.phpfreaks.com/topic/101615-solved-row-help/
Share on other sites

1.) there's no need to enter and exit out of PHP like that.

2.) You're not echoing the variables. Try:

 

<?php while ($row = mysql_fetch_array($result)) { 
echo '<td>'.$row['lname'].' '.$row['fname'].' '.$row['mname'].'</td>';
}
?>

 

When you post, can you place all your code in the


tags please? It makes it much easier to read.

Link to comment
https://forums.phpfreaks.com/topic/101615-solved-row-help/#findComment-519891
Share on other sites

Thanks grace about the extract row. That's a useful tool I wish I would have known about a while ago! :-)

 

What do you mean revraz? Here's what I got, how is that not being utilized correctly?

 

<html>
<head>
<title>Salt Lake City Training Report</title>
</head>


<body bgcolor="#FFFFFF">
<font size="2">
<table border="1">
<tr>
<td>Name:</td> <td>Date of Birth:</td> <td>CDL License Expire:</td>
</tr>

<?php while ($row=mysql_fetch_assoc($result)){
extract($row);
echo"<tr> <td>$lname $fname $mname</td> </tr>";
}
?>

</table>
</font>

</body>


</html>

Link to comment
https://forums.phpfreaks.com/topic/101615-solved-row-help/#findComment-519910
Share on other sites

Well that is different than your first post, so at least you have TRs in there now, but your Data fields don't match.

 

You have 3 header data fields

 

<td>Name:</td> <td>Date of Birth:</td> <td>CDL License Expire:</td>

 

But only 1 data field for your echo

 

echo"<tr> <td>$lname $fname $mname</td> </tr>";

 

Or are you adding DOB and CDL later?

Link to comment
https://forums.phpfreaks.com/topic/101615-solved-row-help/#findComment-519949
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.