Visualizzazione dei risultati da 1 a 8 su 8
  1. #1

    ErroreWarning: mysql_fetch_array(): supplied argument is not a valid MySQL

    Un problema che mi affligge da qualche giorno quando mi loggo nell'area manager del mio sito.

    Mi compare questo errore quando entro nella pagina edit.php?ID=xx


    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.mysite.com/htdocs/manager/edit.php on line 101

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.mysite.com/htdocs/manager/edit.php on line 102

    ecc. per 5-6 righe



    Potrebbe essere un problema di autenticazione o di cookie ?

    Perchè non mi ha mai dato questo problema ?

    Non ci sto capendo piu' niente.

    Un caro saluto.

  2. #2
    POSTA IL CODICE

    Grazie

    3/6/2003 è morto l'angelo della mia vita..
    www.markwebinformatica.net
    My BLOG

  3. #3
    Utente di HTML.it L'avatar di luca200
    Registrato dal
    Apr 2002
    Messaggi
    4,120
    Anche senza bisogno di postare il codice

    Quando esegui un'istruzione mysql devi SEMPRE aggiungere in fondo "or die/(mysql_error())"

  4. #4
    Ecco gli errori che mi escono quando faccio partire la pagina :


    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.mysite.com/htdocs/manager/edit.php on line 101

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.mysite.com/htdocs/manager/edit.php on line 109

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.mysite.com/htdocs/manager/edit.php on line 113

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.mysite.com/htdocs/manager/edit.php on line 114

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.mysite.com/htdocs/manager/edit.php on line 115

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.mysite.com/htdocs/manager/edit.php on line 116

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.circuitolinks.com/htdocs/manager/edit.php on line 117

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.circuitolinks.com/htdocs/manager/edit.php on line 118

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.circuitolinks.com/htdocs/manager/edit.php on line 119

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.circuitolinks.com/htdocs/manager/edit.php on line 120

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.circuitolinks.com/htdocs/manager/edit.php on line 121

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.circuitolinks.com/htdocs/manager/edit.php on line 122









    Ecco il codice :







    <?
    require('error_inc.php');
    require('config_inc.php');

    $id=intval($id);

    if($REQUEST_METHOD=="POST"){
    if(isset($edit)){
    if($name==""){
    die($err[3]);
    }
    $name=htmlspecialchars($name);
    $query = "select * from ".$t_main." where name=\"".$name."\" and id!=".$id;
    $result = MYSQL_QUERY($query);
    if(mysql_num_rows($result)!=0){
    die($err[9]);
    }
    @mysql_free_result($result);
    if($title==""){
    die($err[3]);
    }
    $title=htmlspecialchars($title);
    if($email==""){
    die($err[3]);
    }
    $email=htmlspecialchars($email);
    if($unsafe_credits==""){
    die($err[3]);
    }
    $unsafe_credits=intval($unsafe_credits);
    if($total_credits==""){
    die($err[3]);
    }
    $total_credits=intval($total_credits);
    if($url==""){
    die($err[3]);
    }
    if($pass==""){
    die($err[3]);
    }
    $pass=htmlspecialchars($pass);

    if($sel[1]==""){
    $er[]=$err[6];
    $flag=false;
    }
    if($sel[2]==""){
    $er[]=$err[6];
    $flag=false;
    }
    if($sel[3]==""){
    $er[]=$err[6];
    $flag=false;
    }
    if($sel1[1]==""){
    $er[]=$err[6];
    $flag=false;
    }
    if($sel1[2]==""){
    $er[]=$err[6];
    $flag=false;
    }
    if($sel1[3]==""){
    $er[]=$err[6];
    $flag=false;
    }

    $links=trim(htmlspecialchars($links));
    $query="update ".$t_main." set title=\"".$title."\",fio=\"".$fio."\", country=\"".$country."\", url=\"".$url."\" , email=\"".$email."\" ,name=\"".$name."\" , unsafe_credits=".$unsafe_credits.", total_credits=".$total_credits." , pass=\"".$pass."\" , links=\"".$links."\" where id=".$id;
    if(!@mysql_query($query)){
    die($err[6]);
    }

    $query="delete from ".$t_idm_id." where idm=".$id;
    if(!@mysql_query($query)){
    print $err[6];
    }
    $query="delete from ".$t_w_idm_id." where idm=".$id;
    if(!@mysql_query($query)){
    print $err[6];
    }
    for($i=1;$i<=3;$i++){
    $query="insert into ".$t_idm_id." set idm=".$id.", id=".intval($sel[$i]);
    if(!@mysql_query($query)){
    print($err[6]);
    }
    }
    for($i=1;$i<=3;$i++){
    $query="insert into ".$t_w_idm_id." set idm=".$id.", id=".intval($sel1[$i]);
    if(!@mysql_query($query)){
    print($err[6]);
    }
    }
    header("location:".$ref);
    }
    }

    $query = "select id from ".$t_main.", ".$t_w_idm_id." where ".$t_main.".id=".$id." and idm=".$id." order by id";
    $result = MYSQL_QUERY($query);
    $i=1;
    while($row = mysql_fetch_array($result)){
    $cat1[$i]=$row["id"];
    $i++;
    }
    @mysql_free_result($result);
    $query = "select * from ".$t_main.", ".$t_idm_id." where ".$t_main.".id=".$id." and idm=".$id." order by id";
    $result = MYSQL_QUERY($query);
    $i=1;
    while($row = mysql_fetch_array($result)){
    $cat[$i]=$row["id"];
    $i++;
    }
    $name=mysql_result($result,0,"name");
    $fio=mysql_result($result,0,"fio");
    $country=mysql_result($result,0,"country");
    $email=mysql_result($result,0,"email");
    $url=mysql_result($result,0,"url");
    $title=mysql_result($result,0,"title");
    $pass=mysql_result($result,0,"pass");
    $total_credits=mysql_result($result,0,"total_credi ts");
    $unsafe_credits=mysql_result($result,0,"unsafe_cre dits");
    $links=mysql_result($result,0,"links");
    @mysql_free_result($result);
    require('header_adm.php');
    ?>
    <script language="JavaScript">
    <!--
    function show_det(id) {
    newWindow=window.open('det.php?id='+id,'picname',' width=600,height=530,scrollbars=1');
    }
    //-->
    </script>
    <form name="form1" method="post" action="">
    <input type="hidden" name="ref" value="<?print $HTTP_REFERER;?>">
    <table width="550" border=1 cellspacing=0 cellpadding=5 bordercolor="#FFFFFF">
    <tr>
    <td width="40%" align="right" class="text">User Name:</td>
    <td align="left" class="text">
    <input type="text" name="fio" size="40" value="<?print $fio;?>">
    </td>
    </tr>
    <tr>
    <td width="40%" align="right" class="text">Your E-mail:</td>
    <td align="left" class="text">
    <input type="text" name="email" size="40" value="<?print $email;?>">
    </td>
    </tr>
    <tr>
    <td width="40%" align="right" class="text">Web Site URL:</td>
    <td align="left" class="text">
    <input type="text" name="url" size="40" value="<?print $url;?>">
    </td>
    </tr>
    <tr>
    <td width="40%" align="right" class="text">Link Title:</td>
    <td align="left" class="text">
    <input type="text" name="title" size="40" value="<?print $title;?>">
    </td>
    </tr>
    <tr>
    <td width="200" align="right" class="text">Your Country:</td>
    <td align="left" class="text" width="450">
    <input type="text" name="country" size="40" value="<?print $country;?>">
    </td>
    </tr>
    <tr>
    <td width="200" align="right" class="text" valign="top">Your website Category:</td>
    <td align="left" class="text" width="450">
    <?
    $query = "select * from ".$t_cat." order by id";
    $result = MYSQL_QUERY($query);
    $i=0;
    while($row = mysql_fetch_array($result)){
    $ch["id"][$i]=$row["id"];
    $ch["title"][$i]=$row["title"];
    $i++;
    }?>
    <select name="sel[1]">
    <?
    $siz=$i;
    for($i=0;$i<$siz;$i++){
    ?>
    <option value="<?
    print $ch["id"][$i];
    ?>
    " <?if($ch["id"][$i]==$cat[1]){print "selected";}?>>
    <?
    print $ch["title"][$i];
    ?>
    </option>
    <?
    }
    ?>
    </select>
    <select name="sel[2]">
    <?
    for($i=0;$i<$siz;$i++){
    ?>
    <option value="<?
    print $ch["id"][$i];
    ?>
    " <?if($ch["id"][$i]==$cat[2]){print "selected";}?>>
    <?
    print $ch["title"][$i];
    ?>
    </option>
    <?
    }
    ?>
    </select>
    <select name="sel[3]">
    <?
    for($i=0;$i<$siz;$i++){
    ?>
    <option value="<?
    print $ch["id"][$i];
    ?>
    " <?if($ch["id"][$i]==$cat[3]){print "selected";}?>>
    <?
    print $ch["title"][$i];
    ?>
    </option>
    <?
    }
    ?>
    </select>
    </td>
    </tr>
    <tr>
    <td width="200" align="right" class="text" valign="top">Target Category: where do you want your link to be displayed:</td>
    <td align="left" class="text" width="450">
    <select name="sel1[1]">
    <?
    for($i=0;$i<$siz;$i++){
    ?>
    <option value="<?
    print $ch["id"][$i];
    ?>
    " <?if($ch["id"][$i]==$cat1[1]){print "selected";}?>>
    <?
    print $ch["title"][$i];
    ?>
    </option>
    <?
    }
    ?>
    </select>
    <select name="sel1[2]">
    <?
    for($i=0;$i<$siz;$i++){
    ?>
    <option value="<?
    print $ch["id"][$i];
    ?>
    " <?if($ch["id"][$i]==$cat1[2]){print "selected";}?>>
    <?
    print $ch["title"][$i];
    ?>
    </option>
    <?
    }
    ?>
    </select>
    <select name="sel1[3]">
    <?
    for($i=0;$i<$siz;$i++){
    ?>
    <option value="<?
    print $ch["id"][$i];
    ?>
    " <?if($ch["id"][$i]==$cat1[3]){print "selected";}?>>
    <?
    print $ch["title"][$i];
    ?>
    </option>
    <?
    }
    ?>
    </select>

    <?
    @mysql_free_result($result);
    ?>
    </td>
    </tr>

    <tr>
    <td width="40%" align="right" class="text">Unsafe credits you have earned</td>
    <td align="left" class="text">
    <input type="text" name="unsafe_credits" size="4" value="<?print $unsafe_credits;?>">
    </td>
    </tr>
    <tr>
    <td width="40%" align="right" class="text">Total credits you have left</td>
    <td align="left" class="text">
    <input type="text" name="total_credits" size="4" value="<?print $total_credits;?>">
    </td>
    </tr>
    <tr>
    <td width="40%" align="right" class="text" valign="top">Links in linksbox

    http://URL|Title
    http://URL2|Title2 </td>
    <td align="left" class="text">
    <textarea name="links" cols="40" rows="5"><?print $links;?></textarea>
    </td>
    </tr>
    <tr>
    <td width="40%" align="right" class="text">User Name:</td>
    <td align="left" class="text">
    <input type="text" name="name" size="15" value="<?print $name;?>">this is used for login propose
    </td>
    </tr>
    <tr>
    <td width="40%" align="right" class="text" valign="top">New Password</td>
    <td align="left" class="text">
    <input type="textfield" name="pass" size="15" value="<?print $pass;?>">
    </td>
    </tr>
    <tr>
    <td width="40%" align="right" class="text" valign="top"></td>
    <td align="left" class="text">
    <input type="submit" name="edit" value="Edit">
    </td>
    </tr>
    <tr>
    <td align="right"> </td>
    <td align="right"> [ back ] </td>
    </tr>
    <tr>
    <td align="right"> </td>
    <td align="right"> [ statistics ] </td>
    </tr>
    </table>
    </form>
    <?
    require('footer_adm.php');



    ?>
    <? die/(mysql_error()) ?>













    Spero possiate aiutarmi !

  5. #5
    Se sei in hosting forse hanno fatto dei miglioramenti alla sicurezza mettendo la direttiva del php.ini register_globals = Off
    per cui se una var.le l'hai mandata via POST la puoi solo prendere tramite $_POST['TUA_VAR.LE']

    quindi

    if ($REQUEST_METHOD=="POST")
    {
    if(isset($_POST['edit']))
    {
    if ($_POST['name']=="")
    {
    die($err[3]);
    }
    ....................

    Prova

  6. #6
    dimenticavo:

    if ($_SERVER['REQUEST_METHOD'] ........

  7. #7
    puoi ricapitolare il codice completo ?
    non riesco ad implementarlo....

  8. #8
    Purtroppo ora nn ho tempo, però il concetto è questo tutto quello che tu invii via POST si trova nell'array superglobale $_POST

    Quindi se via post hai inviato ad esempio la variabile prova questa si trova in $_POST['prova']

    Quindi:


    if ($_SERVER['REQUEST_METHOD']=="POST")
    {
    //Se sei qui vuol dire che hai fatto il submit ad un form che usa il metodo POST

    if (isset($_POST['edit'])) //Questa istruzione vuol dire Se esiste la variabile edit tra quelle che
    { //hai inviato con il form
    if ($_POST['name']=="")
    {
    die($err[3]);
    }
    ............

    Non è difficile il concetto: tutto le variabili inviate con il form con il metodo POST le trovi in $_POST

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.