Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Posts
    2

    Red face Unanswered: Help PL/SQL to PL/pgSQL

    Hi! I need help please... if someone could help i really appreciate...

    heres the deal:

    i made one year ago a webpage with a database on isQL*plus (pl/sql) language..

    on my webpage i have this (i will show images to you understand better what i mean):
    http://img36.imageshack.us/img36/578...rjogadores.jpg

    code:
    Code:
    procedure gerir_jogadores is
    cursor c_jogadores is
    select * from jogadores, equipas, tipoposic
    where joga_equi_id = equi_id and joga_tipoposic_id = tipoposic_id;
    begin
    htp.p('<html>');
    htp.p('
    <body style="background-color: #339F2A;">
    <h2>JOGADORES</h2>
    <table width="100%" border="1">
    <tr>
    <th>Nome</th>
    <th>Data Nascimento</th>
    <th>Local Nascimento</th>
    <th>Nacionalidade</th>
    <th>Posi&#231;&#227;o</th>
    <th>Personalidade</th>
    <th>Equipa</th>
    <th>&nbsp;</th>
    </tr>
    ');
    -- Cursor para preencher tabela com os resultados da tabela jogadores
    for r_jogadores in c_jogadores loop
    htp.p('<tr>');
    htp.p('<td align="center">'||r_jogadores.joga_nome||'</td>');
    htp.p('<td align="center">'||to_char(r_jogadores.joga_data_nsc,'dd.mm.yyyy')||'</td>');
    htp.p('<td align="center">'||r_jogadores.joga_local_nsc||'</td>');
    htp.p('<td align="center">'||r_jogadores.joga_nacionalidade||'</td>');
    htp.p('<td align="center">'||r_jogadores.tipoposic_posicao||'</td>');
    htp.p('<td align="center">'||r_jogadores.joga_personalidade||'</td>');
    htp.p('<td align="center">'||r_jogadores.equi_nome||'</td>');
    htp.p('<td align="center"><input type="button" value="Editar" onclick="window.location=''est.form_editar_jogador?p_joga_id='||r_jogadores.joga_id||''';"></td>');
    htp.p('</tr>');
    end loop;
    htp.p('<tr><td align="center" colspan="11"><input type="button" value="Criar Novo Jogador" onclick="window.location=''est.form_inserir_jogador'';"></td></tr>');
    htp.p('</table>');
    htp.p('<br></br><br></br><br></br><p align="center"><input type="button" value="Voltar" onclick="window.location=''est.home'';"></p>');
    htp.p('</body></html>');
    end;
    and when i click on the "Editar" (means edit) button (check the image), i enter on this:

    http://img203.imageshack.us/img203/3...tarjogador.jpg

    Code:
    Code:
    procedure form_editar_jogador(p_joga_id in number) is
    cursor c_jogadores is
    select * from jogadores where joga_id = p_joga_id;
    cursor c_tipoposic is
    select * from tipoposic;
    r_jogadores c_jogadores%rowtype;
    begin
    open c_jogadores;
    fetch c_jogadores into r_jogadores;
    close c_jogadores;
    htp.p('<html>');
    htp.p('
    <body>
    <h2>Alterar/Apagar Jogador </h2>
    <form action="est.actualizar_jogador" method="post">
    <input type="hidden" name="p_joga_id" value="'||r_jogadores.joga_id||'">
    <table>
    <tr>
    <td>Nome:</td><td><input type="text" size="50" name="p_joga_nome" value="'||r_jogadores.joga_nome||'"></td>
    </tr>
    <tr>
    <td>Data de Nascimento:</td><td><input type="text" size="10" name="p_joga_data_nsc" value="'||to_char(r_jogadores.joga_data_nsc,'dd.mm.yyyy')||'"></td>
    </tr>
    <tr>
    <td>Local de Nascimento:</td><td><input type="text" size="50" name="p_joga_local_nsc" value="'||r_jogadores.joga_local_nsc||'"></td>
    </tr>
    <tr>
    <td>Nacionalidade:</td><td><input type="text" size="50" name="p_joga_nacionalidade" value="'||r_jogadores.joga_nacionalidade||'"></td>
    </tr>
    ');
    htp.p('<tr><td>Posi&#231;&#227;o:</td><td><select name="p_joga_tipoposic_id">');
    for r_tipoposic in c_tipoposic loop
    htp.p('<option value="'||r_tipoposic.tipoposic_id||'"');
    if r_jogadores.joga_tipoposic_id = r_tipoposic.tipoposic_id then
    htp.p(' selected ');
    end if;
    htp.p('>'||r_tipoposic.tipoposic_posicao);
    end loop;
    htp.p('</select></td></tr>');
    htp.p('
    <tr>
    <td>Personalidade:</td><td><input type="text" size="50" name="p_joga_personalidade" value="'||r_jogadores.joga_personalidade||'"></td>
    </tr>
    <tr>
    <td align="center" colspan="2">
    <input type="submit" value="Alterar">&nbsp
    <input type="button" value="Apagar" onclick="window.location=''est.apagar_jogador?p_joga_id='||r_jogadores.joga_id||''';">&nbsp
    <input type="button" value="Voltar" onclick="window.location=''est.gerir_jogadores'';">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    ');
    end;
    You understand what i'm making? i click on button to edit a player, that i choose from his id...


    NOW, my problem is that i'm making a webpage but with a database on postgreSQL (PL/pgSQL) and the page is in PHP, i wanted to make something like that i made on that page...

    i want to show my table with my client's name and when i click on the button that is in front of each name, i want to open a new page (sending that client ID), so on the next page i can edit them...


    Thanks

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •