Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There is much to be improved in your code. But here is a quick fix:</p> <pre><code>&lt;?php if ($_POST['starter'] == '1' ) { mysql_query("INSERT INTO user_pokemon (pokemon, belongsto, exp, time_stamp, slot, level,type) VALUES('Bulbasaur','".$_POST['username']."', 100,'".time()."','1' ,'5','Normal' ) ") or die(mysql_error()); } if ($_POST['starter'] == '2' ) { mysql_query("INSERT INTO user_pokemon (pokemon, belongsto, exp, time_stamp, slot, level,type) VALUES('Charmander','".$_POST['username']."', 100,'".time()."','1' ,'5','Normal' ) ") or die(mysql_error()); } if ($_POST['starter'] == '3' ) { mysql_query("INSERT INTO user_pokemon (pokemon, belongsto, exp, time_stamp, slot, level,type) VALUES('Squirtle','".$_POST['username']."', 100,'".time()."','1' ,'5','Normal' ) ") or die(mysql_error()); } if ($_POST['starter'] == '4' ) { mysql_query("INSERT INTO user_pokemon (pokemon, belongsto, exp, time_stamp, slot, level,type) VALUES('Chikorita','".$_POST['username']."', 100,'".time()."','1' ,'5','Normal' ) ") or die(mysql_error()); } if ($_POST['starter'] == '5' ) { mysql_query("INSERT INTO user_pokemon (pokemon, belongsto, exp, time_stamp, slot, level,type) VALUES('Cyndaquil','".$_POST['username']."', 100,'".time()."','1' ,'5','Normal' ) ") or die(mysql_error()); } if ($_POST['starter'] == '6' ) { mysql_query("INSERT INTO user_pokemon (pokemon, belongsto, exp, time_stamp, slot, level,type) VALUES('Totodile','".$_POST['username']."', 100,'".time()."','1' ,'5','Normal' ) ") or die(mysql_error()); } if ($_POST['starter'] == '7' ) { mysql_query("INSERT INTO user_pokemon (pokemon, belongsto, exp, time_stamp, slot, level,type) VALUES('Treecko','".$_POST['username']."', 100,'".time()."','1' ,'5','Normal' ) ") or die(mysql_error()); } if ($_POST['starter'] == '8' ) { mysql_query("INSERT INTO user_pokemon (pokemon, belongsto, exp, time_stamp, slot, level,type) VALUES('Torchic','".$_POST['username']."', 100,'".time()."','1' ,'5','Normal' ) ") or die(mysql_error()); } if ($_POST['starter'] == '9' ) { mysql_query("INSERT INTO user_pokemon (pokemon, belongsto, exp, time_stamp, slot, level,type) VALUES('Mudkip','".$_POST['username']."', 100,'".time()."','1' ,'5','Normal' ) ") or die(mysql_error()); } if ($_POST['starter'] == '10' ) { mysql_query("INSERT INTO user_pokemon (pokemon, belongsto, exp, time_stamp, slot, level,type) VALUES('Turtwig','".$_POST['username']."', 100,'".time()."','1' ,'5','Normal' ) ") or die(mysql_error()); } if ($_POST['starter'] == '11' ) { mysql_query("INSERT INTO user_pokemon (pokemon, belongsto, exp, time_stamp, slot, level,type) VALUES('Chimchar','".$_POST['username']."', 100,'".time()."','1' ,'5','Normal' ) ") or die(mysql_error()); } if ($_POST['starter'] == '12' ) { mysql_query("INSERT INTO user_pokemon (pokemon, belongsto, exp, time_stamp, slot, level,type) VALUES('Piplup','".$_POST['username']."', 100,'".time()."','1' ,'5','Normal' ) ") or die(mysql_error()); } ?&gt; </code></pre> <p>This assumes that your post is submitted from that form on your page. Like someone else said, learn PDO: <a href="http://php.net/manual/en/book.pdo.php" rel="nofollow">http://php.net/manual/en/book.pdo.php</a></p> <p>Your current code is prone to SQL injection: <a href="http://en.wikipedia.org/wiki/SQL_injection" rel="nofollow">http://en.wikipedia.org/wiki/SQL_injection</a></p> <p>That is NOT good.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload