Solved

PHP Code Help Needed

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Inserting data into database 10 36
Set time on Session (ASP) 14 23
Search Item in Table 2 21
Non-Resizable Pharagraph 2 7
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.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

860 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