Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

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.
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
•••
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

Parking: find your domains by pasting a list
You can now paste a list of domain names into the search box at the top of the Parking menu. Put one name on each line. Your domain list...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back