Guida a MC-Web

Cliccando sulle domande di interesse le relative risposte sono visualizzate facendo scorrere la pagina dopo l'elenco delle domande.

Scarica il documento corrispondente in formato PDF

17. Posso estrarre un solo record da un database gestito con MC-Web?

MC-link Web ® offre un comodo strumento per estrarre un determinato record da un database visualizzandone il contenuto in una normale pagina Web. La funzione output.pl si differenzia da dbview.pl per il fatto che non richiede un utilizzo preventivo di mgrep.pl

<A HREF="/cgi-bin/output.pl?datafile+viewer+recno">reference</A>

Dove:

  • datafile
    È il nome del database da cui estrarre il record. Occorre inserire il "path" completo del file la cui estensione deve essere .out.
  • viewer
    È un normale file html (deve risiedere nella stessa directory del datafile) utilizzato per visualizzare il record i cui campi sono disponibili nelle variabili identificate dal simbolo "$". Ad esempio il campo "Cognome" sarà disponibile nella variabile $Cognome. Si ricordi che la procedura distingue fra maiuscolo e minuscolo per cui la variabile $Indirizzo è diversa da $indirizzo. Ovviamente la procedura sostituirà alle variabili l'effettivo contenuto dei campi del database. Ulteriori informazioni sulle variabili è disponibile nella documentazione di mgrep.pl.
  • recno
    È il numero del record da estrarre dal database.
  • reference
    È il testo "cliccabile" presentato all'utente che permette di eseguire la procedura ed estrarre il record.

Esempio

Con le seguenti istruzioni è possibile visualizzare i primi tre record dal nostro database di prova:

<H3>
Estrazione del record numero
(<A HREF="/cgi-bin/output.pl? /doc/mcweb/datafile.out+dbviewer.htm+1"> 1 </A>)
(<A HREF="/cgi-bin/output.pl? /doc/mcweb/datafile.out+dbviewer.htm+2"> 2 </A>)
(<A HREF="/cgi-bin/output.pl? /doc/mcweb/datafile.out+dbviewer.htm+3"> 3 </A>)
</H3>

Di seguito la struttura del file html "dbviewer.htm" utilizzato come tracciato per visualizzare i record del database.

viewer

<html>
<head>
<title>MC-link: Esempio di dbview.pl e output.pl</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta content="adsl, ADSL, xdsl, XDSL, banda larga, BANDA LARGA" name="keywords">
</head>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
if(window.event + "" == "undefined") event = null;
function HM_f_PopUp(){return false};
function HM_f_PopDown(){return false};
popUp = HM_f_PopUp;
popDown = HM_f_PopDown;
function search(botName) {
var inputObj = document.searchform.query;
if (inputObj.value == "") return;
else {
if (botName == "mc") location.href = "http://www.google.com/search?q=" + inputObj.value + "%20site:www.mclink.it";
if (botName == "google") location.href = "http://www.google.com/search?q=" + inputObj.value;
}
}
//-->
</SCRIPT>
<link rel="stylesheet" href="/css/main.css" type="text/css">
<body bgcolor="#ffffff" topmargin="5" leftmargin="5" marginwidth="5" marginheight="5">
<SCRIPT LANGUAGE="JavaScript1.2" src="/js/HM_Loader.js" TYPE='text/javascript'></SCRIPT>
<table border="0" cellpadding="0" cellspacing="0" width="763">
<tr>
<td colspan="2"><img src="/images/banner.gif" border="0" usemap="#home"></td>
</tr>
<tr>
<td colspan="2"><table border="0" cellpadding="0" cellspacing="0" background="/images/tile_menu.gif" width="763" height="23">
<tr>
<td width="1"><img src="/images/righine.gif"></td>
<td width="50"><img src="/images/label_cerca.gif"></td>
<form name="searchform" onsubmit="search('google');return false">
<td width="94"><input style="FONT-FAMILY: Verdana; FONT-SIZE: 10px" size="15" type="TEXT" name="query">
</td>
</form>
<td width="42" align="center"><a href="javascript:search('google');" onMouseOver="popUp('HM_Menu1',event)" onMouseOut="popDown('HM_Menu1')"><img src="/images/cerca.gif" border="0" alt=""></a></td>
<td width="1"><img src="/images/righine.gif"></td>
<td align="center" width="115"><a href="/offerta/connect_xdsl.htm" onMouseOver="popUp('HM_Menu4',event)" onMouseOut="popDown('HM_Menu4')"><img src="/images/offerta.gif" border="0"></a></td>
<td width="1"><img src="/images/righine.gif"></td>
<td align="center" width="115"><a href="/azienda/mclink.htm" onMouseOver="popUp('HM_Menu6',event)" onMouseOut="popDown('HM_Menu6')"><img src="/images/azienda.gif" border="0"></a></td>
<td width="1"><img src="/images/righine.gif"></td> <td align="center" width="115"><a href="/risorse/search.htm" onMouseOver="popUp('HM_Menu9',event)" onMouseOut="popDown('HM_Menu9')"><img src="/images/risorse.gif" border="0"></a></td> <td width="1"><img src="/images/righine.gif"></td>
<td align="center" width="115"><a href="/risorse/servizi.htm" onMouseOver="popUp('HM_Menu10',event)" onMouseOut="popDown('HM_Menu10')"><img src="/images/abbonati.gif" border="0"></a></td> <td width="1"><img src="/images/righine.gif"></td> <td width="79" align="center"><a href="/azienda/contatti.htm"><img src="/images/contattaci.gif" border="0"></a><br></td> <td width="1"><img src="/images/righine.gif"></td>
<td width="30" align="center"><img src="/images/coda.gif"></td>
<td width="1"><img src="/images/righine.gif"></td>
</tr>
</table>
</td>
</tr>
</table>
<map name="home">
<area shape="rect" coords="6,7,146,61" href="http://www.mclink.it/">
</map>
<div id="content">
<table width="763" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<!-- Inizio tabella barra di stato -->
<table width="763" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="11"><img src="/images/statbar_L.gif"></td>
<td width="750" class="statBar"><span class="uCase">&gt;Risorse &gt;Helpdesk &gt;Guida ad MC-link Web</span></td>
<td width="2"><img src="/images/statBar_R.gif"></td>
</tr>
</table>
<!-- Fine tabella barra di stato -->
</td>
</tr>
<tr>
<td>
<table width="763" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="11" background="/images/bd_L.gif">
</td>
<td width="537" valign="top" class="contStd">
<br>
<table border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="titV">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="bgc14">Esempio dell'utilizzo di dbview.pl e output.pl</td>
<td class="bgs14">
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>a cura di <a href="http://www.mclink.it/personal/MC8267">Paolo Ciraci</a></p>
<H3>Di seguito il record estratto dal database: "$datafile"</H3>
<TABLE>
<TR><TD>Cognome: </TD><TD><B>$cognome</B></TD></TR> <TR><TD>Nome: </TD><TD><B>$nome</B></TD></TR> <TR><TD>Residente: </TD><TD><B>$citta ( $cap )</B></TD></TR> <TR><TD>Anni: </TD><TD><B>$eta $stato</B></TD></TR> <TR><TD>Professione:</TD><TD><B>$professione</B></TD></TR> <TR><TD>Reddito: </TD><TD><B>$reddito</B></TD></TR> </TABLE>
<br><br>
</td>
<td width="13">
</td>
<td width="200" valign="top"><img src="/images/img_dx_risorse.gif" width="200" height="150"></td>
<td width="2" background="/images/bd_R.gif"><img src="/images/vuota.gif" width="2" height="2"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="763" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="23" valign="top"><img src="/images/prodotti_nuove/separatore_footer.gif" border="0"><a href="/azienda/privacy.htm"><img src="/images/prodotti_nuove/footer_copyright.gif" border="0"></a><a href="/risorse/informazione/index.html"><img src="/images/prodotti_nuove/footer_linkutili.gif" border="0"></a><a href="/azienda/mappa.htm"><img src="/images/prodotti_nuove/footer_mappasito.gif" border="0"></a><a href="/risorse/comunicazioni/index.htm"><img src="/images/prodotti_nuove/footer_comunicazioni.gif" border="0"></a><a href="/azienda/minori/index.htm"><img src="/images/prodotti_nuove/footer_tutelaminori.gif" border="0"></a><img src="/images/prodotti_nuove/footer_fine.gif" border="0"><img src="/images/prodotti_nuove/separatore_footer.gif" border="0"></td>
</tr>
<tr>
<td height="1" valign="top"><img src="/images/prodotti_nuove/coda.gif" width="763" height="1" border="0"></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>