Jump to content
Fórum Script Brasil
  • 0

Duvida


neo
 Share

Question

Galera tenho um sistema de veiculos em asp e to mudando td para php.

E ele funciona da seguinte forma: Vou no meu sistema da empresa e importo os veiculos que estao no sistema para um *.txt depois importo td para o bd.

Dai tenho um select que seleciona os veiculos que estao no banco.

também tenho que tirar as fotos dos veiculo. Dai faço um select no banco. Se a foto existir mostro ela se não mostro a imagem não.jpg

Como posso fazer isso no php

placax=objRS.Fields("placanet").Value

Set objFS = Server.CreateObject("Scripting.FileSystemObject")
Set ObjArq = ObjFs.GetFile(Server.MapPath("fotos/não.jpg"))
If objFS.FileExists(Server.MapPath("fotos/"&placax&"")) then
   placanet=placax
Else
    placanet="não.jpg"
End If
%>

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

e +/- assim, se não existir a foto no banco era pra mostrar os dados do veiculo e a foto mostrar a foto que esta na pasta fotos/não.jpg.

no select aqui a placa e o nome da foto tipo gql0000 que esta gravado no banco, se ela exitir mostra se não, mostra a não.jpg

<?
include "conexao.inc.php";
$conexao = mysql_select_db ($bd, $sql);

