PHP SQL Search With Duplicate Entries -


i'm trying make search either last name or first name in database have return values , echo them out. have gotten far i'm getting stuck when there duplicate entry such first name.

ex; 2 entries within database have same firstname value bill , different lastname values

how can return ones same first name value? i've tried multiple solutions have not been able it. feel i'm missing easy i'm being blind , can't see it.

$query = $handler->query("select * rwapplicants group firstname having count(*) >= 1");                         $r = $query->fetch(pdo::fetch_assoc);                         if($r){                                  echo "first";                                 print_r($r);} 

gives me first row not others

i've tried , different variations of it..hopefully can help! thank you!

you're mixing db libraries. using ->query() suggests you're using pdo or mysqli. try actual result rows mysql_fetch_array().

the "big three" libraries (mysql, mysqli, , pdo) not interchangeable, , connection/result handles 1 library utterly useless in others.

since you're using pdo/mysqli, mysql_fetch call return boolean false indicate failure, not array of data.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -