Jump to content
Fórum Script Brasil
  • 0

(Resolvido) Ajuda com variavel


fernandotrilha
 Share

Question

Bom dia pessoal, estou aqui mais uma vez necessitando de uma ajuda...

Tenho o seguinte código abaixo que me retorna o seguinte erro:

Notice: Undefined variable: vm2 in /var/www/Consulta/Projeto/pagina.php

 

include ('../includes/conex.php');

$query = "    SELECT     TOP (100) PERCENT tbpre.nroe_p, tbpre.nrop_p, tbpre.inip_p, tbpre.finp_p, tbpre.desp_p, tbcor.nomc_c, tbcor.sigc_c, tbmec.decm_m, tbtam.sigt_t, tbpri.nrom_p,
tbpri.nroc_p, tbpri.nrot_p, tbpri.valp_p, tbdes.desd_d, ROUND(tbpri.valp_p * ((100.000 - tbdes.desd_d) / 100), 2) AS prep_p, tbdes.nrod_d, tbdes.tipd_d, tbdes.clid_d,
dbo.tbcli.nomc_c AS razc_c, dbo.tbcli.conc_c,  dbo.tbcli.nroc_c, tbcli.nroe_c
FROM         dbo.tbpre AS tbpre INNER JOIN
dbo.tbpri AS tbpri ON tbpre.nroe_p = tbpri.nroe_p AND tbpre.nrop_p = tbpri.nrop_p INNER JOIN
dbo.tbmec AS tbmec ON tbpri.nroe_p = tbmec.nroe_m AND tbpri.nrom_p = tbmec.nrom_m INNER JOIN
dbo.tbtam AS tbtam ON tbpri.nrot_p = tbtam.nrot_t INNER JOIN
dbo.tbcor AS tbcor ON tbpri.nroc_p = tbcor.nroc_c INNER JOIN
dbo.tbdes AS tbdes ON tbpri.nroe_p = tbdes.nroe_d AND tbpri.nrom_p = tbdes.nrom_d AND tbpri.nrot_p = tbdes.nrot_d AND tbpri.nroc_p = tbdes.nroc_d INNER JOIN
dbo.tbcli ON tbdes.nroe_d = dbo.tbcli.nroe_c AND tbdes.clid_d = dbo.tbcli.nroc_c
WHERE     (tbpre.inip_p <= GETDATE()) AND (tbpre.finp_p >= GETDATE()) AND tbcli.nroc_c = $codCliente AND tbcli.nroe_c = '1' AND tbmec.decm_m = 'VIDRO TEMP.' AND tbcor.nomc_c = '$Tipo' AND tbtam.sigt_t = '$Espessura' 
ORDER BY tbpre.nroe_p, tbpre.nrop_p, tbdes.nrod_d, tbcor.nomc_c, tbtam.sigt_t";

/* execute the SQL query and return records */
$result = mssql_query($query) or die('A error occured: ' . mysql_error());

while ( $record = mssql_fetch_array($result) )
{
$vm2 = $record['prep_p']; 
}
$Valor = ($vm2) * ($Metragem);
$Valor = number_format($Valor, 0, ',', '.');

//free result set memory
        mssql_free_result($result);

    //close the connection
mssql_close($dbhandle);
?>

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Pessoal, descobri que o erro tem haver com isso:

WHERE     (tbpre.inip_p <= GETDATE()) AND (tbpre.finp_p >= GETDATE()) AND tbcli.nroc_c = $codCliente AND tbcli.nroe_c = '1' AND tbmec.decm_m = 'VIDRO TEMP.' AND tbcor.nomc_c = '$Tipo' AND tbtam.sigt_t = '$Espessura' 

$Vidro = $_POST['Vidro'];
$Tipo = $_POST['Tipo'];
$Espessura = $_POST['Espessura'];

Assim como esta acima da erro, se eu colocar como esta abaixo dá

 

$Vidro ='VIDRO TEMP.';
$Tipo = 'INCOLOR';
$Espessura = '08 MM';

 

Mas ainda não descobri como resolver...

Edited by fernandotrilha
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.2k
×
×
  • Create New...