function get_results($query) { global $con; if ($query == "") { echo ""; } else { $res = @odbc_exec($con, $query); if ($res) { odbc_result_all($res); } else { echo odbc_errormsg($con); } } }
print "<p>Uh-oh! Failure to connect to DSN [{$DSN}]: <br />"; odbc_errormsg(); } else { print "done</p>\n"; $resultset = odbc_exec($handle, "{$query}"); odbc_result_all($resultset, "border=2"); odbc_close($handle); } } else { print "<p>Sorry, that query has been disabled for security reasons</p>\n"; } } if ($listtables != NULL) { print "<h2>List of tables</h2>"; print "<p>Connecting... "; $handle = odbc_connect("{$DSN}", "{$uid}", "{$passwd}"); print "done</p>\n"; if (!$handle) { print "<p>Uh-oh! Failure to connect to DSN [{$DSN}]: <br />"; odbc_errormsg(); } else { $resultset = odbc_tables($handle); odbc_result_all($resultset, "border=2"); odbc_close($handle); } } ?> </body> </html>
<?php $dsn = "retstest"; $user = "******"; $pwd = "Schmoe"; // make a connection echo "about to make a connection<br/>"; $conn = odbc_connect($dsn, $user, $pwd); echo "connection made<br/>"; // create a query $query = "SELECT * FROM data:Property:ResidentialProperty WHERE ListPrice > 0"; echo "About to execute: {$query}<br/>"; $queryexec = odbc_exec($conn, $query); echo "Query done<br/>"; // Check width echo "About to get field count<br/>"; $field_count = odbc_num_fields($queryexec); echo "COUNT {$field_count}<br/>"; // Get results echo "About to display results<br/>"; odbc_result_all($queryexec, "BORDER=1"); echo "Done displaying results<br/>"; // close a connection echo "about to close connection<br/>"; odbc_close($conn); echo "connection closed<br/>";
; -- -- Create a new virtual path in Virtuoso -- -- Point to $VIRTUOSO/vsp/testapp on filesystem -- db.dba.vhost_remove (lpath=>'/myapp'); db.dba.vhost_define ( lpath=>'/myapp', ppath=>'/testapp', is_dav=>0, is_brws=>0, vsp_user=>'MYADMIN', def_page=>'myapp.php') ; -- -- End of sample -- And the $VIRTUOSO/vsp/testapp/myapp.php: <?php $db = odbc_connect(__virt_internal_dsn(), null, null); if (!$db) { error_log('odbc_connect failed'); } $rs = odbc_exec($db, 'select * from MYAPP.DBA.MYTEST'); odbc_result_all($rs); odbc_close($db);
<div class="panel panel-default"> <div class="panel-body"> <h3>Datos del Servicio</h3> <table class="table "> <thead> <th>nom_usu_real</th> <th>domicable</th> <th>telefono</th> </thead> <tbody> <tr> <?php $query_llamadas = "SELECT * FROM LLAMADAS_LINEA WHERE idusu = {$abonado}"; $res_llamadas = odbc_exec($conexion, $query_llamadas); // odbc_fetch_row($res_llamadas); odbc_result_all($res_llamadas); // echo '<td>'.odbc_result($res_llamadas, 'nom_usu_real').'</td>'; // echo '<td>'.odbc_result($res_llamadas, 'domicable').'</td>'; // echo '<td>'.odbc_result($res_llamadas, 'telefono').'</td>'; ?> </tr> </tbody> </table> </div> <!-- fin panel-body --> </div> <!-- fin panel --> </div> <!-- fin col-md-6 --> </div><!-- fin row --> </div><!--end of container--> <?php include "include/footer.html";
<?php $username = $_ENV['EASOL_USERNAME']; $password = $_ENV['EASOL_PASSWORD']; $link = odbc_connect("easol", $username, $password); if (!$link) { die("<p><strong>Unable to connect to the EASOL server</strong></p>"); } else { echo "<p><strong>Connection to EASOL server was successful.</strong></p>"; } $result = odbc_exec($link, 'SELECT * FROM information_schema.tables WHERE TABLE_SCHEMA=\'EASOL\''); odbc_result_all($result); odbc_close($link);