Jump to content
php.lv forumi

Mysql_error.


Zorg

Recommended Posts

<?
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 by Zorg
Link to comment
Share on other sites

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

×
×
  • Create New...