Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Convert a query php pdf

New Here ,
Aug 02, 2012 Aug 02, 2012

Copy link to clipboard

Copied

Hello to all of the forum,

My question is this, I am developing a page where you have a mysql query, the query works perfectly I'd like to know how do I make this query in pdf so that the person can download the pdf.

Can anyone help me.

Below is the coding.

<?php require_once('Connections/conn_vbso.php'); ?>

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  if (PHP_VERSION < 6) {

    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {

    case "text":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;   

    case "long":

    case "int":

      $theValue = ($theValue != "") ? intval($theValue) : "NULL";

      break;

    case "double":

      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

      break;

    case "date":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;

    case "defined":

      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

      break;

  }

  return $theValue;

}

}

mysql_select_db($database_conn_vbso, $conn_vbso);

$query_rs_area_de_atuacao = "SELECT * FROM area_atuacao ORDER BY area_atuacao_id ASC";

$rs_area_de_atuacao = mysql_query($query_rs_area_de_atuacao, $conn_vbso) or die(mysql_error());

$row_rs_area_de_atuacao = mysql_fetch_assoc($rs_area_de_atuacao);

$totalRows_rs_area_de_atuacao = mysql_num_rows($rs_area_de_atuacao);

$maxRows_rs_destaques = 2;

$pageNum_rs_destaques = 0;

if (isset($_GET['pageNum_rs_destaques'])) {

  $pageNum_rs_destaques = $_GET['pageNum_rs_destaques'];

}

$startRow_rs_destaques = $pageNum_rs_destaques * $maxRows_rs_destaques;

mysql_select_db($database_conn_vbso, $conn_vbso);

$query_rs_destaques = "SELECT * FROM destaques ORDER BY destaques_id DESC";

$query_limit_rs_destaques = sprintf("%s LIMIT %d, %d", $query_rs_destaques, $startRow_rs_destaques, $maxRows_rs_destaques);

$rs_destaques = mysql_query($query_limit_rs_destaques, $conn_vbso) or die(mysql_error());

$row_rs_destaques = mysql_fetch_assoc($rs_destaques);

if (isset($_GET['totalRows_rs_destaques'])) {

  $totalRows_rs_destaques = $_GET['totalRows_rs_destaques'];

} else {

  $all_rs_destaques = mysql_query($query_rs_destaques);

  $totalRows_rs_destaques = mysql_num_rows($all_rs_destaques);

}

$totalPages_rs_destaques = ceil($totalRows_rs_destaques/$maxRows_rs_destaques)-1;

mysql_select_db($database_conn_vbso, $conn_vbso);

$query_rs_ano = "SELECT * FROM ano_de_destaque ORDER BY ano_destaque_ano DESC";

$rs_ano = mysql_query($query_rs_ano, $conn_vbso) or die(mysql_error());

$row_rs_ano = mysql_fetch_assoc($rs_ano);

$totalRows_rs_ano = mysql_num_rows($rs_ano);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta name="Description" content="Prestamos assessoria jurídica em todas as áreas do Direito ligadas à atividade empresarial, sobretudo em questões envolvendo Direito Societário, Tributário, Bancário e dos Mercados Financeiro e de Capitais. Nossa meta é desenvolver alternativas e soluções jurídicas que forneçam respostas adequadas e eficazes às demandas corporativas e o suporte necessário à tomada de decisão de nossos clientes. Nossos profissionais possuem reputação nacional e internacional nas suas respectivas áreas de atuação, sendo reconhecidos pela sua alta qualidade técnica, excelência no atendimento a clientes e elevados padrões éticos." />

<meta name="google-site-verification" content="RnkYE2FRc22y4CuGrMQsWABkKj2PQOqi1xO9C2TlY6w" />

<title>Vaz, Barreto, Shingaki & Oioli Advogados</title>

<link href="css/estilo.css" rel="stylesheet" type="text/css" />

<style type="text/css">

#principal #idioma ul li a.menupt { background:url(images/marcador_idoma_hover.png) no-repeat; color:#FFF; }

.destak { width:290px; float:left; margin: 0px 9px; }

.redes img{border:none;}

</style>

<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>

<script type="text/ecmascript" src="jqFancyTransitions.1.8.min.js"></script>

<script type="text/javascript">

$(document).ready( function(){

          $('#imagem').jqFancyTransitions({ effect: 'zipper', width: 959, height: 151, position: 'alternate', delay: 3000  });

});

</script>

<script src="SpryAssets/SpryDOMUtils.js" type="text/javascript"></script>

<script src="index.js" type="text/javascript"></script>

<script type="text/javascript">

  var _gaq = _gaq || [];

  _gaq.push(['_setAccount', 'UA-20550628-1']);

  _gaq.push(['_trackPageview']);

  (function() {

    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

  })();

</script>

</head>

<body>

<div id="principal">

          <?php include('menu_topo.php'); ?>

  <?php include('topo.php'); ?>

<div id="logo">

          <a href="index.php"><img src="images/logo.png" alt="Vaz, Barreto, Shingaki & Oioli Advogados" name="marca" width="361" height="39" id="marca"/></a>

</div>

<?php include ('menu_idioma.php')?>

          <div id="imagem">

          <img src="images/imagem1.jpg" width="961" height="151" alt="" />

              <img src="images/imagem.jpg" width="961" height="151" alt="" />

  </div>

  <div id="area_atuacao">

    <h2>Áreas de Atuação</h2>

    <ul>

      <?php do { ?>

        <li><a href="areas_de_atuacao.php?id=<?php echo $row_rs_area_de_atuacao['area_atuacao_id']; ?>" class="area_de_atuacao<?php echo $row_rs_area_de_atuacao['area_atuacao_id']; ?>" title="<?php echo $row_rs_area_de_atuacao['area_atuacao_titulo']; ?>"><?php echo $row_rs_area_de_atuacao['area_atuacao_titulo']; ?></a></li>

        <?php } while ($row_rs_area_de_atuacao = mysql_fetch_assoc($rs_area_de_atuacao)); ?>

    </ul>

    </div>

  <div id="noticias_home">

    <h3>Destaques</h3>

    <?php do { ?>

    <div class="destak">

        <h4><?php echo $row_rs_destaques['destaques_titulo']; ?></h4>

        <?php echo( strlen($row_rs_destaques['destaque_conteudo']) > 190 ? substr($row_rs_destaques['destaque_conteudo'],0,190)."..." : $row_rs_destaques['destaque_conteudo']) ?>

        <h6><a href="destaques.php?ano=<?php echo $row_rs_ano['ano_destaque_ano']; ?>&id=<?php echo $row_rs_destaques['destaques_id']; ?>" title="Veja mais" style="margin-top:10px; ">Veja mais</a></h6>

    </div>

        <?php } while ($row_rs_destaques = mysql_fetch_assoc($rs_destaques)); ?>

        <p style="margin-bottom:7px;"> </p>

  </div>

          <?php include('rodape.php') ?>

</div>

</body>

</html>

<?php mysql_free_result($rs_area_de_atuacao); mysql_free_result($rs_destaques); mysql_free_result($rs_ano); ?>




Rodrigo Vieira da Silva Eufrasio
rodrigo.mct @ gmail.com
55 11 6691-5299
Brazil - Sao Paulo - Osasco
www.brandcompany.com.br

TOPICS
Server side applications

Views

1.1K
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 02, 2012 Aug 02, 2012

Copy link to clipboard

Copied

LATEST

Try tye FPDF library:

http://www.fpdf.org/

Other libraries are also avaiable if you search the web.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines