November 29, 2024, 02:01:41 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 5 Guests are viewing this topic.

Go Down

guff

Quote from: Mr. Caravan on May 15, 2008, 07:20:11 PM
This is stupid and a waste of time.
you're just saying that because outsider's going to beat you  baddood;

Socks


Daddy

I LEARNED A NEW TRICK GUYS
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());


mysql_query("INSERT INTO card 
(cardName, cardATK, cardDEF, cardHP, cardIMG, cardType, cardDesc, cardRarity) VALUES('Karel', '80', '100', '150', 'http://karel.com', 'Former Demigod', 'He was once Forum', '5'  ) "

or die(
mysql_error());  


echo 
"Data Inserted!";

?>



Now I just need to figure out how to make it so each of those values are variables entered by the user and how to prevent injections.  baddood;

Socks


Daddy

Quote from: Vincent on May 15, 2008, 07:47:02 PM

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());


mysql_query("INSERT INTO card 
(cardName, cardATK, cardDEF, cardHP, cardIMG, cardType, cardDesc, cardRarity) VALUES('Socks', '75', '105', '175', 'http://usaa.mil', 'Pseudo', '2o ways to kill a man. Only one to do it right.', '3'  ) "

or die(
mysql_error());  


echo 
"Data Inserted!";

?>

guff


Daddy


guff


Socks

JMV, is that gibberish supposed to mean something to me?

Mine shall be named "General Socks".

Daddy

Quote from: Vincent on May 15, 2008, 07:58:24 PM
JMV, is that gibberish supposed to mean something to me?

Mine shall be named "General Socks".
that gibberish is what makes boyah possible :|

Socks

Quote from: JMV on May 15, 2008, 08:08:37 PM
that gibberish is what makes boyah possible


Show me what I want to see, dammnit.   baddood;

Feynman

Stop posting your goddamn behing-the-scenes thoughts. That's why they're behind the scenes. I know you want credit, but you can claim it when your work is finished, not when building hype for something that's going to completely suck or never be finished.

Quote from: JMV on May 15, 2008, 07:41:17 PM
Now I just need to figure out how to make it so each of those values are variables entered by the user and how to prevent injections.  baddood;

Make HTML forms, give them names, and tie them with the php script using $_POST.

Daddy

Quote from: Vincent on May 15, 2008, 08:10:13 PM
Show me what I want to see, dammnit.   baddood;
srs phpMyAdmin is taking a nap

However, I did work on a new form.
Code Select
<html>
<body>
<form action="BoyahTCG.php" method="post">
Card Name:<input type="text" name="cardName" /><br>
Attack:<input type="text" name="cardATK" /><br>
Defense:<input type="text" name="cardDEF" /><br>
Health:<input type="text" name="cardHP" /><br>
Image URL:<input type="text" name="cardIMG" /><br>
Type:<input type="text" name="cardType" /><br>
Description:<input type="text" name="cardDesc" /><br>
Rarity: <input type="text" name="cardRarity" /><br>
<input type="submit" />
</form>
</body>
</html>


That calls this file....
Code Select
<?php
// Make a MySQL Connection
mysql_connect("localhost""*stillno*""*naw*") or die(mysql_error());
mysql_select_db("Boyah_TCG") or die(mysql_error());

// Insert a row of information into the table "card"
mysql_query("INSERT INTO card 
(cardName, cardATK, cardDEF, cardHP, cardIMG, cardType, cardDesc, cardRarity) VALUES(
$_POST["cardName"]$_POST["cardATK"]$_POST["cardDEF"]$_POST["cardHP"]$_POST["cardIMG"]$_POST["cardType"]$_POST["cardDesc"]$_POST["cardRarity"]  ) "
or die(
mysql_error());  


echo 
"Data Inserted!<br>";
echo 
$_POST["cardName"]." created";

?>


Fuck i just tested it and it doesn't pass the information.

I'll try playing with quotes





Daddy

Quote from: Mr. Caravan on May 15, 2008, 08:17:08 PM
Stop posting your goddamn behing-the-scenes thoughts. That's why they're behind the scenes. I know you want credit, but you can claim it when your work is finished, not when building hype for something that's going to completely suck or never be finished.
so, it will at least help me learn php and mysql stuff  :|
Quote
Make HTML forms, give them names, and tie them with the php script using $_POST.
just did, I did something wrong though.

Feynman

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
$con mysql_connect("localhost","username","password");
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db("Boyah_TCG"$con);

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

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

echo 
"Data Inserted!";

?>



Go Up