Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web based database for intranet use 2

Status
Not open for further replies.

TimRegester

Technical User
Dec 18, 2002
195
GB
Hi

I have a project with the following functional spec and the following tools.

I am writing a database containing records for a number of surveys. The surveys need to be shown as a table, one row per record with a number of optional and tabbed views, by date, by location, by value etc with one record per row and searchable via query on any field or freeform, as there will be multiple addresses per record. I need drill down to a form with all the records details.

I have a Centos Linux server, with Apache, Mysql4 and php4 installed.

I know HTML 4 CSS and SQL so understand mysql from my oracle/ingress/VB days. I can create a form based record for each record but I have no idea how to do the table. I also have a VB, VBA and some C programming experience.

I have designed the database, witten input forms etc but now need to write the table pages.

PHP and Mysql seem the obvious route and record locking conflicts should be rare due to the usage pattern currently envisaged.

Which books or tutorials can people recommend that will show me this and get me over this stumbling block, most books seem aimed at web development, not database application development, the application would be relatively simple in say Access 97 but we are using Openoffice 2.O and anyway mdbs are a network nightmare to manage.

 
Tim

can you clarify, do you need a tutorial on

1. getting data in and out of mysql; or
2. formatting mysql output for an html table; or
3. both?

justin
 
I want to create html pages that call php scripts that populate a table with the data from the database. I can create a page per record form in php but not the table. I can find tutorials for input and update in forms for each record, but showing all the records say twenty records at a time does not seem covered anywhere. it needs to be read only but drill down.
 
so ... lets say your table structure looks something like this

filmid, filmtitle, leadactor, filmyear

a basic table would look something like this
Code:
<table>
<tr>
<th>Title</th><th>Lead Actor</th><th>Year</th>
</tr>
<?
$sql = "select filmid, filmtitle, leadactor, filmyear from filmtable";

if (isset($_GET['leadactor'])):
$sql .= " where leadactor='".$_GET['leadactor']."'";
endif;

$results = mysql_query ($sql);
if (mysql_num_rows($results) === 0 ):
?>
<tr><td colspan="3">No records to display</td></tr>
?>
else:
while ($row=mysql_fetch_assoc($results)):
?>
<tr>
<td>
<?=$row['filmtitle']?>
</td>
<td>
<a href="<?=$_SERVER['PHP_SELF']?>?leadactor=<?=urlencode($row['leadactor'])?> ><?=$row['leadactor']?></a>
</td>
<td>
<?=$row['filmyear']?>
</td>
</tr>
<? endwhile; ?>
</table>

for the record paging code see sleipnir214's fAQ in this forum.

warning- i haven't tested the above code for parse errors.
 
oops

change this line
Code:
<? endwhile; ?>
to
Code:
<? endwhile; endif;?>

i've been awake for too long...
 
Cheers one and all. I will review these responses this evening (GMT) as I am out on site today.
 
u dont need to go for books, just go to google and type technical tutorials or log on to forum.pctechindia.com and search for the php tutorials .

u wil get all the related documents over there
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top