[Gambas-user] Gambas Server Pages & mysql

Benoît Minisini gambas at ...1...
Wed Apr 22 20:51:27 CEST 2009


> Hey guys,
>
> With the example below Gambas Server Pages were introduced.
>
> My question is:
> 1) how would I achieve a connection to a mysql database or any database for
> that matter?
> 2) where in the code below would I put the necessary statements?
> 3) if no direct reference to any database objects can be made is the
> alternative, by lets say, using an external gambas module or some other
> trick?
>
> --8<-----------------------------------------------------------------------
>---------------------------------------------------------------
>
> #!/usr/bin/env gbw2
> <%
> DIM sEnv AS String
> %>
>
> <!-- Variable declaration must come before any HTML -->
>
> <html>
>
> <h2>CGI script environmental variables</h2>
>
> <table border="1" cellspacing="0" cellpadding="2">
>
>   <tr>
>     <th align="left">Name</th>
>     <th align="left">Value</th>
>   </tr>
>
> <% FOR EACH sEnv IN Application.Env %>
>   <tr valign="top">
>     <td><%= sEnv %></td>
>     <td><%= Application.Env[sEnv] %> </td>
>   </tr>
> <% NEXT %>
>
> </table>
>
> </html>
> --8<-----------------------------------------------------------------------
>---------------------------------------------------------------
>
> Thanks in advance
>
> Regards
> Dimitris

You must add:

<% 
USE "gb.db"
%>

at the beginning of the page, and then you can access any database.

Regards,

-- 
Benoît




More information about the User mailing list