Couple of PHP /mySQL related questions.

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

I'm thinking that the answers should be fairly simple, but I've used perl a bit for cgi stuff and VB for asp stuff, but I've never had any experience with php until I installed the phpbb for a sports place that a friend and I are currently developing.

The Background:
We have a php board established. We ran three separate sports pools, one for NFL, one for March Madness, and one for NHL playoffs at a different site over the last year or two. We're combining all this for a variety of reasons and so far so good. Here's the link for the sports fans out there: http://www.imagesculptor.com/pool/index.php. We are still in the development stage, so the default board at the moment is still the subSilver theme, although I had a great time creating 3 new sports board skins for members this last week. OK - that should give you a feel for what we're doing.

The Need:
We want to automate the three pools. I've found a php thing for the Football and another for March Madness and a Java one for Hockey. Got 'em from open source at SourceForge. I'm working with the Football one first since that's rapidly approaching.

Issues:
1.The install instructions give a basic setup for the database. That part is sort of OK, more-or-less. The problems that I'd like to overcome are that it obviously is looking to use it's own database. That's not too much of an issue because I can do that, but the way the domain owner's (my co-partner in this) domain works is that you only get one database per domain. OK - he's got a second domain. That solves that. However, now all our forum members will have to register a handle to play the sports pools. I'm sure there is a way to get it to use the forumdata database for phpBB, but haven't the foggiest idea where to start to learn how.

2.The instructions say that the scripts require Apache, PHP 4 and mySQL
We're OK on 1 and 3, but they are using PHP 3.2 on the server. Will a script written for PHP4 even work with PHP 3.2? i.e. am I wasting my time considering it?

3.I'm sure this part has to be somewhat simple, and I promise, I am working through some tutes and making an attempt to begin my education on php. First it would be helpful if I showed you the basic instructions.

Quote:
This document assumes the following:
You have apache configured with PHP 4.x
You know how to use mysql

1. Create the database
mysqladmin create football
2. Create the database tables
mysql football < create.sql
3. In mysql, create the football user who has access to the football database
then edit db.php to reflect those values.
4. Login to the system with username: xxxx and password: xxxx
5. Have fun.


OK - steps 1,2 and 3 I think I got. Although I don't have access to do it the way he stated it, I can set up the database and authorized user via the admin panel at the domain. OK so I create a database = football as instructed. Let's say for example that the user name= user and the password= temp

OK, here's the db.php file they said to edit:

Code: [ Select ]
<?

    $link = mysql_connect ("localhost","root","password");
    mysql_select_db("goalpost");
    #echo mysql_errno() . ": " . mysql_error(). "\n";
    $cookiename="football4";
?>
  1. <?
  2.     $link = mysql_connect ("localhost","root","password");
  3.     mysql_select_db("goalpost");
  4.     #echo mysql_errno() . ": " . mysql_error(). "\n";
  5.     $cookiename="football4";
  6. ?>


My question is how would I add the User Name and Password for the user I set up on the database? I think that's all I need to get this rolling so I can see if it works and if I even want to use it.

Summary:
If anyone has a resource or a solution of how to get a php script to use the phpBB database, or can point me in some kind of direction, I'd appreciate it.

Or even better - if anyone knows of any existing php Sports Pool scripts that can incorporate the phpBB database, I'd love to know about them. (And, yes, I did check phpBBhacks, but didn't see any there)

Thanks guys and gals!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Original:
Code: [ Select ]
<?

  $link = mysql_connect ("localhost","root","password");
  mysql_select_db("goalpost");
  #echo mysql_errno() . ": " . mysql_error(). "\n";
  $cookiename="football4";
?>
  1. <?
  2.   $link = mysql_connect ("localhost","root","password");
  3.   mysql_select_db("goalpost");
  4.   #echo mysql_errno() . ": " . mysql_error(). "\n";
  5.   $cookiename="football4";
  6. ?>


Edited:
Code: [ Select ]
<?

  $link = mysql_connect ("localhost","user","temp");
  mysql_select_db("football");
  #echo mysql_errno() . ": " . mysql_error(). "\n";
  $cookiename="football4";
?>

