Solved

Take info from a database and display it

Posted on 2011-03-15
3
269 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
  • 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now