Author Topic: Database  (Read 1633 times)

TheQuirk

  • VIP
  • Member
  • ***
  • Posts: 2,154
  • Kudos: 315
Database
« on: 17 September 2002, 07:13 »
This is odd.

Why doesn't

Code: [Select]

echo the table? grr...

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Database
« Reply #1 on: 17 September 2002, 08:19 »
What *does* it output?  Have you done a View Source?  Can you point me to the link where this page is implemented?  Also you might want to throw in some "\n" (newlines) at the end (or where appropriate) in your "echo" statements, makes reading the source (View Source) much more readable. In the mean time I will look a little more closely at the code, don't see anything that jumps right out as being wrong.
Someone please remove this account. Thanks...

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Database
« Reply #2 on: 17 September 2002, 08:54 »
I just created a database and a table containing the fields you have listed in your code.  I entered a few rows, copied your code into a file and it runs just fine and displays the table.  Of course you are only pulling the "id" field so it only shows the "id" column but I assume you know this and aren't even getting that.  If you want to pull all fields and populate the entire table then you would want to change line 27 to:

Code: [Select]

[ September 16, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...

TheQuirk

  • VIP
  • Member
  • ***
  • Posts: 2,154
  • Kudos: 315
Database
« Reply #3 on: 17 September 2002, 21:36 »
yeah, I was in such a hurry I just wanted to see if it worked. And it didn't. Sigh.. Maybe I'll try again tommorow. Sleep now!

Calum

  • Global Moderator
  • Member
  • ***
  • Posts: 7,812
  • Kudos: 1000
    • Calum Carlyle's music
Database
« Reply #4 on: 17 September 2002, 15:16 »
for ref: it is found at http://members.lycos.co.uk/GAKbrUlkRle!/changed.html
in the test site for the upcoming fuckmicrosoft.com FAQ...

login details for the actual database and so on that is being used here can be got by sending a PM to one of the mods.

[ September 17, 2002: Message edited by: Calum ]

visit these websites and make yourself happy forever:
It's my music! | My music on MySpace | Integrational Polytheism

Calum

  • Global Moderator
  • Member
  • ***
  • Posts: 7,812
  • Kudos: 1000
    • Calum Carlyle's music
Database
« Reply #5 on: 17 September 2002, 15:56 »
might i add, and i am a novice, so slap my wrists if this is not it, but if you have a look at the database behind there, there's no tables in it except one called 'mysql_bookmarks' or similar.

presumably you need to create the relevant entries for it to work? i would have done this but as i say, i am a novice, and cannot pick out from that code what is a table, what is a field, et cetera...
visit these websites and make yourself happy forever:
It's my music! | My music on MySpace | Integrational Polytheism

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Database
« Reply #6 on: 17 September 2002, 19:15 »
Calum, I am guessing that Quirk is testing on a different machine which contains the appropriate database/table/rows and was having trouble getting the test code to work.  But yes, in order for the test code to work, several prerequisites need to be resolved.

According to the code that Quirk showed us I can tell you that there needs to be a MySQL server installed and running on the machine that the code is being executed on. There needs to be a MySQL database created called "faqfuckmicrosoft_uk_db", containing a table called "MES_FAQ" containing at least the following columns named: id, title, author, content, title, and date. In addition, a MySQL username and password must exist that matches the ID and password Quirk uses in the "mysql_connect()" function and that ID must have been granted at least "select" permissions to the database/table.

Now, since I have Apache/PHP/MySQL all installed on all of my machines I just created such a database/table/ID/permissions in MySQL on my laptop, then added a few rows of data to test with, copied his code into a *.php file on my laptop under my web root, set the ID/Password in the code to match what I created in my database and the code displayed the data in the table just fine. So his code is correct, I can't know if the database is set up right in his test environment but I assume it is.

[ September 17, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...

Calum

  • Global Moderator
  • Member
  • ***
  • Posts: 7,812
  • Kudos: 1000
    • Calum Carlyle's music
Database
« Reply #7 on: 17 September 2002, 19:29 »
well he uploaded his php script to that url i gave, so i assumed there would be no point in his doing so if he was testing it elsewhere since that's the faqfuckmicrosoft.com test website. For my own tinkering, if somebody doesn't beat me to it, i might try and setup a table such as you describe in the relevant location and see how it goes.
visit these websites and make yourself happy forever:
It's my music! | My music on MySpace | Integrational Polytheism

Gooseberry Clock

  • Member
  • **
  • Posts: 419
  • Kudos: 0
    • http://redrangersoftware.cjb.net/
Database
« Reply #8 on: 17 September 2002, 20:59 »
Try naming the file "index.php".

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Database
« Reply #9 on: 17 September 2002, 21:24 »
Good catch RRS, I didn't even notice the link Calum gave was *.html.  It is true you must have a *.php extension and is the very first thing that is wrong. Of course, it is also true that the database/table/colums/data/user/permissions must also exist.

And now that you have exposed the source through that html file you are going to want to immediately change the ID/Password you use in your MySQL database....

[ September 17, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...

Calum

  • Global Moderator
  • Member
  • ***
  • Posts: 7,812
  • Kudos: 1000
    • Calum Carlyle's music
Database
« Reply #10 on: 17 September 2002, 21:59 »
MoR changed it yesterday   ;)   but thank you for the debugs guys, maybe we can work it now...

edit - aha! not that i know what i am doing, but try http://members.lycos.co.uk/faqfuckmicrosoft/index2.php now!!
(sorry, but that's a big acheivement for me...)

[ September 17, 2002: Message edited by: Calum ]

visit these websites and make yourself happy forever:
It's my music! | My music on MySpace | Integrational Polytheism

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Database
« Reply #11 on: 17 September 2002, 22:12 »
That php link does show that the PHP code is now being executed.  Now you just have to get the database/tables etc created and throw some data into it.

I would suggest creating a FAQ entry page that would be used to populate the database, and an edit page that would allow you to change FAQ entries.  The "add" and "edit" and "delete" pages can actually be the same page using the same FORM fields but just change the role via passed parameters. You would use "insert" and "update" queries for this and of course FORMS in your HTML...  If you need examples or help with this I can whip up a very basic page that will work for your database and could be a starting point for you to refine/beautify.

Once you get the basic functionionality of select/insert/update/delete then you can refine the way you want to display the data and add search functionality (which is really very easy).

Of course you will not want the world to have the ability to add/edit/delete FAQ entries so you will want to also add authentication into those pages.  Does the server you have the database on allow "htaccess" authentication?  I would assume they do.  You can either use "htaccess/htpasswd" files to control access to the "editor" page(s) or you can write http authentication into your PHP scripts.  There are examples of this on php.net that should give you the basics for building authentication into your scripts:
http://www.php.net/manual/en/features.http-auth.php

[ September 17, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...

Calum

  • Global Moderator
  • Member
  • ***
  • Posts: 7,812
  • Kudos: 1000
    • Calum Carlyle's music
Database
« Reply #12 on: 18 September 2002, 00:16 »
created the table alright, but i think i will leave it to the quirk to write the php for now...
visit these websites and make yourself happy forever:
It's my music! | My music on MySpace | Integrational Polytheism

rtgwbmsr

  • VIP
  • Member
  • ***
  • Posts: 1,257
  • Kudos: 0
    • http://www.akgames.net
Database
« Reply #13 on: 18 September 2002, 00:42 »
On a similar note:
At 6-7 PM EST (11-12 PM GMT) I will switch to Linux for hopefully the last configuration, and stay put in Linux. I may need help, so stick around.
After I get SSH working, if anyone wants to log on to the server and help me it would be greatly appreciated.

[ September 17, 2002: Message edited by: The_Muffin_Man/B0b ]


TheQuirk

  • VIP
  • Member
  • ***
  • Posts: 2,154
  • Kudos: 315
Database
« Reply #14 on: 18 September 2002, 01:53 »
I uploaded it onto Lycos after it didn't work on my machine, then I had to go and didn't get to actually make hte database. I'll try now.

Edit: Doh, nevermind! Calum got it already!

[ September 17, 2002: Message edited by: TheQuirk ]