Name.com Cyber Monday sale: $6.99 .com domains and more. Shop the sale.

Getting Specific Field from a table??

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
Close
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

New: watch any domain
You can now watch domains on NamePros. We check each one and notify you when something changes. Search for a domain and press Watch on...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back