473,378 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Displaying SQL Table

Hello!

I have been working on an affiliate link system. A user would click a php link that would add 1 to the count of a certain affiliate, by ID and then return the user to that affiliate page.

My problem comes when I wish to display a table for my affiliates for them to see how many clicks they have and such.

Right now, here is my code for the table :

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.   echo "<table border=1 cellpadding=0 cellspacing=3><tr><td align=center>Affiliate ID Number</td><td align=center>Name</td><td align=center>Number of Clicks</td><td align=center>Payment</td><td align=center>Comments</td></tr>";
  4.  
  5.   for ($i=0; $i<$num; $i++) {
  6.       if ($tmp = mysql_fetch_array($result)) {
  7.           extract($tmp);
  8.  
  9.           echo "<tr><td align=center>$id</td>";
  10.           echo "<td align=center>$name</td>";
  11.           echo "<td align=center>$count</td>";
  12.           echo "<td align=center>$paid</td>";
  13.           echo "<td align=center>$comments</td></tr>";
  14.       }
  15.   }
  16.  
  17.   echo "</table>";
  18.  
  19. ?>
  20.  
For some reason this isn't working with my page.

Does anyone have a simpler way of doing this?
Mar 15 '08 #1
3 1027
ronverdonk
4,258 Expert 4TB
Whatever happened to the code leading up to the $result? Maybe the error is in your select, so it won't display anything. Show that code leading to the $result resource id.

Ronald
Mar 16 '08 #2
okay...here is something like what the entire page would look like:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. include ('header.php');
  4.  
  5.  
  6.   mysql_connect("localhost", "username", "P*A*S*S*W*O*R*D");
  7.   @mysql_select_db("my database") or die( "Unable to connect to database");
  8.   $result = mysql_query("SELECT * FROM linkcount");
  9.  
  10.   $num = mysql_num_rows($result);
  11.  
  12.   mysql_close();
  13.  
  14. include ('table.php');
  15.  
  16. ?>
  17.  
The table.php then would be my previous post.
Mar 16 '08 #3
ak1dnar
1,584 Expert 1GB
Hi pal, just put your mysql_close() function end of the page.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include ('table.php'); 
  3. mysql_close(); 
  4. ?>
  5.  
Mar 16 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Waguih Boctor | last post by:
Hi, I have a number of ASP pages where some JPGs and GIFs are displaying in the browser and some are not. I have included an excerpt from the HTML below. In this example, the gif file at the...
1
by: Mark ??;-\) | last post by:
I would like to display a listing of files on a web page as follows: If there is only one file: display the section name and then display the current file. If there is more than one file (for...
13
by: Aladdin | last post by:
I have an MS Access form on which I have a listbox listing tables in that database. I want to be able to click on any of those tables and view its contents on the same form using subforms or any...
5
by: Robert | last post by:
Hello Accessors I have some reports created in Access that are very good for what they do. However, it seems to me that when you are displaying information you don't need to print out that a...
3
by: Lyn | last post by:
I need some guidance for a technique that will allow me to accomplish the following... I have a table in which each record contains a photograph. I would like to display in a form a thumbnail...
2
by: VM | last post by:
When I display data to a Windows datagrid I usually fill the underlying table (in another class) and then, once it contains all the data, I attach it to the grid. But there are some processes that...
2
by: Fedor G via DotNetMonster.com | last post by:
Pls help me manage the data displaying on the webform aspx c# page. I used Dreamweaver to manage data displaying in the repeat table, ie simply dragged the fields to the table cells, where I need...
0
by: latin & geek via DotNetMonster.com | last post by:
hi! ok, im working on a database application. ive successfully managed to establish a relationship between two tables and display them on a datagrid, edit and add new records to them. now i...
9
by: Cogito | last post by:
My program builds several tables using inner HTML. All the tables are displayed only when the program terminates. How can I make it display one table at a time and then wait for a click before...
4
by: Bob | last post by:
Hi All, Was wondering if in C# there is an elegant way of displaying and or calculating fractions. The case: we have an app that measures/slices dices etc and all our internal measures and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.