Foros del Web » Programando para Internet » PHP »

Warning: Missing argument - ayuda¡¡¡

Estas en el tema de Warning: Missing argument - ayuda¡¡¡ en el foro de PHP en Foros del Web. Hola amigos, Me estoy volviendo loco. Estoy usando un script en php en el que hay un formulario al que he añadido un campo: resultados ...
  #1 (permalink)  
Antiguo 20/03/2006, 11:00
Avatar de padelmatch.com  
Fecha de Ingreso: marzo-2006
Mensajes: 9
Antigüedad: 18 años, 1 mes
Puntos: 0
Warning: Missing argument - ayuda¡¡¡

Hola amigos,

Me estoy volviendo loco. Estoy usando un script en php en el que hay un formulario al que he añadido un campo:

resultados :<input type='text' name='r1' value='' size='1' maxlength='1'>

Y quiero que el número que se meta en el input se introduzca tb en la base de datos.

En la base de datos hay un campo que se llama setguno que es donde quiero que de introduza la variable 'r1'

Hago un "insert into" pero me da el error "Missing argument".

A que se puede deber???
  #2 (permalink)  
Antiguo 20/03/2006, 11:05
Avatar de mariogl84  
Fecha de Ingreso: noviembre-2002
Ubicación: Barcelona
Mensajes: 433
Antigüedad: 21 años, 4 meses
Puntos: 20
Si puedes, pon el código para que podamos ver dónde está el error.
  #3 (permalink)  
Antiguo 20/03/2006, 11:23
Avatar de padelmatch.com  
Fecha de Ingreso: marzo-2006
Mensajes: 9
Antigüedad: 18 años, 1 mes
Puntos: 0
Ahí va. Pego un trozo del código, a ver si veis algo.
¿hay que definir la variable en la función confirm_wind?
Si pongo:

confirm_wind($matchid,$member,$map,$wfscore,$lfsco re,$wcomment,$kills,$r1) -- me da missing argument y en la base de datos me escribe "array"
Así es como estaba:
confirm_wind($matchid,$member,$map,$wfscore,$lfsco re,$wcomment,$kills)
no da error, pero no inserta el dato "r1" en la base de datos...



Código PHP:
<table width='100%' border='0'  cellspacing='0' cellpadding='0'>

<
tr>
<
td width='50%' valign='center' align='center'>$wtinfo[teamname] <input type='text' name='wfscore' value='' size='3' maxlength='3'>&nbsp;</td>
<
td width='50%' valign='center' align='center'>$match[loseralias] <input type='text' name='lfscore' value='' size='3' maxlength='3'$ltinfo[teamname]</td>
</
tr>


// ESTO ES LO QUE HE INTRODUCIDO
<tr>
<
td width='' align='right'>resultados :<input type='text' name='r1' value='' size='1' maxlength='1'></td>
</
tr>
// HASTA AQUI


</table>";

if($misc[winnercomment]=="
yes"){
$out[body]=$out[body]."
</td>

</
tr>

<
tr class='altcolorc'>

<
td width='100%' valign='top' align='center'>

<
strong>Comments</strong><br>

</
td>

</
tr>

<
tr>

<
td width='100%' valign='center' align='center'>

<
tr>

<
td width='100%' valign='center' align='center'>

<
input type='text' name='wcomment' maxlength='50' size='50'><br>

<
small>50 Characters Max</small>

</
td>

</
tr>";



}


$out[body]=$out[body]."



<tr>

<
td width='100%' valign='top' align='center'>
<
BR>
<
input type='hidden' name='matchid' value='$match[matchid]'>

<
input type='hidden' name='action' value='confirmwind'>

<
input type='submit' name='' value='enviar'>

</
td></form>

</
tr>

</
table>

$tablefoot";


include("
$dir[curtheme]");

}


