Warning: mysql_fetch_array(): supplied argument is not a val
Scris: Vin Ian 28, 2011
nu inteleg ce este gresit in aceasta pagina ...
imi da Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource .. in linia 50 , adica la linia asta
am inteles ca ori nu exista tabelul , sau nu contine date ori nu am configurat bine... tabelul exista , date exista si cred ca e configurat bine.. o idee aveti ?
Cod: Selectaţi tot
<?
if($session->logged_in){
$id = $_GET['id'];
$sql="SELECT * FROM `biletul_zilei` WHERE ultimul_bilet=".$id."";
$r=mysql_query($sql);
while($row = mysql_fetch_array($r)){
if($session->username == $row['3']){
switch($_GET['r'])
{
case '':
echo '<table cellpadding=10 cellspacing=10>';
echo '<form action=edit.php?r=updated method=post>';
echo '<tr><td>';
echo '<FONT COLOR="#8B0000">Data pariului :</FONT>';
echo '</td>';
echo '<td>';
echo '<select name=zi value="'.$row['0'].'">';
echo '<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
<option value=8>8</option>
<option value=9>9</option>
<option value=10>10</option>
<option value=11>11</option>
<option value=12>12</option>
<option value=13>13</option>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
<option value=17>17</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
<option value=21>21</option>
<option value=22>22</option>
<option value=23>23</option>
<option value=24>24</option>
<option value=25>25</option>
<option value=26>26</option>
<option value=27>27</option>
<option value=28>28</option>
<option value=29>29</option>
<option value=30>30</option>
<option value=31>31</option></select>-';
echo '<select name=luna value="'.$row['1'].'">';
echo 'option value=1>Ian</option>
<option value=2>Feb</option>
<option value=3>Mar</option>
<option value=4>Apr</option>
<option value=5>Mai</option>
<option value=6>Iun</option>
<option value=7>Iul</option>
<option value=8>Aug</option>
<option value=9>Sept</option>
<option value=10>Oct</option>
<option value=11>Nov</option>
<option value=12>Dec</option></select>-';
echo '<select name=an value="'.$row['2'].'">';
echo '<option value=2011>2011</option>
<option value=2012>2012</option>
<option value=2013>2013</option>
<option value=2014>2014</option>
<option value=2015>2015</option>
<option value=2016>2016</option>
<option value=2017>2017</option>
<option value=2018>2018</option>
<option value=2019>2019</option>
<option value=2020>2020</option></select>';
echo '</td></tr>';
echo '<tr><td>';
echo '<FONT COLOR="#8B0000">Casa de pariuri :</FONT>';
echo '</td>';
echo '<td>';
echo '<input name=casa value='.$row['4'].'>';
echo '</td>';
echo '</table>';
echo '<table cellpadding=10 cellspacing=10>';
if(strlen($row[6])>0) echo '<tr><td><b>Eveniment nr.1 :<input name=eveniment11 size=7 value='.$row[6].'> vs. <input name=eveniment12 size=7 value='.$row[7].'></b></td><td>Pronostic :<input name=pronostic1 value='.$row[26].'><br>Cota: <input name=cota1 value='.$row[36].'></td></tr>';
if(strlen($row[8])>0) echo '<tr><td><b>Eveniment nr.2 :<input name=eveniment21 size=7 value='.$row[8].'> vs. <input name=eveniment22 size=7 value='.$row[9].'></b></td><td>Pronostic :<input name=pronostic2 value='.$row[27].'><br>Cota: <input name=cota2 value='.$row[37].'></td></tr>';
if(strlen($row[10])>0) echo '<tr><td><b>Eveniment nr.3 :<input name=eveniment31 size=7 value='.$row[10].'> vs. <input name=eveniment32 size=7 value='.$row[11].'></b></td><td>Pronostic :<input name=pronostic3 value='.$row[29].'><br>Cota: <input name=cota3 value='.$row[39].'></td></tr>';
if(strlen($row[12])>0) echo '<tr><td><b>Eveniment nr.4 :<input name=eveniment41 size=7 value='.$row[12].'> vs. <input name=eveniment42 size=7 value='.$row[13].'></b></td><td>Pronostic :<input name=pronostic4 value='.$row[31].'><br>Cota: <input name=cota4 value='.$row[41].'></td></tr>';
if(strlen($row[14])>0) echo '<tr><td><b>Eveniment nr.5 :<input name=eveniment51 size=7 value='.$row[14].'> vs. <input name=eveniment52 size=7 value='.$row[15].'></b></td><td>Pronostic :<input name=pronostic5 value='.$row[33].'><br>Cota: <input name=cota5 value='.$row[43].'></td></tr>';
if(strlen($row[16])>0) echo '<tr><td><b>Eveniment nr.6 :<input name=eveniment61 size=7 value='.$row[16].'> vs. <input name=eveniment62 size=7 value='.$row[17].'></b></td><td>Pronostic :<input name=pronostic6 value='.$row[35].'><br>Cota: <input name=cota6 value='.$row[45].'></td></tr>';
if(strlen($row[18])>0) echo '<tr><td><b>Eveniment nr.7 :<input name=eveniment71 size=7 value='.$row[18].'> vs. <input name=eveniment72 size=7 value='.$row[19].'></b></td><td>Pronostic :<input name=pronostic7 value='.$row[37].'><br>Cota: <input name=cota7 value='.$row[47].'></td></tr>';
if(strlen($row[20])>0) echo '<tr><td><b>Eveniment nr.8 :<input name=eveniment81 size=7 value='.$row[20].'> vs. <input name=eveniment82 size=7 value='.$row[21].'></b></td><td>Pronostic :<input name=pronostic8 value='.$row[39].'><br>Cota: <input name=cota8 value='.$row[49].'></td></tr>';
if(strlen($row[22])>0) echo '<tr><td><b>Eveniment nr.9 :<input name=eveniment91 size=7 value='.$row[22].'> vs. <input name=eveniment92 size=7 value='.$row[23].'></b></td><td>Pronostic :<input name=pronostic9 value='.$row[41].'><br>Cota: <input name=cota9 value='.$row[51].'></td></tr>';
if(strlen($row[24])>0) echo '<tr><td><b>Eveniment nr.10 :<input name=eveniment101 size=7 value='.$row[24].'> vs. <input name=eveniment102 size=7 value='.$row[25].'></b></td><td>Pronostic :<input name=pronostic10 value='.$row[43].'><br>Cota: <input name=cota10 value='.$row[53].'></td></tr>';
echo '</table>';
echo '<table cellpadding=10 cellspacing=10>';
echo '<tr><td><FONT COLOR="#8B0000">Miza :</FONT>';
echo '<input name=miza value='.$row[46].'>';
echo '</td></tr>';
echo '</table>';
echo '<input type=submit value=Modifica>';
echo '</form>';
break;
case 'updated':
$zi = $_POST['zi'];
$luna = $_POST['luna'];
$an = $_POST['an'];
$eveniment11 = $_POST['eveniment11'];
$eveniment12 = $_POST['eveniment12'];
$eveniment21 = $_POST['eveniment21'];
$eveniment22 = $_POST['eveniment22'];
$eveniment31 = $_POST['eveniment31'];
$eveniment32 = $_POST['eveniment32'];
$eveniment41 = $_POST['eveniment41'];
$eveniment42 = $_POST['eveniment42'];
$eveniment51 = $_POST['eveniment51'];
$eveniment52 = $_POST['eveniment52'];
$eveniment61 = $_POST['eveniment61'];
$eveniment62 = $_POST['eveniment62'];
$eveniment71 = $_POST['eveniment71'];
$eveniment72 = $_POST['eveniment72'];
$eveniment81 = $_POST['eveniment81'];
$eveniment82 = $_POST['eveniment82'];
$eveniment91 = $_POST['eveniment91'];
$eveniment92 = $_POST['eveniment92'];
$eveniment101 = $_POST['eveniment101'];
$eveniment102 = $_POST['eveniment102'];
$pronostic1 = $_POST['pronostic1'];
$cota1 = $_POST['cota1'];
$pronostic2 = $_POST['pronostic2'];
$cota2 = $_POST['cota2'];
$pronostic3 = $_POST['pronostic3'];
$cota3 = $_POST['cota3'];
$pronostic4 = $_POST['pronostic4'];
$cota4 = $_POST['cota4'];
$pronostic5 = $_POST['pronostic5'];
$cota5 = $_POST['cota5'];
$pronostic6 = $_POST['pronostic6'];
$cota6 = $_POST['cota6'];
$pronostic7 = $_POST['pronostic7'];
$cota7 = $_POST['cota7'];
$pronostic8 = $_POST['pronostic8'];
$cota8 = $_POST['cota8'];
$pronostic9 = $_POST['pronostic9'];
$cota9 = $_POST['cota9'];
$pronostic10 = $_POST['pronostic10'];
$cota10 = $_POST['cota10'];
$casa = $_POST['casa'];
$miza = $_POST['miza'];
$query="UPDATE `biletul_zilei` SET zi='$row[0]', luna='$row[1]', an='$row[2]', casa='$row[4]', pronostic1='$row[26]',pronostic2='$row[27]',pronostic3='$row[28]',pronostic4='$row[29]',pronostic5='$row[30]',pronostic6='$row[31]',pronostic7='$row[32]',pronostic8='$row[33]',pronostic9='$row[34]',pronostic10='$row[35]', cota1='$row[36]', cota2='$row[37]', cota3='$row[38]', cota4='$row[39]', cota5='$row[40]', cota6='$row[41]', cota7='$row[42]', cota8='$row[43]', cota9='$row[44]', cota10='$row[45]',eveniment11='$row[6]', eveniment12='$row[7]', eveniment21='$row[8]', eveniment22='$row[9]', eveniment31='$row[10]', eveniment32='$row[11]', eveniment41='$row[12]', eveniment42='$row[13]', eveniment51='$row[14]', eveniment52='$row[15]', eveniment61='$row[16]', eveniment62='$row[17]', eveniment71='$row[18]', eveniment72='$row[19]', eveniment81='$row[20]'', eveniment82='$row[21]', eveniment91='$row[22]', eveniment92='$row[23]', eveniment101='$row[24]', eveniment102='$row[25]', miza='$row[46]' WHERE ultimul_bilet=".$id."";
$checkresult = mysql_query($query);
if ($checkresult) {
echo "Modificare efectuata";
} else {
echo "Modificare neefectuata";
}
mysql_close();
break;
}
}
else {
echo "Nu esti autorul acestui pariu pentru a-l edita.";
}
}
}
else {
echo "Nu esti logat";
}
?>
Cod: Selectaţi tot
while($row = mysql_fetch_array($r)){