?>
<?
$sql=mysql_query("select * from usados WHERE id='$id' OR placa='$placa'");
if ($placa == "0") {
echo "<img width='80' height='80' src=fotos/não.jpg>";
} else {
echo "";
}
while($row = mysql_fetch_array($sql)) {
$id = $row["id"];
$am = $row["am"];
$modeloversao = $row["modeloversao"];
$placanet = $row["placanet"];
$placa = $row["placa"];
$combustivel = $row["combustivel"];
$empresa = $row["empresa"];
      print"
<html>
<head>
	<title>::DETALHES DO ANUNCIO:: </title>

</head>

<body topmargin='0' leftmargin='0' bgcolor='#FF7200'>

<table width='365' height='27' cellpadding='2' cellspacing='0'>
<tr>
	<td width='107' valign='top' height='23'>

 <img width='80' height='80' src=$placanet>


	<!-- Espaço *********************** -->
  <font ><br></font>

	<!-- Opcionais ******************** -->
	</td>
<!-- Coluna Direita ***************************** -->
	<td valign='top' height='23' width='442'>
  <table height='88' width='100%' cellpadding='0' cellspacing='0' bgcolor='#FF7200'>
  	<tr><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'>
    <td bgcolor='#FF7200' valign='top' height='72'>
                               <div align='left'>
  <table width='238' height='116' style='font-family: arial, verdana; font-size: 11px; padding-left: 4px; padding-right: 4px' cellpadding='0' cellspacing='1'>
	<!-- Título *********************** -->
          <tr>
      <td align='center' bgcolor='#FF7200' valign='top' height='14' width='232' colspan='2'><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'>
  	<b><center>&nbsp;::: DETALHES :::</center>
            </b></td>
    </tr>
    <tr>
      <td  valign=top height=15px 1px;border: solid 1px; width=35>
            Nome:</td>
      <td bgcolor='#FF7200'  valign='top' height='15px' width='173'>
            $modeloversao</td>
    </tr>
    <tr>
      <td  valign=top height=15px 1px;border: solid 1px; width=35>
            Endereço:&nbsp;</td>
      <td bgcolor='#FF7200' valign='top' height='15px' width='173'>
            $am</td>
    </tr>
    <!--
    <tr>
      <td bgcolor='white' valign='top' height='15px'>
  	Kilometragem</td>
  	<td bgcolor='#fbfeff' valign='top' height='15px'>
  	<b></b></td>
    </tr>
    -->
      <tr>
  	<td  valign=top height=15px 1px;border: solid 1px; width=35>
            Bairro:&nbsp;</td>
  	<td bgcolor='#FF7200' valign='top' height='15px' width='173'>
            $bairro</td>
    </tr>
      <tr>
  	<td  valign=top height=15px 1px;border: solid 1px; width=35>
            Titulo:&nbsp;</td>
  	<td bgcolor='#FF7200' valign='top' height='15px' width='173'>
            $titulo</td>
    </tr>
      <tr>
  	<td bgcolor='#FF7200' valign='top' height='45' width='59'>
            Conteudo:</td>
  	<td bgcolor='#FF7200' valign='top' height='45' width='173'>

$conteudo


            </td>
    </tr>
  </table>
                       </div>
    </td>
  	</tr>
  </table>

	</td>
</tr>
</table>

<table width=365 height=36>
  <tr>
    <td width=355 height=14>
                  <p align=center><B>&nbsp;
                  </b><B> &nbsp;&nbsp;

                  <a Style=' CURSOR: hand;   TEXT-DECORATION: none' href='javascript:window.print()';><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'> Imprimir Página</a> </font>
                  &nbsp;&nbsp;

                  <a Style=' CURSOR: hand;   TEXT-DECORATION: none' href='javascript:window.opener=self;window.close();'><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'>Fecha Janela</a></font></b></p>
    </td>
  </tr>
  <tr >
    <td width=355 height=10 bgColor=#FF7200>
      <p align=center><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'>Site: <a Style=' CURSOR: hand;   TEXT-DECORATION: none' target=black href=$site></font><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'>$site</a></font>&nbsp;&nbsp;&nbsp;
      <b><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'>Email: $email</font></b>
      </p>
    </td>
  </tr>
</table>


</body>
</html>


";   }
       ?>

Link to comment
Share on other sites

  • 0

Galera ai esta do geito que eu queria....falou

<?
include "conexao.inc.php";
$conexao = mysql_select_db ($bd, $sql);

?>
<html>
<head>
	<title>::DETALHES DO ANUNCIO:: </title>

</head>

<body topmargin='0' leftmargin='0' bgcolor='#FF7200'>

<table width='365' height='27' cellpadding='2' cellspacing='0'>
<tr>
	<td width='107' valign='top' height='23'>

 <?
$sql=mysql_query("select * from usados WHERE id='$id' OR placa='$placa'");
if(file_exists("fotos/$placa"))    //->caminho completo da foto
{ echo "<img width='80' height='80' src='fotos/$placa'>";
} else {
echo "<img width='80' height='80'src='fotos/não.gif'>";
}
while($row = mysql_fetch_array($sql)) {
$id = $row["id"];
$am = $row["am"];
$modeloversao = $row["modeloversao"];
$placanet = $row["placanet"];
$placa = $row["placa"];
$combustivel = $row["combustivel"];
$empresa = $row["empresa"];
      print"


	<!-- Espaço *********************** -->
  <font ><br></font>

	<!-- Opcionais ******************** -->
	</td>
<!-- Coluna Direita ***************************** -->
	<td valign='top' height='23' width='442'>
  <table height='88' width='100%' cellpadding='0' cellspacing='0' bgcolor='#FF7200'>
  	<tr><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'>
    <td bgcolor='#FF7200' valign='top' height='72'>
                               <div align='left'>
  <table width='238' height='116' style='font-family: arial, verdana; font-size: 11px; padding-left: 4px; padding-right: 4px' cellpadding='0' cellspacing='1'>
	<!-- Título *********************** -->
          <tr>
      <td align='center' bgcolor='#FF7200' valign='top' height='14' width='232' colspan='2'><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'>
  	<b><center>&nbsp;::: DETALHES :::</center>
            </b></td>
    </tr>
    <tr>
      <td  valign=top height=15px 1px;border: solid 1px; width=35>
            Nome:</td>
      <td bgcolor='#FF7200'  valign='top' height='15px' width='173'>
            $modeloversao</td>
    </tr>
    <tr>
      <td  valign=top height=15px 1px;border: solid 1px; width=35>
            Endereço:&nbsp;</td>
      <td bgcolor='#FF7200' valign='top' height='15px' width='173'>
            $am</td>
    </tr>
    <!--
    <tr>
      <td bgcolor='white' valign='top' height='15px'>
  	Kilometragem</td>
  	<td bgcolor='#fbfeff' valign='top' height='15px'>
  	<b></b></td>
    </tr>
    -->
      <tr>
  	<td  valign=top height=15px 1px;border: solid 1px; width=35>
            Bairro:&nbsp;</td>
  	<td bgcolor='#FF7200' valign='top' height='15px' width='173'>
            $bairro</td>
    </tr>
      <tr>
  	<td  valign=top height=15px 1px;border: solid 1px; width=35>
            Titulo:&nbsp;</td>
  	<td bgcolor='#FF7200' valign='top' height='15px' width='173'>
            $titulo</td>
    </tr>
      <tr>
  	<td bgcolor='#FF7200' valign='top' height='45' width='59'>
            Conteudo:</td>
  	<td bgcolor='#FF7200' valign='top' height='45' width='173'>

$conteudo


            </td>
    </tr>
  </table>
                       </div>
    </td>
  	</tr>
  </table>

	</td>
</tr>
</table>

<table width=365 height=36>
  <tr>
    <td width=355 height=14>
                  <p align=center><B>&nbsp;
                  </b><B> &nbsp;&nbsp;

                  <a Style=' CURSOR: hand;   TEXT-DECORATION: none' href='javascript:window.print()';><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'> Imprimir Página</a> </font>
                  &nbsp;&nbsp;

                  <a Style=' CURSOR: hand;   TEXT-DECORATION: none' href='javascript:window.opener=self;window.close();'><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'>Fecha Janela</a></font></b></p>
    </td>
  </tr>
  <tr >
    <td width=355 height=10 bgColor=#FF7200>
      <p align=center><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'>Site: <a Style=' CURSOR: hand;   TEXT-DECORATION: none' target=black href=$site></font><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'>$site</a></font>&nbsp;&nbsp;&nbsp;
      <b><font color='#FFFFFF' size='1' face='Verdana, Arial, Helvetica, sans-serif'>Email: $email</font></b>
      </p>
    </td>
  </tr>
</table>


</body>
</html>


";   }
       ?>

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
      150.7k
    • Total Posts
      648.4k
×
×
  • Create New...