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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.