If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

PHP Retrieve data from DB Table

I'd like to retrieve player results from a table in my vbulletin database table called _vbullthread. The results would ultimately print to the players own page.

I'm using this script (below) to retrieve the info but the script breaks after I try to run it. There is only one field in the table which has the info the script needs. It is the "Title" field. All values in said field within the database are entered like this....... Bob Smith vs John Doe May 2, 2001 Sports team vs Sports team

Beyond that, there are several issues that you would do well to address:

# If at all possible, you should avoid using the mysql_* functions. #ext/mysql is outdated and scheduled for deprecation.
It is no longer recommended for new projects, and existing code should be updated to avoid performance and security problems.
Using ext/mysqli or the PDO class is recommended.
Read more about choosing an API on php.net..

I don't know if that's your real username/password or not, but if it is, you should obfuscate it..

In your question, you say you want to select the Title column from the database.

In your code, you attempt to select the name_Bob and name_smith columns.

Subsequently, you attempt to use the name_first and name_last columns (which, obviously, would not exist) from your query result.

Could you please clarify, specifically, what you want to accomplish? Make sure you post the code that is relevant to your problem.

When I add specific players video's to my video portal. I would like to make custom pages with the players statistics, (outside of the video portal) and have only their video's automatically retrieve from the same table the videos live on.

I would like the data parsed from the table to be retrieved by player name.

There are a lot of other things to consider - it's not impossibly complex, but there are many things involved. You need to do a lot of planning so you know how everything will work together. If, as you said above, you're not very familiar with programming, you would definitely need to learn before you attempted something like this.

I'm not actually looking to be as detailed as your second reference. All I want is for whoever I make a customized page for, ie. "Bob Smith". Just for his fights to populate in certain order. Just as long as they populate on his custom page. every time one of his fights are added in the video portal. The video portal is a script I bought, and it's ioncubed. So there's no way for me to alter how data is entered when a new video is added.

not actually looking to be as detailed as your second reference. All I want is for whoever I make a customized page for, ie. "Bob Smith". Just for his fights to populate in certain order. Just as long as they populate on his custom page...

It's not a matter of being "detailed" or having "fancy" features: properly organizing the data (as in my second example) makes it possible to reliably search for & find the correct records:

Code:

SELECT whatever FROM the_table WHERE the_field = 'Bob Smith'

However, if all the data is lumped together in one field, you can't do that. You'd have to do

Code:

SELECT whatever FROM the_table
WHERE the_field = 'Bob Smith' #maybe just the name?
OR the_field LIKE 'Bob Smith%' #maybe the name at the beginning?
OR the_field LIKE '%Bob Smith' #maybe the name at the end?
OR the_field LIKE '%Bob Smith%' #maybe the name in the middle?

...and even then, there might be conditions where the search would still fail (or return bad results).

Originally Posted by igotregistered

...Yes in fact the data is stored exactly as your reference...

What does the rest of the table look like? How are the videos actually stored/found? You might be able to create a work-around (or parse and reorganize the data into something usable), but that would be less reliable (maybe not possible at all).

Setting aside the "portal script," you need to know both a) what information you need, as well as b) what information is available to you, before you can start this project. Then, you can start working out how to approach your goal. Right now, you have nowhere to start from. You're in for a big learning experience.

**********
p.s.

Originally Posted by igotregistered

The video portal is a script I bought, and it's ioncubed.

My sincere advice is to stay away from scripts that are "encrypted." Transparency is a sign of a good program. The more time an author spends on obfuscation, the less time they're spending on making the script good. (The simple fact that the script stores its data in one big lump in the DB makes me question its quality.) Obfuscation also adds another layer of complexity, is another source of bugs or instability, slows program execution down, and just generally looks "shady." Don't fool yourself: they are not trying to "protect their hard work." They are trying to lock you into returning to them (and paying again!) every time you want something changed or need something fixed.

Hmmm, some interesting info there traq. Maybe I shouldn't venture off into using a script then.

So it appears my only option is to manually code each players video, on their own page? I was hoping I could automate it someway so that I didn't have to manually add each fight every time they have one. If you have any other suggestions to some how automate the process, I'm willing to try.

Well, I'm certainly not trying to "scare you away" from the idea - I was sincere in saying that it would be a learning experience (A Good Thing), and that I'd be happy to help you along the way. I'm just trying to help you understand that it's more complex than it might appear, and that you may need to do more preparatory work than you imagined (including a fair amount of "basics" with PHP and MySQL).

So far, we need more info about how the videos, and the information about them, are stored. And your original question (about the error message) has gotten sidetracked. Let me know what you'd like to do!