CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Feb 2015
    Posts
    1

    MYSQL table row styling

    I am brand new to php, MySQL, coding, etc and I am in serious need of some help you the wise ones on this site. I have the following code and I am trying to style it, IE make it look pretty with some css or something. The problem is I have no idea how to do it and all attempts so far to figure it out on my own have failed.


    Code:
    // display data in table
    						        echo "<table border='1' cellpadding='10'>";
    						        echo "<tr> <th>ID</th> <th>First Name</th><th>Middle Name</th> <th>Last Name</th><th>Client ID</th><th>Diagnosis</th><th>Gender</th><th>Level of Care</th><th>Counselor</th><th>Active</th><th>Aftercare</th></tr>";
    						
    						        // loop through results of database query, displaying them in the table 
    						        for ($i = $start; $i < $end; $i++)
    						        {
    						        	// make sure that PHP doesn't try to show results that don't exist
    					                if ($i == $total_results) { break; }
    					                
    						        	// find specific row
    						        	$result->data_seek($i);
       	 								$row = $result->fetch_row();
       	 								
       	 								// echo out the contents of each row into a table
    					                echo "<tr>";
    					                echo '<td>' . $row[0] . '</td>';
    					                echo '<td>' . $row[3] . '</td>';
    					                echo '<td>' . $row[1] . '</td>';
    					                echo '<td>' . $row[2] . '</td>';
    					                echo '<td>' . $row[4] . '</td>';
    					                echo '<td>' . $row[5] . '</td>';
    					                echo '<td>' . $row[6] . '</td>';
    					                echo '<td>' . $row[7] . '</td>';
    					                echo '<td>' . $row[8] . '</td>';
    									echo '<td>' . $row[12] . '</td>';
    									echo '<td>' . $row[15] . '</td>';
    									echo '<td><a href="records.php?id=' . $row[0] . '">Edit</a></td>';
    					                echo '<td><a href="delete.php?id=' . $row[0] . '">Delete</a></td>';
    					                echo "</tr>";
    						        }
    
    						        // close table>
    						        echo "</table>";]
    Last edited by PeejAvery; March 14th, 2015 at 09:17 PM. Reason: Fixed the code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured