NameSilo

Help Once Again with QUery

SpaceshipSpaceship
Watch

snike

Established Member
Impact
3
OK...i have this:

PHP:
//PLAYER 2
$id = $_POST['id'];

$whatp2 = mysql_query("
SELECT player2
FROM duels
WHERE id = '$id'
") or die ("Error1");
$rowwp2 = mysql_fetch_row($whatp2);
$player2 = "$rowwp2[0]\n";
$play2 = $player2;

$p2h = mysql_query("
SELECT *
FROM users
WHERE `username` = $play2
") or die ("Error2" . mysql_error() . "");
$rowp2h = mysql_fetch_array($p2h);
print "{$rowp2h['health']}\n";

And when i print "{$rowp2h['health']}\n"; nothing shows up!

here is the full page : http://pastebin.ca/112842
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Can you just remove the h from print "{$rowp2h['health']}\n";

The h after the 2 and see what displays then
 
0
•••
Before your print statement, try printing out the entire array by doing

PHP:
print_r ($rowp2h);

Is the rest of the data beind displayed correct? If so, then it appears there's nothing in your database under the column 'health.' If the data in the array is not correct, then there's a problem with your query. Also try printing out the variable $play2 to be sure that the correct value is being obtained from your first query.
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
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