Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 10th, 2006, 12:36 AM
Authorized User
 
Join Date: Feb 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default retreive data from database

Hi All.
I'm new in PHP. I created form for web page and connected that page to MS SQL database. I don't know how to put database data to according cells. For instance, to get data for Classroom, Date, ets.
Code:
<form action="" method="post" name="frmInfo"> 
<table width="100%" border="0" cellpadding="2" cellspacing="0"> 
          <tr> 
            <td>&nbsp;</td> 
            <td>Classroom</td> 
            <td colspan="2">&nbsp;</td> 
          <tr> 
            <td>&nbsp;</td> 
            <td>Date</td> 
            <td colspan="2">&nbsp;</td> 
          <tr> 
            <td>&nbsp;</td> 
            <td>Salary</td> 
            <td colspan="2">&nbsp;</td> 
          <tr> 
            <td>&nbsp;</td> 
            <td>Other</td> 
            <td colspan="2">&nbsp;</td> 
          </tr> 
        </table> 
      </form>/

I will appreciate if somebody show me example how to do it.
Thanks.

 
Old February 12th, 2006, 06:34 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have no Idea how to access a MS SQL database .. because I use My SQL.. but for the PHP side it should look like this:

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
  <tr>
    <td width="25%">Classroom</td>
    <td width="25%">Date</td>
    <td width="25%">Salary</td>
    <td width="25%">Other</td>
  </tr>
  <tr>

* Acces you database here and run the Query to get your data *
* Start a loop from 1 to the amount of responces you got from the Query *
* for the example will will say that the variable $Classroom contain the data about Classroom, $Date about Date etc.. *

    <td width="25%"><?php echo $Classroom; ?></td>
    <td width="25%"><?php echo $Date; ?></td>
    <td width="25%"><php echo $Salary; ?></td>
    <td width="25%"><?php echo $Other; ?></td>
  </tr>
* place here the code for the end loop *
</table>

Hope this help.
 
Old February 15th, 2006, 08:45 PM
Wrox Technical Editor
 
Join Date: Dec 2005
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

PHP and MS SQL is completely possible..

Check out the following link: http://www.phpdig.net/ref/rn40.html


- A.Kahtava





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to retreive an image from database lovelyphor ADO.NET 2 October 18th, 2004 05:43 AM
Retreive records from the database using SP sri20040 Classic ASP Databases 1 October 6th, 2004 05:36 PM
How to retreive record ... arshad mahmood SQL Server 2000 1 August 16th, 2003 01:38 AM
Can not retreive data from database eliea ASP.NET 1.0 and 1.1 Basics 3 July 24th, 2003 04:35 AM
Retreive Record arshad mahmood VB Databases Basics 2 July 23rd, 2003 08:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.