function confirm_wind($matchid,$member,$map,$wfscore,$lfscore,$wcomment,$kills,$r1){

global $dir, $file, $url, $out, $plyr, $misc;



if(!$matchid){

include("
$dir[func]/error.php");

display_error("
Invalid Match ID.<br>");

}



if((!$wfscore) || ($wfscore <= $lfscore)){

include("
$dir[func]/error.php");

display_error("
Invalid Final Score.<br>");

}



$matchinfo=mysql_query("
SELECT FROM matchdbval WHERE matchid='$matchid'");

$match=mysql_fetch_array($matchinfo);



if(!$match[matchid]){

include("
$dir[func]/error.php");

display_error("
Unknown Match ID.<br>");

}



//CHECK IF CAN CONFIRM/REPORT

if (mysql_num_rows(mysql_query("
SELECT status FROM teammembers WHERE teamid='$match[winnerid]' AND playerid='$plyr[id]' AND status <='4'")) < 1){

include("
$dir[func]/error.php");

display_error("
You are not allowed to report losses for this team.<br>");

}



$ladderinfo=mysql_query("
SELECT FROM ladders WHERE id='$match[ladderid]'");

$linfo=mysql_fetch_array($ladderinfo);



if(!$linfo[laddername]){

include("
$dir[func]/error.php");

display_error("
Unknown ladder.<br>");

}



$winnerinfo=mysql_query("
SELECT teamname FROM teams WHERE id='$match[winnerid]'");

$wtinfo=mysql_fetch_array($winnerinfo);



if(!$wtinfo[teamname]){

include("
$dir[func]/error.php");

display_error("
Unable to find your team.<br>");

}



if(!$member){

include("
$dir[func]/error.php");

display_error("
You must select the members that played.<br>");

}


include("
$dir[func]/checkdata.php");

$wfscore=change_numbersonly($wfscore);

if($lfscore==""){

$lfscore=0;

}else{

$lfscore=change_numbersonly($lfscore);

}



if((!$wfscore) || (!$lfscore) && ($lfscore!="
0")){

include("
$dir[func]/error.php");

display_error("
Invalid Final Score.<br>");

}


if($wcomment){

$wcomment=wordwrap($wcomment,20," ",1);

$wcomment=change_censor($wcomment);

$wcomment=change_charecters($wcomment);

}

while(list($memberid,$played)=each($member)){

 if($played){

 $memberid=change_numbersonly($memberid);

 $kills[$memberid]=change_numbersonly($kills[$memberid]);

 $membersplayed=$membersplayed."
$memberid|$kills[$memberid],";

 $totalkills=($totalkills + $kills[$memberid]);

 }

}


if($map){

 while(list($maporder,$wonmap)=each($map)){

  if($wonmap){

  $mapsplayed=$mapsplayed."
$maporder,";

  }

 }

}



if(!$membersplayed){

include("
$dir[func]/error.php");

display_error("
You must select the members that played.<br>");

}


//CHECK FOR CHALLENGE OR IF OPEN PLAY IS ALLOWED

$thechallenge=mysql_query("
SELECT FROM challenges WHERE challenger='$match[winnerid]' AND challenged='$match[loserid]' AND finalizedby '0' OR challenger='$match[loserid]' AND challenged='$match[winnerid]' AND finalizedby '0'");

$chall=mysql_fetch_array($thechallenge);



if($chall[challid]){



 if($match[winnerid]=="
$chall[challenger]"){

 $wtempnewrank="
$chall[challengedrank]";

 }else{

 $wtempnewrank=0;

 }



}else{

 if($linfo[openplay] < 1){

 include("
$dir[func]/error.php");

 display_error("
Open play is not allowed on this ladder.<br>All matches must be scheduled challenges.<br>");

 }

}




//CLEAN MATCH DB

clean_matchdb($matchid);





$tday=date("
Y-m-d H:i:s");

$ip=getenv("
REMOTE_ADDR"); 



//REPORT MATCH TO MATCH DATABASE

mysql_query("
INSERT INTO matchdb VALUES (

'$match[matchid]'

'$match[winnerid]'

'$match[loserid]'

'$wtinfo[teamname]'

'$match[loseralias]'

'$match[ladderid]'

'$linfo[laddername]'

'$match[wrank]'

'$match[lrank]'

'$wfscore'

'$lfscore'

'$membersplayed'

'$match[losersmembers]'

'$match[maps]'

'$mapsplayed'

'$wcomment'

'$match[lcomment]'

'$match[points]'

'$totalkills|$match[skill]'

'$match[reportedby]'

'$match[reporteddate]'

'$match[reportedip]'

'$plyr[id]'

'$tday'

'$ip',

'$r1'

);"); 
  #4 (permalink)  
Antiguo 20/03/2006, 11:36
Avatar de mariogl84  
Fecha de Ingreso: noviembre-2002
Ubicación: Barcelona
Mensajes: 433
Antigüedad: 21 años, 4 meses
Puntos: 20
En el trozo de código que has pegado se define la función, pero no aparece ninguna llamada. Si has definido la función con un parámetro más, al llamar a la función también tendrás que introducir un parámetro más, podría ser ése el error, pero tendrías que pegar el trozo que realiza la llamada a la función confirm_wind() para comprobarlo.
  #5 (permalink)  
Antiguo 20/03/2006, 11:58
Avatar de padelmatch.com  
Fecha de Ingreso: marzo-2006
Mensajes: 9
Antigüedad: 18 años, 1 mes
Puntos: 0
No es esta la llamada???

Vamos a ver: hay

Una variable "r1" que se introcuce a traves de un formulario.
Un boton de enviar que con el valor de la funcion.
la funcion que debería introducir los datos del formulario en la base de datos.

Que me falta???


Código PHP:
<input type='hidden' name='action' value='confirmwind'
  #6 (permalink)  
Antiguo 20/03/2006, 13:17
Avatar de mariogl84  
Fecha de Ingreso: noviembre-2002
Ubicación: Barcelona
Mensajes: 433
Antigüedad: 21 años, 4 meses
Puntos: 20
Esa línea por sí sola no es una llamada a una función (que luego a través de php la conviertas en una llamada es otra cosa).

En esa parte del código que pegaste no se ve, por ejemplo, donde manda el formulario los datos. Tu formulario mandará los datos a algún script, que, después de recogerlos, llamará a la función.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:13.