Patte12 Posted July 17, 2012 Share Posted July 17, 2012 Hello. I'm really new to PHP/MySQL. I got this code: $user = $_POST['user']; $money = $_POST['money']; $check = mysql_query("SELECT * FROM database WHERE `user`='".$user."'"); $numrows = mysql_num_rows($check); if ($numrows == 0) { die ("Username does not exist \n"); } else { // Stuck! } Now if the user match any username in the database table, i want it to "die" how much money they have so example: $user = $_POST['user']; $money = $_POST['money']; $check = mysql_query("SELECT * FROM database WHERE `user`='".$user."'"); $numrows = mysql_num_rows($check); if ($numrows == 0) { die ("Username does not exist \n"); } else { // check the money under their user // and then returns die (their money); } But my problem is that i don't know what to check for, should i use something like "SELECT * FROM $user" or what?. I don't know how to get started can anybody point me to the right direction?. Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/265854-php-and-mysql/ Share on other sites More sharing options...
Barand Posted July 17, 2012 Share Posted July 17, 2012 We don't know either because we haven't a clue what is in your database or what the significance of "$_POST['money']" is. Quote Link to comment https://forums.phpfreaks.com/topic/265854-php-and-mysql/#findComment-1362270 Share on other sites More sharing options...
Patte12 Posted July 17, 2012 Author Share Posted July 17, 2012 We don't know either because we haven't a clue what is in your database or what the significance of "$_POST['money']" is. The database is a table with - id - user - money - pass And ive deleted the $money = POST.. i don't need that i just want to return the user's money. Tryed something like this while($row = mysql_fetch_assoc($check)) { die($money); } But that doesn't return anything. Quote Link to comment https://forums.phpfreaks.com/topic/265854-php-and-mysql/#findComment-1362271 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.