Solved

PHP Code Help Needed

Posted on 2011-02-25
5
260 Views
Last Modified: 2012-05-11
I need to create some tables like the code you see below...come somoeone provide the code for me to do this? Thanks
formmm.JPG
0
Comment
Question by:wantabe2
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:santoshmotwani
ID: 34979365
can you please post the code
0
 
LVL 15

Author Comment

by:wantabe2
ID: 34979379
If I had the code for the photo I would not be posting a request for it????
0
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 250 total points
ID: 34979468
A simple html code for the table or with the styling ?

<html>
<head>
    <style type="text/css">
    td{padding: 5px;}
    </style>
</head>
<body>

<table>
<tr>
    <td>In</td>
    <td>02/25/2011</td>
    <td>&nbsp;</td>
</tr>
<tr>
    <td>In</td>
    <td>02/25/2011</td>
    <td>&nbsp;</td>
</tr>
<tr>
    <td>In</td>
    <td>02/25/2011</td>
    <td>&nbsp;</td>
</tr>
</table>

</body>
</html>

Open in new window

0
 
LVL 27

Expert Comment

by:Lukasz Chmielewski
ID: 34979533
Close enough ?

<html>
<head>
    <style type="text/css">
    td{padding: 5px; text-align: center;}
    .in{background-color: #00FF02; width: 70px;}
    .odd{background-color: #eeeeee;}
    .even{background-color: #DDDDDD;}
    </style>
</head>
<body>

<table>

<?php
    for($i=0;$i<7;$i++){
        if($i%2 == 0) $bgc = "odd"; else $bgc = "even";
        echo"<tr><td class=\"in\">In</td><td class=\"".$bgc."\">02/25/2011</td><td class=\"".$bgc."\"></td></tr>";
    }
?>

</table>

</body>
</html>

Open in new window

0
 
LVL 16

Assisted Solution

by:santoshmotwani
santoshmotwani earned 250 total points
ID: 34979535
a simple php code will look like this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="stylesheet.css" type="text/css" rel="stylesheet">
</head>

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("quote", $con);

$result = mysql_query("SELECT field1 ,  date FROM table ");

echo "<table>
<tr>
<th> Field1 </th>
<th> Date </th>
</tr>";

while($row = mysql_fetch_assoc($result))
  {
  echo "<tr>";
          echo "<td>" . $row['field1'] . "</td>";
            echo "<td>" . $row['date'] . "</td>";
      
     "</tr>";
  }

echo "</table>";


mysql_close($con);
?>
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to escape unsafe HTML tags 4 36
CSS for <center> 14 31
instagram media_id Grabber by TAG 1 24
Find RGB colors from a screen. 2 15
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question