I have an input field, a selection of posts and a button redirects to this post "player.php" and From there searches for a name on the database. The problem is that if I search for something or it always shows the same "nop" then
main php:
& lt; Form action = "player.php" method = "post" /> & Lt; Br> Procuror por Jogder o Concasa: & lt; / Br & gt; & Lt; / P & gt; & Lt; Input type = "text" name = "name" id = "name" size = "30" /> gt; & Lt; / P & gt; & Lt; Select name = "drop" & gt; & Lt; Option value = "personagem" & gt; Personality & lt; / Options & gt; & Lt; Option value = "pid" & gt; PID & lt; / Options & gt; & Lt; Option value = "idconta" & gt; ID Contoso & lt; / Option & gt; & Lt; Option value = "Login" & gt; Login & lt; / Options & gt; & Lt; / Select & gt; & Lt; Input type = "submit" name = "submit" value = "buscar" />
player.php:
if ($ _ POST ['submit']) {$ inputVar = $ _POST ["drop"]; If ($ inputVar = "personagem") {$ busca = $ _POST ['name']; $ Busca_query = mysql_query ("player name by selector name WHERE = '$ busca'"); $ Line = mysql_fetch_row ($ busca_query); $ Result = $ line [0]; If (($ result)> 1) {echo "Encontrado!"; } Else {echo "nop"; } {$ InputVar = $ _POST ["Drop"]}}}}
/ update:
if (isset ($ _ POST ['submit ']);; ($ InputVar = "personagem") {$ busca = $ _POST [' name ']; $ Busca_query = mysql_query ("player name by selector name WHERE =' $ busca '") or die (mysql_error ( ); $ Line = mysql_fetch_row ($ busca_query); $ result = $ line [0]; if (($ result) & gt; 1) {echo "Encontrado!";} Else {echo "nop";}} Print_r ($ Line);
Still not working
Message: NopArray ([0] => [DV] Montage)
Any errors
<if (($ result)> 1) {div =}>
$ result
is a string, and it is being compared to an integer, it is inserted as integer, especially 0, which is definitely less than 1. <if ($ result) {
or
if (strlen) ($ result)> 0) {< Code>
No comments:
Post a Comment