Displaying values from a SQL count...


Posted on 16th Feb 2014 07:03 pm by admin

Hi,
Easy enough question i just forget the exact method ..
I have ...

Did you know?Explore Trending and Topic pages for more stories like this.
Code: //count wins ...
$count_wins = mysql_query("SELECT count(*) FROM `matches`
WHERE result = 'W'
AND Player1_ID = $player1_val
AND Player2_ID = $player2_val ");


Then i want to display this :
Code: echo "<h2><b> Wins ". $count_wins . "</h2></b>" ;

But what is displayed is Wins Resource ID # 3

(or similar...)

How to i convert this php variable to a normal int?

becuase i didn't need to do this before in another query when i used to compare values .
No comments posted yet

Your Answer:

Login to answer
316 Like 30 Dislike
Previous forums Next forums
Other forums

error help - Dynamic Image
I've been working on making my site less cluttered in the directories and more secure lately. In an

Email logic not working
I would like to send an email using the php email() function then if it does execute i.e sends i wou

Javascript using window.location seems to lose state
Not sure what forum so let me know if I'm in the wrong place. I have a main window with a ajax grid

Display the user's weight lost in the past week
Hello everyone,

I am working on a weight loss app for my site, and I want to display the user

how do i display data on a page from mysql
1 - do i use this code at the top of each of my page i wish to only alow access if there as been a s

Access website from only 1 computer...?
One of my customers wants his website to only be accessed by people in which they bought the website

Help! refer to a friend script with captcha code
Hi guys, I am posting on here in desperate need for some help with an ongoing search I have been doi

Check Digits and extracting digits
I think I can figure out the code for this but I am having a very hard time getting past the first s

Need help with unexpected T-STRING error
I'm a newbie and I'm still learning PHP. However this error has me stumped. I've googled, searched t

Shuffle Array
Hi,

I am writing a script for a game that needs players to randomly be assigned a target (ano

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash