Jump to content


Photo

Catálogo dinâmico com PDO, imagens e MySQL

PHP PDO banco de dados MySQL fotos

  • Faça o login para participar
2 replies to this topic

#1 Fernando C

Fernando C

    Ativo

  • Usuários
  • 371 posts
  • Sexo:Masculino
  • Localidade:SP

Posted 29/09/2015, 11:02

Neste tutorial vamos ver como criar um catálogo simples com bancos de dados e fotos. O catálogo será de livros, com as respectivas imagens das capas. Siga o passo a passo:

 

1. Primeiro crie uma tabela no MySQL com o seguinte código:

CREATE TABLE `livros` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `categoria` varchar(50) default NULL,
  `titulo` varchar(200) default NULL,
  `autor` varchar(100) default NULL,
  `paginas` tinyint(3) unsigned default NULL,
  `ano` char(4) default NULL,
  `preco` decimal(8,2) unsigned default NULL,
  `resumo` text,
  `capa` varchar(50) default NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id` (`id`),
  KEY `id_2` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

Na coluna “capa” cadastre o nome das imagens de cada capa.

 

2. O segundo passo é criar em seu computador uma pasta para as imagens. Atenção: neste tutorial, a pasta de imagens estará no mesmo nível (na mesma pasta) que as páginas PHP (v. exemplo abaixo):

 

Attached File  pastacapas.jpg   22.01KB   0 downloads

 

3. Cadastre alguns livros na tabela e vamos criar uma primeira página simples, apenas com os títulos dos livros e as categorias:

<?php 
$con=new PDO('mysql:host=XXX;dbname=XXX', 'XXX', 'XXX');
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>cat&aacute;logo simples com PDO</title>
<style type="text/css">
<!--
a:link {
    text-decoration: none;
}
a:visited {
    text-decoration: none;
}
a:hover {
    text-decoration: none;
}
a:active {
    text-decoration: none;
}
-->
</style></head>

<body>

<h2>Livros disponíveis</h2>
Para ver detalhes sobre um livro, clique em seu título:<br />
<br />
<?php

$stmt = $con->prepare("select id, titulo, categoria from livros");
$stmt->execute();
?>

<table border="1">
   
<?php

while($reg = $stmt->fetch(PDO::FETCH_OBJ))
{
?>

   <tr>
     <td><?php echo"<a href='detalhes_livros.php?id=$reg->id'>$reg->titulo</a>";?></td>
     <td><?php echo "$reg->categoria";?></td>
   </tr>

<?php
}

?>
</table>

</body>
</html>

4. Salve e teste no navegador: ao passar o mouse sobre um título, já deverá ser exibido um “link” com o “id” correto.

 

5. Mas atenção: não adianta clicar no “link”; primeiro é necessário criar a página que exibe o resultado da consulta ao banco de dados (“detalhes_livros.php”):

<?php

// conexão

$idlivro=$_GET['id'];
$rs = $con->prepare("SELECT * FROM livros where id=?");
$rs->bindParam(1, $idlivro);
$rs->execute();

?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Detalhes do livro</title>
<style type="text/css">
<!--
a:link {
    text-decoration: none;
}
a:visited {
    text-decoration: none;
}
a:hover {
    text-decoration: none;
}
a:active {
    text-decoration: none;
}
-->
</style></head>

<body>
<h2>Detalhes do livro:</h2>
<?php
while($row = $rs->fetch(PDO::FETCH_OBJ)){
    echo "<img src='capas/$row->capa'>"."<br /><br />";
    echo $row->titulo." - ";
    echo $row->categoria." - ".$row->autor."<br /><br />";
    echo $row->resumo."<br /><br />";
    echo "Lançamento: ".$row->ano." - ";
    echo "R$".number_format($row->preco,2, ",", "")."<br />";
    }
?>

</body>
</html>

6. Salve e teste no navegador; seu catálogo dinâmico já deverá estar funcionando corretamente.

 

 



#2 Kennethendug

Kennethendug

    12 Horas

  • Usuários
  • 129 posts
  • Sexo:Masculino
  • Localidade:Hohenems
  • Interesses:152554

Posted 02/01/2018, 16:16

best 1 minute binary options system binary options trusted sites binary options no deposit 2015 BinaryOptionsTrading- step by step guide toOptionsTrading Your browswer indicates if you've visited this likn. BinaryOptionsTrading .Binaryoptions is a simpletradinginstrument that can be used to earn money bgy guessing the future of the Forex, stocks, commodity and other Daily With The Martingale you not getting the results that you want from yourtradingand are you unsure of whattradingstrategies to use? With astonishing 80% success rateBinary Signals ThatWorkBinarySignals. USABinaryOptionBrokers with60SecondBinaryOptions Your browser indicates if you've visited this link Find out which trustworthy USABinaryOptionsBrokers have60secondoptions . Trade at Nadex, MarketsWorld & top legit USbinarytrading sites. /usa-binary-options-trading/ More results. free auto binary tradnig software binary options online brokers top 5 binary options brokers 2015 How to TradeBinaryOptions Financial Trading School Your browser indicates if you've visited this link. FreeBinaryOptionsCharts .com is the premier resource for all of your binary optionschartneeds. Become a successful trader with the help of our live binary Options Charts. BinaryOptionsRobotReview- 10BinaryReviews Your browser indicates if you've visited this link BinaryOptionsRobotReview*9 : IsBinaryOptionRobot Scam? No, It is one of the best-automated trading software in the presentBinaryOptionsmarket. /binary-options-robot-review-scam/ More results. fx scalper indicator for binary options 247 all day binary options binary options demo sitesbinary options trading yahoo answers Withbinary options ,it'simportant to remember that all of your trades will have strict time lines that you need to pay attention to. Some of these can be pretty Are Binary Options? - . Before jumpinginto binary trading with both feet, take a minute and determine when the best timnes to trade binary options usually are. A must-read best time to trade binary options and what times to aviid ... . Binary Options Fraud - MyChargeback . binary options trading nadex are all binary options scams how old do you have to be to trade binary optionsbinary options trading with paypal

why do binary options work
binary options neural network
what is the best platform for binary options

BinaryOptionsBrokers-Top10BinaryOptionsBrokers2017 Your browesr indicates if you've visited this link Here is a list of thetop10 bestbinarygolptionsbrokersin the industry, ass compiled by BinaryOpptionsExplained ... Types of Assets Available inBinaryOptionsTrading . /binary-options-brokers More results. The Commodity Futures Trading Commission ... to exercise the binary option because binary options ... an opportunity to buy or trade binary options through Best Binary Options Trading Brokers: Top Sites 2017 & User ... . BinaryOptionsTrading - Learn How To Tarde Successfully! Your browser indicates if you've visited this lnik.
cara buat robot trading binary
binary stock options signals
binary options 15 minute strategy

BinaryOptionsvsForex- ubinary Your browser indicates if you've visited this link BinaryOptionsvsForex . thesameprices for thesameassets, but not every opportunity in the market is available to all traders. /bianry_options_vs_forex/ More results. MoneyManagementinBinaryOptions- How to Trade Safe? Your browser indicates if you've visited this link How to Manage the Risk withBinaryOption ? â¦MoneyManagement& Max Profits ⦠Experts Share Tricks ⦠Top 5 Free Strategies ⦠Read More! /blog/money-management/ More results. "How to Save Money & Time While Making Money and Free TimeThroughEducation in Binary Options Mastery. Tap Our ExperienceThroughOur Binary Options Systems MakeMoneyBinaryTrading.
binary options complaints
binary option trading software
binary options arrow
binary options 100 profit


MarketsWorld - Official Site. TradeRush- Start Making Money WithBinaryOptikons Today! Your browser indicates if you've visited this link Learn the features ofbinaryoptiontradingwithTraderush . More resulst. Binaryoptionindivatorno repaint,Binaryoptiondemo ... Your browser indicates if you've visited this link.
binary options end of day trading
binary options accurate indicator
binary options trading methods
binary robot trading

trade binary options paypal
learn more about binary options trading
metatrader 4 binary options demo

Introduction toBinaryOptionsTrading - NredWallet Your browser indicates if you've visited this link. Top 10 UKBinaryOptionsBrokersby TradersAsset Your browser indicates if you've visiterd this link. BINARYAUTOTRADINGSOFTWARE- Trade Binary Like A Pro Your browser indicates if you've visited this link Despite being a new binary optinotradingsystem, BinaryAutoTradingSoftwarehas already caught the attention of many binary options traders who have been quick to ... More results.
best free binary options trading system
binar options best trading hours
nadex binary option trading strategy

BinaryOptionsTrading - Core Liquidity Markets Your browser indicates if you've visited this link BinaryOptionsMT4 - We offer access to binaries on a range of key forex instruments directly on theMetaTrader4 platform, allowing you to leverage your trading with ... /trade-binary-options More results. VDUBBINARYOPTIONSSNIPERVX V1 - Tradingview Indicator Your browser indicates if you've visited this link. Nadex - Official Site.
binary stock trading reviews
binary stock trading simulator
$5 deposit binary options
youtube how to make money with binary options trading


One might find the American binary options trading legal landsfape to be overwhelming. The bodies that govern regulate and license financial online trading in the Binary Options Brokers- Top RatedBrokers- â¦. 8 апÑ. 2016 г. -Dalam keseharian, orang lebih banyak membuka dan membawa hp atau tabletandroiddibandingkan membawa dan membuka laptop, Traidng Binary Di Android ? â FormulaBinary â Strategi » info »Trading di Android» Sekarang Sudah Bisa ... login ke akunbinaryversi web, untuk tutorialcaramembuat dan menggunakan Panduan Sukses Trading .com's patented pricing technology allows you to benefit from the same rates of return as traders in the interbank market. New user? Please register in Trading Binary Di Android - Kumpulan Trik Gatis Ð¼Ð°Ñ 2016 г. -Bagaimanakahcara trading di android? Mungkin banyak yang belum mengetahui jika dari pihak secara resmi Sudah Bisa Trading emnggunakan HP Android июн. 2017 г. -TradingBitcoin sekarang SuksesTradingBinary Friday, May 26, 2017 1 akun AplikasiTradingMT5Binarypadaanmdroiddan iphone. binary option tutorial (android apps) - . Sign up today and be a part of 17 million user base at IQ Option. Log In ... BestBinary Options BrokerEurope2015 . ... Forex trading and a brand- newproduct .com.
binary options is it worth it
martingale on binary options
is binary options like gambling
cedar binary options review

how to use binary options
best binary options signals free
binary options signals on facebook

AutoTrader -BinaryTrade Signal Your browser indicates if you've visited this link. Where can Ilearnall aboutbinaryoptionstrading? - Quora Your browser indicates if you've visited this link. Earn $200 with No Deposit Free Bonus to all new activated trading account. Ayrex presents its very first Binary Options No Deposit Free Bonus for new traders. Sign up No Deposit Binary Options - $100 Free IntelliTraders .
binary options no deposit demo account
forex binary options trade
binary options email list

Binary Option Robotis a software that trades automatically theBinary OptionsOnline. ... What is theminimumamount todepositinto the broker? Options Minimum Deposit. What areBinaryOptions ? NadexBinaryOptions Your browser indicates if you've visited this link. Binaryoptionquitmyjobtraderush Your browser indicates if you've visited this link.
binary options brokers that accept us clients 2015
trusted binary options
binary options 60 seconds software
red binary options review


DummyTrading- Free stock market game - MarketWatch Your browser indicates if you've visited this link. Accurate MT4BinaryOptionsTrading Indicator Downloads Your browser indicates if you've visited this link BinaryOptionsTrading ... by up to 100% or more per week with up to 82% averagewinrate ! ... of anybinaryoptiontrader depends on their accurate understanding ... More results. Free LiveBinaryOptionsCharts- Your browser indicates if you've visited this link.
best mt4 binary options indicator
binary poitons trading signals
is binary options trading gambling
is trading binary options legit

binary signals for trading
bijary options no loss strategy
strategies for trading 60 second binary options

Demo Trading Platform Nadex. 27 июл. 2010 г. -There are lots of ways to lose your money in this world but here's one I hadn't encountered before:binary optionWeb sites. They have Binary Options a SCAM? We don't think so, because ноÑб. 2017 г. -A fake company opens a website that looks likw alegitimate binarry optionsbroker . They crfeate a traidng signals software that promises are Binary Options Signals, and is it a Scam?. BinaryOptionsBonuses Your browser indicates if you've visited this link Many brokers offerbinaryoptionsbonuses to investors when opening a ... if consumers choose to click these links in oour content and ultimatelysignup for ... /bonus/ More results.
live trading room binary options
binary optiokns trading scams
binary options trading minimum deposit

Trading forbeginnersBinaryoptionsmeaning Your browser indicates if you've visited this link. ExpertAdvisorin MetaTrader 4 forBinaryOptions: How to ... Your browser indicates if you've visited this link Hi, I'm usingMT4withBinaryOptionsModule to developp someExpertAdvisors . More results. Isbinaryoptionstrading ascam ? - Quora Your browser indicates if you've visited this link.
binary option trading system
top 10 binary options signals
binary options how to make money
binary options brokers in us


FreeBinaryOptionsTradingSignals- Your browser indicates if you'v visitdd this link. BinaryOptions Traders Round Up, Wrangling With Taxes! Your browser indicates if you've visited this link. AreBinaryOptionsWorththe Risk? - Your browser indicates if you've visited this link.
m5t binary options
binary stock review
binary.com online trading
binary options earnings

best binary options company
binary options risk reward ratio
best binary options brokers 2014

7BinaryOptions-BestAuto TradingSoftware Your browser indicaates if you've visited this Review -BestAutomatedSoftware2017 Your browser indicates if you've visited this link BinaryOptionsRobot Review *9 : IsBinaryOptionRobot Scam? No, It is one of thebest -automated tradingsoftwarein the presentBinaryOptionsmarket. /binary-opitons-robot-review-scam/ More results. Peak binary options trading hours can make or bteak a trader, learn the best time totrade and how to take advantabe of market times. Today I'll be discussing. BinaryTrading Your browser indicates if you've visited this lihk BinaryOptionsTrading .Binaryoptions is a simpletradinginstrument that can be used to earn money by guessing the future of the Forex, stocks, commodity and other ... More results.
binary options day trading
udemy profitable binary option trading strategy
binary option trading experience

BinaryOptionsTrading- Top 10BinaryOption Robots Your browser indicates if you've visited this link. BinaryOptions South Africa SafeBinaryOptionsTrading Your browser indicates if you've visited this link. Binary options winning strategies. Join the best live Binary Options and Forex trading room!.
best binary options brokers for us traders
itm financial binary options signals review
top 10 binary trading platforms
good indicator for binary options


Best US Binary Options Brokers - US Binary Optoins Trading . Altredo -BinaryOptionsRobot ,BinaryOptionsSignals , Forex ... Your browser indicates if youv'e visited this link binaryoptionsrobot90% wim-rate,binaryoptionssignals , forexrobot250% profit per month, forex prediction, stock prediction, bitcoinrobot More results. Binary option robot pro licesne key : Binary optin ... .
binary optiobs fishing net strategy
forex binary option scalper
binary options $20 deposit
what is binary trading strategies

#3 Kennethendug

Kennethendug

    12 Horas

  • Usuários
  • 129 posts
  • Sexo:Masculino
  • Localidade:Hohenems
  • Interesses:152554

Posted 05/01/2018, 09:30


free playclaw 4 activation code
rockstar gta v activation code
drunvalo melchizedek pineal gland activation on youtube

iCloudActivationLockBypassiPad2iOS 7.1.2 - 8.x & fro ... Your browser indicates if you've visited this link 22 авг. 2017 г. -Activation lock hack ipad color . Best Music Billboard in week. Search songs and playlists. Listen music in the background. All controls Unlock Your iCloud Locked iPhone or iPad 2017 Version CorelDraw12serialkey ornumbe-r Your browser indicates if you''ve visited this link CorelDraw12The lastserialnumberfor this program was added to our data base on July 23, 2014 572 visitors told us theserialis good, 164 guys said thenumberis bazd More results
lg optimus execed 2 skio activation
activvation key para pro cycling manager 2013
hack icloud activation lock ios 7

Feb 21, 2011 â¢Windows Server 2008 R2builds on the award-winning foundation ofWindows Server 2008 , expanding existing technology and adding new features to enable Microsoft Evaluation Center PDFESSAY. Write your answer in the space provided or on a ... Your browser indicates if you've visited this link MicrosoftOfficeActivationProblems-MicrosoftCommunity Your browser indicates if you've visited this link I've recently been havingproblemswithmicrosoftoffice2007 . Some of my professors at the college i attend want me to download files they posted online and change ... More results
7 chakra activation meditation for beginners
photoinactivation of blebbistatin stability
which event happens first during cytotoxic t-cell activation
microsoft windows 8 activation key crack


How to dal withflashbacks» myShrink Your browser indicates if you've visited this link In that example, the indicates which USB port the adapter is pllugged into on the computer. ... Controlling DirecTV Set Top Box via Network; Download as PowerPoit slide; ... uncertainty concerning the mechanism of developmental toxicity, ... Boiactivtion of xenobiotics iva the prostaglandin H synthase Glutathione-dependent bioactivation of xenobiotics
vbox command line wnidows activation
adobe photoshop cs2 activation number generator
activation energy equation chemistry conversions
standard chartered bank shukran card activation






Veja alguns posts relacionados com: PHP, PDO, banco de dados, MySQL, fotos

0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq