Zorg`s Posted October 28, 2008 Report Share Posted October 28, 2008 <? if(isset($_POST['prece'])) { if ($_POST['prece'] == '1') { $links = './dooring/playline_web_lietas.zip'; } elseif ($_POST['prece'] == '2') { $links = '/SHOP/dooring/acc.rar'; } elseif ($_POST['prece'] == '3') { $links = '/SHOP/dooring/unban.rar'; } elseif ($_POST['prece'] == '4') { $links = '/SHOP/dooring/nick.rar'; } } elseif ($_POST['prece'] == '5') { $links = '/dooring/unban.rar'; } elseif ($_POST['prece'] == '6') { $links = '/dooring/nick.rar'; } $code = $_POST["kods"]; $price = 'cena'; //izvelas kodu datubazi, lai parbauditu, vai kods ir derigs $con = mysql_connect("localhost","root","parole"); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db("shop", $con); if (!$db_selected) { die (mysql_error()); } //parbauda vai der [b]if(mysql_result(mysql_query("SELECT COUNT(*) FROM code WHERE code = '$code'"),0,'COUNT(*)') > 0){[/b] echo "<b><body background-color:#C0C0C0><br>Kods ir derīgs! Lejupielādēt vari <a href='$links'>šeit</a>!"; } else{ echo "<script>alert('Nepareizs kods!');window.back()</script>"; unset($code); exit(); } $delete = "DELETE FROM code WHERE code = '$code'"; mysql_query($delete) or die(mysql_error()); mysql_close(); ?> It kā šeit ir kļūda, tikai nesaprotu, kas Būtu labi, ja kāds palīdzētu. Warning: mysql_result():supplied argument is not a valid MySQL result resource in .... on line 82 Link to comment Share on other sites More sharing options...
Norek Posted October 28, 2008 Report Share Posted October 28, 2008 mysql_result ir lēns. PHP <? $sSQL = mysql_query("SELECT COUNT(*) FROM code WHERE code = '".$code."' "); if( mysql_num_rows($sSQL) > 0) { } ?> Būs arī otrs variants. Nē, nebūs Link to comment Share on other sites More sharing options...
Kavacky Posted October 29, 2008 Report Share Posted October 29, 2008 Error: selektojot COUNT, rindu skaits nevar būt 0. Bet faktiski error ir iekš to, ka nemaz nevajag likt kverijā COUNT, jo tad strādās un būs zaibis. x2 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now