Jump to content

dunno something wrong


desjardins2010

Recommended Posts

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

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';
}
?>

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.