Getting Specific Field from a table??

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch
Impact
19
Hey
I am trying to get a SPECIFIC field from a table..
for example if the table has these fields:

username, pass, health, country, offense

and i only want the page to display "health" of a user..how would i do that??
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains — AI StorefrontUnstoppable Domains — AI Storefront
unknowngiver said:
k so i tried this
PHP:
<?
$country = $_GET['country'];
$searchpass = $_GET['searchpass'];
$dbusername="zubair";
$dbpassword="";
$database= "z_game";
if ($searchpass == "aa") {
	mysql_connect(localhost, $dbusername, $dbpassword);
	@mysql_select_db($database) or die("Unable to select database");
	 $sql = 'SELECT * FROM `user` WHERE country = "pakistan" LIMIT 1';
	$execute = mysql_query($sql);

echo $execute;
 }
else {
echo "error\n";
}
?>
and it gave me this:

Resource id #3
I have never really understood why it works like that, but it just does.

You can only really get mysql data 1 row at a time. For instance, you want everyone's records from the country pakistan. $execute dosen't store the information, but rather is a way of accessing the information, or maybe directions to the information etc yada yada.

If you want to output everyone who comes from pakistan you will need to get the information row by row. See the code above, I have had a glance and it looks perfectly alright.

Tom
 
0
•••
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back