codrgii Posted July 10, 2009 Share Posted July 10, 2009 This is what im trying $users= odbc_exec($con, "SELECT COUNT(*) FROM TABLE"); $total = odbc_result($users, 1); $users4= odbc_exec($con, "SELECT COUNT(*) FROM TABLE4"); $total4 = odbc_result($users4, 1); $users5 = "$total + $total4"; echo ""$users5""; and it dosen't work, it collects the data from 2 different tables, and i want to add them up into one final result, how would i manage to do this? Quote Link to comment https://forums.phpfreaks.com/topic/165482-how-to-add-in-php/ Share on other sites More sharing options...
Philip Posted July 10, 2009 Share Posted July 10, 2009 $users5 = "$total + $total4"; echo ""$users5""; should be $users5 = $total + $total4; echo $users5; Quote Link to comment https://forums.phpfreaks.com/topic/165482-how-to-add-in-php/#findComment-872792 Share on other sites More sharing options...
codrgii Posted July 10, 2009 Author Share Posted July 10, 2009 my echo has stuff already inside it such as $users5 = $total + $total4; echo '<table>with info here</table><br>'.$users5.' '; the problem with that is that it dosent show the $users5 part and is blank, whys that and how do i make the result show? Quote Link to comment https://forums.phpfreaks.com/topic/165482-how-to-add-in-php/#findComment-872797 Share on other sites More sharing options...
Philip Posted July 10, 2009 Share Posted July 10, 2009 Well, I'm not familiar with odbc, but if you echo $total and $total4 separately and they don't show up then something is up with your queries. Quote Link to comment https://forums.phpfreaks.com/topic/165482-how-to-add-in-php/#findComment-872800 Share on other sites More sharing options...
aschk Posted July 10, 2009 Share Posted July 10, 2009 find the error: <?php echo odbc_errormsg($con); ?> Quote Link to comment https://forums.phpfreaks.com/topic/165482-how-to-add-in-php/#findComment-872805 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.