Solved

PHP Code Help Needed

Posted on 2011-02-25
5
228 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now