MYSQL & PHP trouble with echoing tables -



MYSQL & PHP trouble with echoing tables -

so trying echo out how many rows there in table count command, purposely have no rows in table right test if statement, , not working, worst, makes rest of site not work(the page pops no text or numbers show on it), when added row table, worked fine, no rows = no work. here piece of code doesn't work. , help highly appreciated.

$query1 = mysql_query(" select *, count(1) `numberofrows` `table1` `user`='$username' grouping `firstname`,`lastname` "); $numberofrowsbase = 0; while($row = mysql_fetch_assoc($query1)) { if(isset($row['numberofrows'])) { $enteries1 = $enteries1; }else{ $enteries1 = $numberofrowsbase; } echo enteries1; }

seems have on complicated everything. advise worldofjr should take onboard simplest way total rows table is:

select count(*) numberofrows table1;

there several other unnecessary lines here , logic bonkers. there no need

$enteries1 = $enteries1;

this achieved nothing.

do instead:

while($row = mysql_fetch_assoc($query1)) { if(isset($row['numberofrows'])) { echo $row['numberofrows']; } }

php mysql

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -