xwishmasterx Posted August 22, 2008 Share Posted August 22, 2008 Hello (Please have in mind that I'm a complete noob:-)) I need to display a simple multiplication, where a "row" count is a part of it: I have this piece that will show the number of rows: <? $rs1=mysql_query("select * from users where ref_by='$username'"); echo mysql_num_rows($rs1);?> <? How can I multply this result with eg. 4? <? $rs1=mysql_query("select * from users where ref_by='$username'"); echo mysql_num_rows($rs1);?> * 4 = ?????? <? Hope you get the idea :-) Link to comment https://forums.phpfreaks.com/topic/120831-solved-quotsimplequot-math-problem/ Share on other sites More sharing options...
JasonLewis Posted August 22, 2008 Share Posted August 22, 2008 <?php $rs1=mysql_query("select * from users where ref_by='$username'"); $rows = mysql_num_rows($rs1); $multiplied = $rows * 4; echo "There are ".$rows." rows, or when multiplied by 4 there are ".$multiplied." rows!"; ?> Link to comment https://forums.phpfreaks.com/topic/120831-solved-quotsimplequot-math-problem/#findComment-622853 Share on other sites More sharing options...
xwishmasterx Posted August 22, 2008 Author Share Posted August 22, 2008 EXCELLENT! :-) Thanks a bunch! Link to comment https://forums.phpfreaks.com/topic/120831-solved-quotsimplequot-math-problem/#findComment-622891 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.