Jump to content

Greaser9780

Members
  • Posts

    326
  • Joined

  • Last visited

    Never

Everything posted by Greaser9780

  1. I had Clan_id set with int and the primary function with auto-increment I tried changing it to the unique function with auto increment and changing clan_name row by making it the primary but it didn't seem to do anything
  2. Not sure on that I used phpmyadmin to configure it. Clan_id is auto increment. Should I make clan_name auto?
  3. Also could it be a prob that we are using '$clan_name' as what to get from the db but it is also the variable set for $_POST['clan_name'] ?
  4. Now the page just turns white completely and no text.Syntax error? Fixed the above. Now it's letting me add the clan name that is already registered again. If I set the row to be unique in the db while having 2 of the same name already present I get the exact same error in my phpmyadmin page. So I am thinking that my script is disregarding the clan_name precheck and trying to write it to the db anyway.
  5. I also tried deleting the unique in my clan_name row in the db. If I do that it just continues letting you register the same name.
  6. So, you want the correct movie to play after it is called by the mysql_query? And you want that code inserted into your player info that you showed last post? Right?
  7. Here is the entire code for this script: <?php session_start(); $dbhost = '----'; $dbusername = '----'; $dbpasswd = '----'; $database_name = '----'; #under here, don't touch! $connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd") or die ("Couldn't connect to server."); $db = mysql_select_db("$database_name", $connection) or die("Couldn't select database."); array_pop($_POST); if ( get_magic_quotes_gpc() ) { $_POST= array_map('stripslashes', $_POST); } $clan_name = mysql_real_escape_string(trim($_POST['clan_name'])); $logo = mysql_real_escape_string(trim($_POST['logo'])); $message = mysql_real_escape_string(trim($_POST['message'])); $email = mysql_real_escape_string(trim($_POST['email'])); $aim = mysql_real_escape_string(trim($_POST['aim'])); $yahoo = mysql_real_escape_string(trim($_POST['yahoo'])); $msn = mysql_real_escape_string(trim($_POST['msn'])); if ((!$clan_name)){ $message = "info"; if (!$clan_name) { $error = "clan_name"; echo 'b'; include('bhdsingle_join_form.html'); exit; } $sql = "SELECT clan_name FROM bhdsingle WHERE clan_name='$clan_name' "; $result= mysql_query($sql, $connection) or die(mysql_error()); if (mysql_num_rows($result) > 0 ) { echo 'Sorry, that clan name is already registered here at PST. Please choose another clan name.'; } include('bhdsingle_join_form.html'); exit; } $sql = mysql_query("INSERT INTO bhdsingle (clan_name, logo, message, email, aim, yahoo, msn, signup_date) VALUES('$clan_name', '$logo', '$message', '$email', '$aim', '$yahoo', '$msn', now())") or die (mysql_error()); $clan_id = mysql_insert_id(); echo 'Congratulations on registering your new clan for the BHD Singles Ladder!'; ?>
  8. Try this to get the info: $sql = "SELECT someField from yourtable"; $result = mysql_query($sql, $conn) or die(mysql_error()); That will pull the info from your db. I still need to know what you want to do with the info after it gets pulled from the db. (Just displaying it on the page, sending it somewhere, making a link from the info,?)
  9. Oh my bad I thought you wanted to write it to the db. You can still use a mysql_query to call the information to your php script.
  10. Maybe it's because I'm a noob. But it doesn't appear that any of your variables are registered. Such as $mainframe. Is the bottom part supposed to send the youtube info to your db? If so, I would approach it completely differently. Maybe something like: $sql = "INSERT INTO your table (place, table, rows, you, want, here) VALUES ($place, $table, $values, $you, $want, $here)"; $result = mysql_query($sql, $connection) or die(mysql_error()); of course to add this part you will need to include your database connection at the beginning of your script. Let me know if this is helpful at all.
  11. I am a noobie myself but this is semi-similar to a recent prob I have had gimme a couple mins to think bout it. Could you post the code you have for this so far. I hope it is more than that lil bit U posted earlier.
  12. Now it states the following: Duplicate entry 'the name I am using' for key 2 but it's not displaying my echo or restting the form.
  13. I have mysql select a name from the db. Then I compare it to the $_POST name. If they match it is supposed to alert the user of this then redirect them to the join form again. The problem is no matter how many times the name is in the db it keeps allowing it to be re-registered again. Here is that section of code: $sql = "SELECT clan_name FROM bhdsingle "; $result= mysql_query($sql, $connection) or die(mysql_error()); if ($result = $clan_name ) { echo 'Sorry, that clan name is already registered here at PST. Please choose another clan name.'; } include('bhdsingle_join_form.html'); exit; } $sql = mysql_query("INSERT INTO bhdsingle (clan_name, logo, message, email, aim, yahoo, msn, signup_date) VALUES('$clan_name', '$logo', '$message', '$email', '$aim', '$yahoo', '$msn', now())") or die (mysql_error()); $clan_id = mysql_insert_id(); echo 'Congratulations on registering your new clan for the BHD Singles Ladder!'; ?>
  14. After filling out the form and hitting submit, it calls the php script. Then the page just goes full white. And nothing is displayed.
  15. Here is the for that calls to bhdsingle_create.php: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <form action="bhdsingle_create.php" method="post"> Clan Name:<input type="text" name="clan_name"> Logo:<input ype="text" name="logo"> Message:<input type="text" name="message"> Email:<input tupe="text" name="email"> AIM Handle:<input type="text" name="aim"> Yahoo Handle:<input type="text" name="yahoo"> MSN Handle:<input type="text" name="msn"> <button type="submit">Submit</button> </form> </body> </html> Here is the php for bhdsingle_create.php: <?php session_start(); include('db.php'); array_pop($_POST); if ( get_magic_quotes_gpc() ) { $_POST= array_map('stripslashes', $_POST); } $clan_name = mysql_real_escape_string(trim($_POST['clan_name'])); $logo = mysql_real_escape_string(trim($_POST['logo'])); $message = mysql_real_escape_string(trim($_POST['message'])); $email = mysql_real_escape_string(trim($_POST['email'])); $aim = mysql_real_escape_string(trim($_POST['aim'])); $yahoo = mysql_real_escape_string(trim($_POST['yahoo'])); $msn = mysql_real_escape_string(trim($_POST['msn'])); if ((!$clan_name) || (!$logo) || (!$message) || (!$email) || (!$aim) || (!$yahoo) || (!$msn)) { $message = "info"; if (!$clan_name) { $error = "clan_name"; } if (!$logo) { $error = "logo"; } if (!$message) { $error = "message"; } if (!$email) { $error = "email"; } if (!$aim) { $error = "aim"; } if (!$yahoo) { $error = "yahoo"; } if (!$msn) { $error = "msn"; } include("bhdsingle_join_form.html"); exit; } $clan_name_sql = "SELECT COUNT(*) AS clan_name_match FROM `bhdsingle` WHERE `clan_name` ='$clan_name'"; $email_sql = "SELECT COUNT(*) AS email_match FROM `bhdsingle` WHERE `email` ='$email'"; $res= mysql_query($clan_name_sql) or die(mysql_error()); $result= mysql_query($email_sql) or die(mysql_error()); $clan_name_match= mysql_result($res, 0, 'clan_name_match'); $email_match= mysql_result($result, 0, 'email_match'); if (($clan_name_match > 0) || ($email_match > 0)) { if ($clan_name_match > 0 ) { $message = "clan_name_match"; unset($clan_name); echo 'Sorry, that clan name is already registered here at PST. Please choose another clan name.'; } if ($email_match > 0) { $message = "email_match"; unset($email); echo 'Sorry, that Email is already registered to a clan. Please use another Email address.'; } include("bhdsingle_join_form.html"); exit; } $sql = mysql_query("INSERT INTO bhdsingle (clan_name, logo, message, email, aim, yahoo, msn, signup_date) VALUES('$clan_name', '$logo', '$message', '$email', '$aim', '$yahoo', '$msn', now())") or die (mysql_error()); if(!$sql){ echo 'Det er kommet en fejl. Kontakt webmasteren'; } else { $clan_id = mysql_insert_id(); echo 'Congratulations on registering your new clan for the BHD Singles Ladder!; } ?> Any help would be appreciated. TY in advance.
  16. Yes they will all hold numbers.Wins will be 1-120, Losses will be 1-50 streak will be 1-100 and rank is actually a math problem dividing losses by wins( not sure if this belongs in the table or not)
  17. OK neither of what I was told to use was on that list
  18. where can I find info on how to use those? as in what area in this site?
  19. I want to create a table with the following: [color=blue]CREATE TABLE bhd_singles ( clanid int(25) NOT NULL auto_increment, clan_name varchar(25) NOT NULL default '', last_battle NOT NULL default '0000-00-00 00:00:00', wins losses streak rank [/color] I am not sure what commands to put in to define data on the last four rows. Can somebody help me?
  20. So then each option calls a new php file which selects the proper table? Which would mean calling a whole new page for each MySQL table.
  21. Will do. But won't the dropdown box be a php thing?
  22. I am creating a site for gamers to play tournaments online. I need to insert the following into a table on my pages. I want to create a db table to list all of the listed game clans for each ladder: Singles,Doubles,Quads and so on. I would like to have the page automatically load the quads table but then offer a dropdown box that will let the user select between which ladder will show up. Can this be done without the page changing and only the information in that section of my table changing? I'm thinking have the php commands set at that area of my table. Have these codes automatically call the Quads clans from the db.<--Not sure I will even be able to do that. Then what really confuses me is how do I get the dropdown box to select which potion of the table I want. I am guessing that I first need to set up a different table for each:Singles, Doubles, and Quads.  Then I would prob start the php in my table with my include'db.php'; What I don't know is how to call each table from the db to page view, via:dropbox. When it does do this I need to set it up so it can display other things from the table other than the clan name.  Sorry post is so long.  If you can understand all of my jibberish and think you can help, please respond.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.