Solved

Take info from a database and display it

Posted on 2011-03-15
3
273 Views
Last Modified: 2012-05-11
Hi,

I have some fields in a database that I want to pull, and depending on the value, I want to display certain lines of code.

What is not shown because it is in the CSS file:
If the system is online, an online image will display
If the system is offline, an offline image will display
If the system is in maintenence, an exclamation image will display.

Can you please edit my file to make it workable?

Thanks
status-demo.php
0
Comment
Question by:Computer Guy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 20

Expert Comment

by:Mark Brady
ID: 35142096
I assume that $table = ""; is only there because you did not want to post the table name? Else your query won't work because $table is empty. The first thing I see is
if($num > 0){
    $row = mysql_fetch_array($result) or die("error");
}

Should be getting all the values you need and put them into variables like this:

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$fname = "{$row['fname']}";
$lname = "{$row['lname']}";
$pacts = "{$row['pacts']}";
}
// change the values to suit the data you are looking for. What is your code doing? Are you getting some error?
0
 
LVL 3

Author Comment

by:Computer Guy
ID: 35143273
Please see the attached code:

The notes and version fields populate, but the rest don't.

Also I'm getting PHP Notice: Undefined variable: shopping_cart on lines 115 & 122

Any ideas?
status-demo2.php
0
 
LVL 20

Accepted Solution

by:
Mark Brady earned 500 total points
ID: 35143656
Ok do a quick test and echo the posted values back so you can see if they are empty which it sounds like they are.

Can you also post the actual form that the user fills out to send to this page? I would like both the form and the processing script so I can try and duplicate your pages and test them on my local server. We will get it working properly. Also, try give me some sample data from your mysql or even better, can you export the mysql database or just the table that you have your data in so I can set it up to test it. Thanks
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn how to dynamically set the form action using jQuery.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question