We help IT Professionals succeed at work.
Get Started

MySql Query on HTML page

JackoPinto asked
Last Modified: 2013-12-12

I'm a complete newbie here, just started to get into the whole php mysql deal.

I have a database set up, with data on it and I'm trying to display this data inside an html page.  I thought I had set up everything correctly but it just doesn't work!

At the top of my HTML page I have the following code to connect to the database and such:

include 'config.php';
include 'opendb.php'; ?>

I checked the connect info on the config file and looks all right.

Here's the query I'm trying to run at the middle of the page:

mysql_query("SET NAMES 'charset=CP1251' ");
$query = "SELECT * FROM `ap_form_14` ORDER BY ID DESC LIMIT 3";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))

echo " <div id=\"Activleftcolumn\"><img width='167px;' height='217px;' style='border:dotted 1px #cccccc; padding: 3px;' src='/forms/imagesforms/form_14/files/" . $row["element_1"] . "' /></div>";
echo "<div id=\"Actirightcolumn\">
<div id=\"actidate\">" . $row["element_3"]. "</div>
<div id=\"actihora\">
<span>De " . $row["element_4"]. "</span>
<span> A " . $row["element_7"]. "</span>
<div id=\"actititle\">" . $row["element_2"]. "</div>
<div id=\"actides\">" . $row["element_6"]. "</div>
<div id=\"actireserv\">" . $row["element_5"]. "</div>




At the bottom I have: <?php
include 'closedb.php';

I upload the page to the server and nothing comes up.  I have other php code on that same page which is working fine.

I've tried a million things and I don't know what else to do! Again, I'm a complete novice. Please help I really need to move ahead with this!

Here's the link to that page:  http://www.libreriafrancesa.net/nuevo.php

Any more info I need to provide? Do you need me to past the full code? Thanks for your help! Desperate here.
Watch Question
This problem has been solved!
Unlock 2 Answers and 17 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE