<?php $where = array(); $_GET['CodigoUtente'] = 'sany'; $_GET['Nome'] = 'dddd'; if(isset($_GET['CodigoUtente'])){ $where[] = "CodigoUtente = '".$_GET['CodigoUtente']."'"; } if(isset($_GET['Nome'])){ $where[] = "Nome = '".$_GET['Nome']."'"; } $sql = "SELECT CodigoUtente, Nome, DataNasc, Sexo, Estadocivil, Nacionalidade, Responsavel, Parentesco, Contato FROM centrodb.PsicUtentes"; if(!empty($where)){ $final_where = count($where) > 1 ? implode(' OR ', $where) : end($where); $sql = "$sql WHERE ". $final_where; } echo $sql;
You have javascript disabled. You will not be able to edit any code.