The KGB Oracle
Serving the online gaming community since 1997
Visit www.the-kgb.com
For additional information

Join KGB DISCORD: http://discord.gg/KGB
 
KGB Information
Untitled 1

Visit KGB HQ
www.the-kgb.com

Who's Online Now
0 members (), 86 guests, and 2 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Today's Birthdays
There are no members with birthdays on this day.
Newest Members
Luckystrikes, Shingen, BillNyeCommieSpy, Lamp, AllenGlines
1,477 Registered Users
Forum Statistics
Forums53
Topics13,097
Posts116,365
Members1,477
Most Online276
Aug 3rd, 2023
Top Likes Received (30 Days)
None yet
Top Posters(30 Days)
Sini 1
Popular Topics(Views)
2,192,273 Trump card
1,368,766 Picture Thread
497,400 Romney
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 4 1 2 3 4
Joined: Sep 2008
Posts: 102
Ithkrul Offline OP
KGB Champion
*****
OP Offline
KGB Champion
*****
Joined: Sep 2008
Posts: 102
Ok guys I have been working on my first database project. Just have a question. I have successfully created the tables and uploaded the contents from my forms into the tables and can view the contents in those tables successfully on the serverside.

I am having trouble finding what I need to do in order to display the contents of said tables in a webpage.

Joined: Feb 2006
Posts: 3,323
Likes: 2
(G6) KGB Warlord
KGB Federal Faction
****
Offline
(G6) KGB Warlord
KGB Federal Faction
****
Joined: Feb 2006
Posts: 3,323
Likes: 2
macro more!


[Linked Image from nodiatis.com]
Joined: Nov 2005
Posts: 1,876
Likes: 10
KGB Supreme Court Justice
KGB Supreme Knight
****
Offline
KGB Supreme Court Justice
KGB Supreme Knight
****
Joined: Nov 2005
Posts: 1,876
Likes: 10
What programming language can you use ?
Python, PhP, JAVA, Ruby, C#, any other thing ?


[Linked Image from w3.the-kgb.com][Linked Image from w3.the-kgb.com]
Joined: Mar 2009
Posts: 487
Kay Offline
KGB Alumni
***
Offline
KGB Alumni
***
Joined: Mar 2009
Posts: 487
What data from the tables specifically are you trying to pull? You need to specify your query. For instance, trying to display username column from the users table,




In Hoc Signo Vinces
Joined: Apr 2009
Posts: 68
KGB Champion
*****
Offline
KGB Champion
*****
Joined: Apr 2009
Posts: 68
Quote:
Pretty sure the poor guy is using php..

(Just to display the data in a table or so)
The basics that you are going to want to do is:
1. initialize a mysql connection
2. perform said query
3. Mock up html while looping thru the resultset
4. close connection

http://dev.mysql.com/tech-resources/articles/ddws/23.html


Now in order to make this editable it requires a little more.. You need to use some sort of id column to pass during your post in order to determine which row the user selected(also you will need to use an edit link that's embedded with an id in the querystring or some other form data embedded in your grid/table). You are better off finding a working example due to the amount of code this is going to require. In C# they have made this all much easier and not so rudimentary. The thing about programming is...there is always a hundred different ways to do something as well....


This.

Last edited by Dunlop_Phaete; 06/24/09 03:31 PM.
Joined: Jan 2009
Posts: 5,070
Likes: 6
KGB (F4) Chancellor
Crowfall Faction
***
Offline
KGB (F4) Chancellor
Crowfall Faction
***
Joined: Jan 2009
Posts: 5,070
Likes: 6
MMMmmmm...

Visual Studios and C# & VB.net with a sql backend.

I can taste your tears.

I watched many a geek get destroyed by the year long project that built upon every weeks modules.

Ahhhh memories of CIS 321, 322, 323


Don't make me have'ta Troll ya Bro!
Joined: Oct 2006
Posts: 1,720
Band 7
**
Offline
Band 7
**
Joined: Oct 2006
Posts: 1,720
Using C# / VB.NET backend isn't too terribly bad really. I mean, once the data connections are setup and you pull using cans it isn't horrible.


Former KGB Member
Joined: Sep 2008
Posts: 102
Ithkrul Offline OP
KGB Champion
*****
OP Offline
KGB Champion
*****
Joined: Sep 2008
Posts: 102
Hey guys its all been in PHP. As whole my db is solid and my upload is solid and running very smooth and the tables are all filling properly and recognizing primary keys etc.

Its basically a registration process for my college events. Now the problem I am having is that when I try to "dynamically" create a new webpage with the contents of the database is it only returning the first result in the database.

When I try to apply a loop I am not getting any of my debugging echos, not for my db connection or upload confirmation.

Feel free to take a look at the page, I dont host it, my annoying professor does.

http://ccis004.uncc.edu/~chaconia/final2.htm
http://ccis004.uncc.edu/~chaconia/home.php

I removed my attempt to recreate all the contents to the tables.
both uncc id and phone numbers are primary keys. Doesnt post anything now.

Joined: Nov 2005
Posts: 586
KGB (F3) Vice-Chancellor
Crowfall Faction
*****
Offline
KGB (F3) Vice-Chancellor
Crowfall Faction
*****
Joined: Nov 2005
Posts: 586
Post your source code ... specifically the query & function which gets the data & then attempts to loop through the rows.

That is a pretty straight forward exercise, whether it is in php, c#, vb or whatever.

You are either looping properly & only return a single row ... meaning your query is incorrect, or your loop is not moving through the records properly.


[Linked Image from w3.the-kgb.com][Linked Image from w3.the-kgb.com][Linked Image from w3.the-kgb.com]
Joined: Nov 2005
Posts: 121
KGB Knight
*****
Offline
KGB Knight
*****
Joined: Nov 2005
Posts: 121
As Longshanks said above, you need to query the Db. This would be something along these lines:

SELECT ProductId, ProductName, ProductDescription
FROM Products

Use PHP to execute the query and you get a recordset, that is actually very much like the DB table, but only with the columns (ProductId, ProductName, ProductDescription) you specified in the SELECT clause.

When you have the records set, you loop through it. Sortof like this (i don't know PHP too well, so it will be pseudo code):

string query = "SELECT ProductId... " // see the query above
Recordset products = database.Execute(query)

write ("<table>")
foreach (product in products)
{

write ("<tr>")
write ("<td>" + product.ProductId + "</td>")
write ("<td>" + product.ProductName + "</td>")
write ("<td>" + product.ProductDescription + "</td>")
write ("</tr>")
}
write ("</table>")

This will display a html table with all the products in it. Change thje query (dynamically through PHP) to change what is displayed.

You probably know most of this, but I just wanted to give a comprihensive example (i hope).

Show me the you code, and I will be more specific ;-)

Hope this helps.


Kind regards
AllYourBase AreBelongToUs / Borne OfFire

------------
Dude: "My thief BS for 800 dmg! Omfg, omfg, lawl, noobzorz"
AYB (drunk): "Do people take damage from being bullshitted? WTF???"
Page 1 of 4 1 2 3 4

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5