November 29, 2024, 03:51:36 PM

1,531,356 Posts in 46,734 Topics by 1,523 Members
› View the most recent posts on the forum.


ITT a VERY crude and early example of the Boyah Cards.

Started by Daddy, May 15, 2008, 04:32:39 PM

previous topic - next topic

0 Members and 7 Guests are viewing this topic.

Go Down

Daddy

Quote from: Mr. Caravan on May 15, 2008, 08:22:38 PM
For example:
Code Select

<form action="insert.php" method="post">
Card name: <input type="text" name="name" />
ATTK value: <input type="text" name="attk" />
<input type="submit" />
</form>


And the PHP file should be:
Code Select

<?php
// Make a MySQL Connection
mysql_connect("localhost""*lol no*""*lol no*") or die(mysql_error());
mysql_select_db("Boyah_TCG") or die(mysql_error());

$name $_POST["name"];
$attk $_POST["attk"];

mysql_query("INSERT INTO card 
(cardName, cardATK) VALUES(
$name$attk) "
or die(
mysql_error());  

echo 
"Data Inserted!";

?>



Oh, I had the right idea, I just did it wrong.  You need to convert the post shit into a variable before handing it to the insert function.

i'm probably using the wrong terms.

Feynman

Quote from: JMV on May 15, 2008, 08:24:09 PM
Oh, I had the right idea, I just did it wrong.  You need to convert the post shit into a variable before handing it to the insert function.


You don't have to, it just makes the script more organized and easier to use.

Daddy

Quote from: Mr. Caravan on May 15, 2008, 08:25:03 PM
You don't have to, it just makes the script more organized and easier to use.
then what did I do wrong?
Code Select
VALUES($_POST["cardName"], $_POST["cardATK"], $_POST["cardDEF"], $_POST["cardHP"], $_POST["cardIMG"], $_POST["cardType"], $_POST["cardDesc"], $_POST["cardRarity"]  ) ")

Should each of those be in quotes?

Feynman

Quote from: JMV on May 15, 2008, 08:25:38 PM
then what did I do wrong?
Code Select
VALUES($_POST["cardName"], $_POST["cardATK"], $_POST["cardDEF"], $_POST["cardHP"], $_POST["cardIMG"], $_POST["cardType"], $_POST["cardDesc"], $_POST["cardRarity"]  ) ")

Should each of those be in quotes?


try the variables baddood;

Daddy

I found the problem.

You also did it wrong.
Code Select
mysql_query("INSERT INTO card
(cardName, cardATK, cardDEF, cardHP, cardIMG, cardType, cardDesc, cardRarity) VALUES('$name', '$attack', '$defense', '$HP', '$IMG', '$Type', '$Desc', '$Rarity') ")




Now that it works I have a very simple method of actually creating cards. now i just need to make the interface not look ugly and i still need to do some error handling and stuff.

Does anyone know how to prevent auto_increment from incrementing over an empty table?

I had 6 things in the database, added a 7th, deleted it and then added another.  Instead of making it 00000007, it made it 00000008 leaving me with no number seven.

LCK


Daddy


bluaki

Quote from: JMV on May 15, 2008, 09:14:02 PM



IT'S SO UGLY, I NEED TO NEATEN IT OUT.
JUST USE A TABLE TO ARRANGE THE TEXT BOXES AND TEXT IN SEPERATE COLUMNS

Daddy

Quote from: bluaki on May 15, 2008, 09:32:40 PM
USE A TABLE TO ARRANGE THE TEXT BOXES AND TEXT IN SEPERATE COLUMNS
i tried and it went fuck you jmv

Daddy

hey bluaki it works now.  it turns out that i made a typo and forgot to close my table tag

Daddy


superclucky

kewns are smelly

Daddy


superclucky

kewns are smelly

Daddy


Go Up