Zorg Posted October 28, 2008 Report Share Posted October 28, 2008 (edited) <? 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 Edited October 28, 2008 by Zorg Link to comment Share on other sites More sharing options...
andrisp Posted October 28, 2008 Report Share Posted October 28, 2008 Kaut kādus šķībus parametrus padod mysql_query() fjai. Apskati manuāli. Link to comment Share on other sites More sharing options...
Java Posted October 28, 2008 Report Share Posted October 28, 2008 Laikam querijs nav neko atgriezis! Padevi pareizu kodu caur post? Link to comment Share on other sites More sharing options...
andrisp Posted October 28, 2008 Report Share Posted October 28, 2008 Java, tikai tāpēc, ka kverijs neko neatgriež, kļūda netiktu izmesta. Link to comment Share on other sites More sharing options...
Java Posted October 28, 2008 Report Share Posted October 28, 2008 andrisp, kas vainas parametriem? string mysql_result ( resource $result , int $row [, mixed $field ] ) resource mysql_query ( string $query [, resource $link_identifier ] ) Ja nu vienīgais link_identifier padod - to variabli $con Link to comment Share on other sites More sharing options...
Java Posted October 28, 2008 Report Share Posted October 28, 2008 andrisp es visu nakti strādājis, nu lai pamēģina cilvēks padot otru parametru mysql_query() , kurš ir šai gadījumā $con Link to comment Share on other sites More sharing options...
andrisp Posted October 28, 2008 Report Share Posted October 28, 2008 Laikam pārskatījos. Iepriekš man likās, ka viņam tas 0 un COUNT tiek padots mysql_query(). Jāizmanto mysql_error(), lai skaidri redzētu, kas par vainu. Link to comment Share on other sites More sharing options...
Java Posted October 28, 2008 Report Share Posted October 28, 2008 Es ieteiktu vispirms izpildīt to pašu vaicājumu pa taisno datubāzē! (phpmyadmin?) Link to comment Share on other sites More sharing options...
andrisp Posted October 28, 2008 Report Share Posted October 28, 2008 Java, db atmetīs kļūdu tieši tāpat kā to parādītu mysql_error(). ;) Link to comment Share on other sites More sharing options...
Zorg Posted October 28, 2008 Author Report Share Posted October 28, 2008 Negribu iztraucēt jūsu čatu, tikai īsti nepieleca, kas man jālabo Link to comment Share on other sites More sharing options...
Java Posted October 28, 2008 Report Share Posted October 28, 2008 andrisp - protams, bet tas ir ir ātrāks veids kā pārliecināties - Ctrl+C un Ctrl+V un nospiezt pogu "Execute query" :D Link to comment Share on other sites More sharing options...
andrisp Posted October 28, 2008 Report Share Posted October 28, 2008 Negribu iztraucēt jūsu čatu, tikai īsti nepieleca, kas man jālabo Mēs jau tev pateicām kā pārbaudīt, kur problēma. Link to comment Share on other sites More sharing options...
Java Posted October 28, 2008 Report Share Posted October 28, 2008 Zorg - tev ir phpmyadmin? Ja ir, tad palaid tur pats savu queriju! Link to comment Share on other sites More sharing options...
bubu Posted October 28, 2008 Report Share Posted October 28, 2008 Zorg: lūdzu pacenties izdomāt sakarīgāku topika nosaukumu (un izlabo to ar). Help ir absolūti bezjēdzīgs un nederīgs nosaukums. Link to comment Share on other sites More sharing options...
Recommended Posts