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

Prevention Help
How can I use PHP or any other language (feel free to move this thread) to prevent users doing scree

php slowing my site?
Hi all,

I think that one of the reasons that my site doesn't work fast is that the code is ve

Sending an SMS Message with ASP.NET
Often times it may be a requirement for your web application to send an SMS message. Such examples w

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

Image resize
Hi again fellers

I managed to sort out the issues with the folder,

Final hurdle is th

need to apply an if/else statement to Tim Thumb script
Not sure how to work this. I essentially want to call a variety of image sizes based on which style

disabling a button server-side then re-enabling client-side breaks button postback
I have a tabbed container and a button (not in the container) on a page. If the first tab is selecte

Is this possible? If one file assigned to an ID...
I have a page that lists property listings assigned to a specific user (a manage page), with brief t

Checkbox info wont include in Mailto
Hey, im new to php.
Basically I have made a form to request which type of job(s) are needed, whic

preg_match logical error
Code: <?php
$s = file_get_contents("page.html");
preg_match('/<div cla

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