dottore11
05-19-2006, 01:57 AM
Ok, so I am starting this new game on my website, and it will be called Card Quest or something similar to that. Basically, they need to complete different objectives to earn cards to add to their online "collections". What I need is a script that will allow me to:
1. Manage and add new users to the system, and later add cards they have earned
2. Allows a way to display the users and which cards they have collected and which ones they haven't.
Here's the idea;
I'm a visitor and I want to view which cards "Susie" has collected. So I click her name in the userlist and up pops a window that has highlighted which cards they have collected out of the total number of cards. Clicking the name of the card or rolling over it shows the picture of the card.
-----------------------------------------------------
Right now I'm in the phase of the project where I am developing the admin panel that will let me add and edit the users/cards. I have completed the part that adds users and their respective cards to the database, but now I'm on the editing part.
I created a primitive update script just to test to make sure I could do it, and it worked, but:
My problem is that for example, if a user already has a card, I have to click the checkbox for that card anyways, or it will get submitted and turn the value for that row on that user to off. Does that make sense? I know now that it shouldn't be hard since there are only 2 cards, but once I get this going there are like 48 total.
So, you can see me having to click the checkboxes over and over could get old. SO.. I'm working on a script that will query the database and display checked or unchecked checkboxes on the update page so I can just remove or add the checkboxes I need and then hit submit.
Getuser.php - Asks user for the user they wish to edit and submits it to the next page
<form action="finduser.php" method="post">
Username: <input type="text" name="find_usernamec"><br>
<input type="submit"><br>
Finduser.php - Uses data from getuser.php and displays customized data in checkboxes based on whether their values in the table are on or not.
<?
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
mysql_select_db($database) or die( "Unable to select database");
$find_usernamec=$_POST['find_usernamec'];
$query="SELECT * FROM cardbase WHERE usernamec='$find_usernamec'";
$result="mysql_query($query)";
?>
<?php
if($dark == "on"){
?>
<input type="checkbox" name="ud_dark" checked="checked">
<?php }else{ ?>
<input type="checkbox" name="ud_dark">
<?php } ?>
Please note I've only done the script for Dark so far. The script is displaying an unchecked checkbox in places where it should be displaying a checked one. I have echoed some variables and the username is getting passed to the finduser.php page. Help please?
1. Manage and add new users to the system, and later add cards they have earned
2. Allows a way to display the users and which cards they have collected and which ones they haven't.
Here's the idea;
I'm a visitor and I want to view which cards "Susie" has collected. So I click her name in the userlist and up pops a window that has highlighted which cards they have collected out of the total number of cards. Clicking the name of the card or rolling over it shows the picture of the card.
-----------------------------------------------------
Right now I'm in the phase of the project where I am developing the admin panel that will let me add and edit the users/cards. I have completed the part that adds users and their respective cards to the database, but now I'm on the editing part.
I created a primitive update script just to test to make sure I could do it, and it worked, but:
My problem is that for example, if a user already has a card, I have to click the checkbox for that card anyways, or it will get submitted and turn the value for that row on that user to off. Does that make sense? I know now that it shouldn't be hard since there are only 2 cards, but once I get this going there are like 48 total.
So, you can see me having to click the checkboxes over and over could get old. SO.. I'm working on a script that will query the database and display checked or unchecked checkboxes on the update page so I can just remove or add the checkboxes I need and then hit submit.
Getuser.php - Asks user for the user they wish to edit and submits it to the next page
<form action="finduser.php" method="post">
Username: <input type="text" name="find_usernamec"><br>
<input type="submit"><br>
Finduser.php - Uses data from getuser.php and displays customized data in checkboxes based on whether their values in the table are on or not.
<?
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
mysql_select_db($database) or die( "Unable to select database");
$find_usernamec=$_POST['find_usernamec'];
$query="SELECT * FROM cardbase WHERE usernamec='$find_usernamec'";
$result="mysql_query($query)";
?>
<?php
if($dark == "on"){
?>
<input type="checkbox" name="ud_dark" checked="checked">
<?php }else{ ?>
<input type="checkbox" name="ud_dark">
<?php } ?>
Please note I've only done the script for Dark so far. The script is displaying an unchecked checkbox in places where it should be displaying a checked one. I have echoed some variables and the username is getting passed to the finduser.php page. Help please?