1
Hello, I created the connected.php file as below:
<?
$conn= new PDO("mysql:host=localhost;dbname=site", "root", "");
$count = ('SELECT * FROM conteudo');
$stmt = $conn->prepare($count);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
return $result;
?>
And here I give only the include of the connected.php file.?
<?php include "conexao.php"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Contentype" content="text/html; charset=iso-8859-1" />
<title> Painel Adm. Conteudo</title>
<script type="text/javascript" src="//code.jquery.com/jquery-1.9.1.js"></script>
<link rel="stylesheet" type="text/css" href="/css/normalize.css">
<script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js">
</script>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="/css/result-light.css">
</head>
<body>
<div id="texto001" align="left" style=" font-family:Verdana, Geneva, sans-serif;
color:#000000; font-size:12px; float:none; width:<? echo $res['larg_tex001'];?>px;
height:<? echo $res['altu_tex001'];?>; position: absolute; left: <? echo $res['hori_tex001'];?>px;
top: <? echo $res['vert_tex001'];?>px;">
<img align="left" src="upload/esp_texto.png" /> <?php echo $res['texto001'];?>
</div>
<img width="<? echo $res['larg_img001'];?>" height="<? echo $res['altu_img001'];?>"
align="left" src="upload/<? echo $res['img001'];?>" style="position: absolute;
left: <? echo $res['hori_img001'];?>px; top: <? echo $res['vert_img001'];?>px;" />
</body>
</html>
But I’m getting the following message below:
I ask friends what is missing to work on WAMPSERVER? If your friends can help me solve this problem, I’d really appreciate it. Hugs to all, and I await your help.
Do I make this statement in the same connection file or create another file? I run where in my mysql_query, or in the content page? Well I did that and stopped sending me messages, but it doesn’t bring me anything else, the page is totally empty. Teria como vc. demonstrate to me what would be the acquisitions connected and where the search will be made. From now on my thanks and excuse me, because I am very lay in PHP and I am trying to learn.
– Murilo Cabral
All together in this same order, open connection creates the statement with the desired query and runs. Forget what you did, you joined PDO and mysql_query, both do not cohesite, or is the way I did
PDO
or mysql_query.– Ricardo
I edited my question with your guidelines. That would be it?
– Murilo Cabral
Friend Ricardo, solved, besides his tips being correct, I was using <? echo $result ['item']; ? >, or was forgetting PHP after ? to fetch the data. .
– Murilo Cabral
@Murilocabral!
– Ricardo