close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

MySQL Display Help?

Thread began 12/13/2014 4:22 am by anonymous | Last modified 12/15/2014 9:50 am by Jason Byrnes | 597 views | 1 replies |

anonymous

MySQL Display Help?

Hello there. I'm sure this has been asked many times before, but I wasn't able to find either on php.net or on these forums a way to solve my issue. I'm extremely new to PHP so it's all rather difficult to grasp but I'm inching along there. I'm trying to help out a friend with a problem he's having. What he needs is what I thought would be a fairly simple setup (but is turning out to be much more difficult than I expected!)

Needs to be able to have several moderators input data about banned users into a form. (Managed to get that done.)
Needs to be able to have certain fields of that data displayed in a specific way. Example: Grab a command from the MySQL Database, Grab the userID of the banned player, and grab the length of the ban from the database and display them in a single line, single spaced list (Eg. "ban 123456 1 week") (Managed to get this mostly done. For some reason it inserts an extra space so I get ban.123456..1 week (Periods would be where the spaces are.) But it's good enough to work.

Now sometimes the mods may not be able to get the userID. (People hacking, cheating the system, whatever). So they could only put in say the username and how long the ban is. So you'd get username.<Whitespace>..1 week. Which would mess with his being able to easily and smoothly grab those fields and input them into the server.

What I need some help figuring out how to show ONLY those values in the database which have a given field. (In this example, the userID).
I need to be able to change that value easily as well so that I can make another list with ONLY those values which have no userID and display only their in-gameID and username.
Then I also need to be able to display another list that only shows those users without either of the other options. (When the mods are unable to grab anything but the username itself.)

So we have the Username field. The gameID field and the userID field.
I hope this makes sense. I'm pretty brain fried after working on this for the past 20 hours straight. I've included the php file I am currently working with. This would be for the page that only shows the command, the userID and the length of time to ban. In one of my fields, this is what happens:

Cmd User ID Ban Length
ban 76561198163602169 100 years
ban 12561898132299268 100 years
ban 12561398165156458 100 years
ban 12561498163281945 100 years
ban 100 years

As you can see, the one on the bottom does not have a userID and thus will get in the way of making this list easily copy-pastable into our system.

Any help is greatly appreciated!

Attached Files
ban-show2.php
Sign in to reply to this post

Jason ByrnesWebAssist

For this you would need to use a where clause in the recordset. More details on the SQL Where clause can be found here:
http://www.w3schools.com/sql/sql_where.asp

SELECT FROM table name WHERE UserID <> ""

would be a where clause to return records if the User ID column in the table is NOT EQUAL to a blank value

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...