Solved

Take info from a database and display it

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
google map tracking website 5 22
Slow MySQL (InnoDB) Query with Inner Join & GroupBy 7 42
How to position loader with CSS 3 36
css selector 1 16
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

786 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