I'll let you know if it works.
  1. <?
  2.   $link = mysql_connect ("localhost","user","temp");
  3.   mysql_select_db("football");
  4.   #echo mysql_errno() . ": " . mysql_error(). "\n";
  5.   $cookiename="football4";
  6. ?>
  7. I'll let you know if it works.

In thinking about it, let me rephrase one of my questions. If I plug in the values for the existing phpBB database, will it use the user login info from the phpBB board, or will it create and use it's own tables for user info?
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago


Chances are it requires that the users loging using their database info. You can however keep it all on one database just where it says:
Code: [ Select ]
  mysql_select_db("goalpost");

change "goalpost" to "phpbbdatabasename");

I am sure there is a lengthy way to incorporate the user table from phpbb to allow for the polls...
Depending whats in the script it could work fine in php3.2, you cant loose anything for trying, it'll just give you a syntax error.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

I have had multiple errors trying to install it. It seems to partially work, but it appears the PHP4 has a play in it. I also tried another PHP script for sportsphools from SourceForge and got similar results. Both required PHP4. (Since it's not my domain I'm trying to work with, I've passed the upgrade info on to my partner so he can talk to the sys admins.)

Anyway, gave up on that and tried an ASP one on my own domain and just couldn't for the life of me get the DSN-less connection to work right. *sighs - you have no idea how much research I've done on this today. About 8 hours straight and still no further than when I started! It's OK, though -- it's how I learn the best.

Keeping my fingers crossed - I found an original release of the one I was asking about in my post which I think may be an earlier version of PHP. Not sure - there's no documentation with this release, but most of the files look the same. I'm waiting for my partner to close his domain connection so I can modify the database. We'll see.

My limitations are I have to work with PHP3.2 or lower. If I use ASP I can do that on my own domain, but I don't have SQL so I have to work with an Access database.

I hate being a newbie at these languages, but hey! That's how I've learned everything else I know about design. Completely self taught on all this stuff and learn multiple new things every day!

Thanks for your input.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9089
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Yeah usually if it requires PHP4 then anything lower may have problems as it wont recognize certain built in functions, and other new things. You ought to recommend to your friend to move to a host that keeps up with the latest things.

ATNO/TW wrote:
1.The install instructions give a basic setup for the database. That part is sort of OK, more-or-less. The problems that I'd like to overcome are that it obviously is looking to use it's own database. That's not too much of an issue because I can do that, but the way the domain owner's (my co-partner in this) domain works is that you only get one database per domain. OK - he's got a second domain. That solves that. However, now all our forum members will have to register a handle to play the sports pools. I'm sure there is a way to get it to use the forumdata database for phpBB, but haven't the foggiest idea where to start to learn how.


Even though one of his domains might only have one database, you can create numerous tables under that database. What I recommend would be to simply create a table with the name of the other domain. And then install PHPBB for that other domain under that new table. That would allow you to keep things seperate from the other site.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

I do somewhat, but Domain 1 already has the Sports board and the phpBB database installed. Domain 2 is flexible as I'm only experimenting with these scripts at the moment, so I can create delete and name a database anything I want to.

In both cases each domain is only allowed 1 database. Considering the time I've put in to creating board skins and the fact that we do already have a few of our oldest and regular players logged in and registered, I don't particularly want to change the forum database. I semi-sorta understand the table part, but in the admin panel that I can change things, all I seem to be able to do is add or delete a database and add or remove users.

In regards to the upgrade -- that may happen - we'll see. But I'm going, for the moment, on the assumption that I'm stuck with the version I'm using.

I'll work on seeing if there's a way to create the sub-tables you refered to, but my ultimate goal would be for the "players" to register at our sports board and not have to re-register for the pools. In other words, I'd like to find a pool script that is compatable with phpBB database for user info. (I'm guessing I'll have to learn enough to write that one myself! *lol)

I did find phpmytourney, but I don't think that fits our needs...I'm still playing with that one.

Thanks for your assistance.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Thanks for all the help, but after a almost a week of trying to find existing scripts that would work (and didn't), I decided to take the plunge and learn php and do this one on my own. I have a deadline of Sept. 4th for the 2003 NFL season - I think I can do it. I have a good bit more time to work on hockey and March Madness.

My primary goal is to make it fully compatable with the phpBB database and intigrate it with the phpBB boards. At the moment, I'm just trying to script it for our needs. I'll think about a stand alone version later.

My initial intent is to make the script Open Source - then later if I do a stand alone perhaps sell that one so I can get some money back for the time investment.

Thanks for all the help. If anyone who's well-versed with php would be interested in helping me tackle this project, I can be reached at the email in my profile.

Mods, if you'd like, feel welcome to lock this thread since I'm done with it.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9089
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Just wanted to clarify that when you have a "database" for a domain, its basically just a table that can have tons of tables under it.

So you could create a table under that domains database for your other domain, and then install phpbb under that table (or sub database if you want to call it).

You can think of it this way. Lets say you have a website at geocities.com. They will basically give you a free directory for one site. However you could really create numerous subdirectories which are all actually different sites under that one directory. This idea is the same for your MySQL database. Your host basically gave you one root database for the domain (or really just another table under the root). Now within your database or table you could create multiple tables. If you chose to install PHPBB directly under this database (or table), you would see that it in fact makes numerous tables. As long as your host doesn't restrict you to how many tables you can make you should be able to install PHPBB multiple times, which could be for more than one domain. Just make sure you install PHPBB in different tables within your database so they do not clash. Here is an example:

Root
--yourdomain.com database
----phpbb_auth_access
----phpbb_banlist
----phpbb_categories
----phpbb_config
----phpbb_disallow
----phpbb_forum_prune
----phpbb_forums
----phpbb_groups
----phpbb_posts
----phpbb_posts_text
----phpbb_privmsgs
----phpbb_privmsgs_text
----phpbb_ranks
----phpbb_read_history
----phpbb_search_results
----phpbb_search_wordlist
----phpbb_search_wordmatch
----phpbb_sessions
----phpbb_smilies
----phpbb_themes
----phpbb_themes_name
----phpbb_topics
----phpbb_topics_watch
----phpbb_user_group
----phpbb_users
----phpbb_vote_desc
----phpbb_vote_results
----phpbb_vote_voters
----phpbb_words
----anotherdomain.com table (or database)
--------phpbb_auth_access
--------phpbb_banlist
--------phpbb_categories
--------phpbb_config
--------phpbb_disallow
--------phpbb_forum_prune
--------phpbb_forums
--------phpbb_groups
--------phpbb_posts
--------phpbb_posts_text
--------phpbb_privmsgs
--------phpbb_privmsgs_text
--------phpbb_ranks
--------phpbb_read_history
--------phpbb_search_results
--------phpbb_search_wordlist
--------phpbb_search_wordmatch
--------phpbb_sessions
--------phpbb_smilies
--------phpbb_themes
--------phpbb_themes_name
--------phpbb_topics
--------phpbb_topics_watch
--------phpbb_user_group
--------phpbb_users
--------phpbb_vote_desc
--------phpbb_vote_results
--------phpbb_vote_voters
--------phpbb_words

Hope that clears a little bit up.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

I have never worked with data bases much and I'm working hard to get this one to work in the current params. I'll get it though by my imposed deadline.
Thanks much though for the tips.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Kinda exciting for me, really. I know it's simple and I'm just a novice at this, but this morning at about 5AM I discovered myPHPAdmin.

It had always been a concern when I took this on how I was going to see and manipulate the database. Now I know how. (In fact, I already know PHP better than I know Spanish and it took me a year to try to do that! - I've only speant about 18 hours on this so far!)

Anyway, I created my first two phpBB compatable pages. The second one was my first ever manipulation of a database. Here they are if you're interested in a look-see (I think you should be able to view them as a guest - they worked for me, at least):

http://www.imagesculptor.com/pool/NFL_index.php
http://www.imagesculptor.com/pool/NFL_players.php

God!, there's so many variables in this script it's hard to keep them all straight!

Currently, I've only figured out how to incorporate this in subsilver. I have three other sports board themes available for registered folk. I'll have to work on that later!

On to creating my first table! Thanks for the help guys. Now I can say, I'm excited vs. frustrated.

P.S. - Bigwebmaster - now I see what you mean about that database structure post you did above. Thanks. That helped.

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: No registered users and 179 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.