open url from sql query
Posted: 2019-07-24 22:40
hello everyone, i put this code in my home page as an attempt to open an url based off a query from the db, please help if you can. thank you.
home.php
guidetotreinocardio_pdf.php
home.php
Code: Select all
<div class="row custom_links" id="custom_links">
<button type="button" class="btn btn-success btn-lg" style="width:40%" onclick="window.location.replace('coachrubens/../hooks/guidetotreinocardio_pdf.php')" >
<i class="glyphicon glyphicon-indent-right"></i> Treino e Cardio</button>
</div>
Code: Select all
<?php
$currDir = dirname(__FILE__) . '/..';
include("$currDir/defaultLang.php");
include("$currDir/language.php");
include("$currDir/lib.php");
$mi = getMemberInfo();
$user = $mi['username'];
$id = sqlValue('SELECT MAX(ordem) FROM treinocardio WHERE user = $user');
$id2 = sqlValue('SELECT id FROM treinocardio WHERE ordem = $id');
window.open('treinocardio_pdf.php?id=' + $id2);