desjardins2010 Posted December 11, 2010 Share Posted December 11, 2010 Hey guys i don't know whats up here everything looks ok? it just returning $bankacct instead of pulling the info from the database not getting any errors though that says i'm not connected? <?php //this script will pull users programs and present them //connect to db $connect = mysql_connect("localhost","removed","removed") or die ("Could not connect to database"); mysql_select_db("heaven_users") or die ("Could not select database"); $query = mysql_query("SELECT * from members WHERE username='Theaf'"); $numrows = mysql_num_rows($query); if($numrows!=0) { while ($row = mysql_fetch_assoc($query)) { //set varibles for values in database $bankacct = $row['bankaccountnumber']; $balance = $row['balance']; $virusscanner = $row['virusscanner']; $passwordcracker = $row['passwordcracker']; $iptracer = $row['iptracer']; echo '$bankacct'; } } else echo "dunno something wrong"; ?> Link to comment https://forums.phpfreaks.com/topic/221276-dunno-something-wrong/ Share on other sites More sharing options...
MMDE Posted December 11, 2010 Share Posted December 11, 2010 Try this instead: <?php //this script will pull users programs and present them //connect to db $connect = mysql_connect('localhost','removed','removed') or die ('Could not connect to database'); mysql_select_db('heaven_users') or die ('Could not select database'); $query = mysql_query('SELECT * from members WHERE username=\'Theaf\'') or die(mysql_error()); if(mysql_num_rows($query)>0){ while($row = mysql_fetch_assoc($query)){ //set varibles for values in database $bankacct = $row['bankaccountnumber']; $balance = $row['balance']; $virusscanner = $row['virusscanner']; $passwordcracker = $row['passwordcracker']; $iptracer = $row['iptracer']; echo $bankacct; } }else{ echo 'dunno something wrong'; } ?> Link to comment https://forums.phpfreaks.com/topic/221276-dunno-something-wrong/#findComment-1145623 Share on other sites More sharing options...
desjardins2010 Posted December 11, 2010 Author Share Posted December 11, 2010 getting the same thing just echoing $bankacct no errors?? Link to comment https://forums.phpfreaks.com/topic/221276-dunno-something-wrong/#findComment-1145624 Share on other sites More sharing options...
MMDE Posted December 11, 2010 Share Posted December 11, 2010 k, your problem is that you had string quotes around the $bankacct when you echoed it. use my exact code, don't copy paste parts of it... ' echo '$bankacct'; ^ is what you did put magic quotes around it, which I really dislike, but remove the two ' in any case. it's not a string. and again, use my exact code and see if it works or gives you any errors. Link to comment https://forums.phpfreaks.com/topic/221276-dunno-something-wrong/#findComment-1145626 Share on other sites More sharing options...
desjardins2010 Posted December 11, 2010 Author Share Posted December 11, 2010 Ahh damit... srry man thanks!!!! Link to comment https://forums.phpfreaks.com/topic/221276-dunno-something-wrong/#findComment-1145630 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.