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 ...

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

Can't find a decent web analytics!!!
I've downloaded and installed Piwik. It's location detection based on IP addresses is fairly inaccur

Performance impact of cookies
Hi, I was just wondering what impact there would be in terms of performance if you where to set then

PHP time (deadline within one week)
I have a column ['projdue'], which stores the deadline for a project.
I have PHP code and <

Insert numbers from Barcode scanner into online php page
I have a real big problem, Here is what I'm trying to do. I have a Intermec CN3 handheld computer th

regex for quoted text within a string
I am still getting the hang of regex expressions, but I cant seem to figure out how I would escape q

Upload simple problem
Really confused!! I run once and it worked, but when i tried today...it didn't work

Which par

Entering Data Problem
Code: $result = mysql_query("SELECT * FROM flights");
while ($row = mysql_fetch_array($

Simple Variable Question
Hi everyone.... again,

I am really getting into php still. Learning more every day. I love it

How can i steam a video on my PHP site? (non YouTube)
Basically I have a PHP site and don't want to give page rank to YouTube. I just want to stream a bas

Retreiving objects from Sessions
Hi all,

I am getting really frustrated with storing and retreiving objects from a session. Bu

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