Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

How can I delete mySQL records from an html or jsp page?

mysql records

  • Please log in to reply
2 replies to this topic

#1 bigz008

bigz008

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

Posted 05 March 2010 - 06:26 AM

Hi guys, I've created a .jsp page which gets all the records I put in the database (from mySQL Query browser) and displays them in a table.

<html>

<table style="width: 100%" class="style4" cellspacing="1" cellpadding="3">
            
<tr>
<td style="width: 90px" id="tableheadercell" class="style3">
<strong>Organsation ID</strong></td>
<td style="width: 50px"  id="tableheadercell" class="style3">
<strong>Length</strong></td>
<td style="width: 50px" id="tableheadercell" class="style3">
<strong>Amount</strong></td>
<td style="width: 80px"  id="tableheadercell" class="style3">
<strong>Trial Period</strong></td>
<td style="width: 90px" id="tableheadercell" class="style3">
<strong>Promo Minutes</strong></td>                             
</tr>
<% 
           String skuResult[][];
           skuResult = null;
        try {
        
String []  skuFields = {"orgID", "length", "amount", "trial_period", "promoMins"};

CRUD skuCRUD = new CRUD ("sku", "skuID");  
skuResult = skuCRUD.getRecords(skuFields,0,0);

        } catch (Exception e) { Tracer.logERROR("[sku/skuContent.jsp] "+e); e.printStackTrace();    } 
                         

String    skuID="";  
String    organisationID="";  
String    cc_flag="";   
String    length="";  
String    amount="";  
String    active="";  
String    trialPeriod="";  
String    description="";  
String    promoText="";  
String    promoMinutes="";  
        
for (int i = 0; i < skuResult.length; i++) {
organisationID = skuResult[i][0]; 
length = skuResult[i][1] ;
amount = skuResult[i][2];
trialPeriod = skuResult[i][3];
promoMinutes = skuResult[i][4];
%> 

<tr>
<td style="width: 90px" class="ms-list1-0001-odd"><%= organisationID %></td>
<td style="width: 50px" class="ms-list1-0001-odd"><%= length %></td>
<td style="width: 50px" class="ms-list1-0001-odd"><%= amount %></td>
<td style="width: 80px" class="ms-list1-0001-odd"><%= trialPeriod %></td>
<td style="width: 90px" class="ms-list1-0001-odd"><%= promoMinutes %></td>
</tr>
<%     Tracer.logERROR("[sku/skContent.jsp] "+"errors are after this"); } %>
                                        
</table>                                
</html>

*The CRUD file is where I connect to the db....

How can I add the functionality to add/delete the records from within my .jsp code?

Thanks in advance.
  • 0

#2 gokuajmes

gokuajmes

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 483 posts

Posted 05 March 2010 - 07:25 AM

i donno much on JSp but are there controls to present data like what .NET has,because .net controls provide functionality to add ,delete,update on the fly :)
  • 0

#3 bigz008

bigz008

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

Posted 05 March 2010 - 09:37 AM

Yea, I guess I can try opening the .jsp file with another program which contains those controls like Microsoft Expression Web2...
Thanks.
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download