Solved

Take info from a database and display it

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Creating and Managing Databases with phpMyAdmin in cPanel.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

863 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

24 Experts available now in Live!

Get 1:1 Help Now