Solved

Take info from a database and display it

Posted on 2011-03-15
3
272 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 SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

828 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