Jump to content
php.lv forumi

sms shop problema


Snaip3Rs

Recommended Posts

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in C:\hack\AppServ\www\shops\smscw.php on line 82

 

<html>
<head>
<!-- right click start -->
<script>
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
return false;
}
function mousehandler(e){
var myevent = (isNS) ? e : event;
var eventbutton = (isNS) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
</script>
<!-- right click end -->
<style type="text/css">
body { font-family: Tahoma, "Lucida Grande", 'Trebuchet MS', verdana, arial, sans-serif; font-size: 12px;background-color:#C0C0C0; }
img { border: 0; }
table { text-align: left; }
a:visited { color: #FFSDFG; }
input { margin-left: 5px; margin-top: 3px; margin-bottom: 3px; background: url(images/inpbg.jpg); border: 0; padding: 2px; border: 1px solid #b6b6b6; font-size: 10px; }
</style>
<title>SHOP!</title>
<link rel="stylesheet" href="styles.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

	</head> 		
<body>
<style type="text/css">
body { font-family: Tahoma, "Lucida Grande", 'Trebuchet MS', verdana, arial, sans-serif; font-size: 12px;background-color:#C0C0C0; }
img { border: 0; }
table { text-align: left; }
a:visited { color: #2291FF; }
input { margin-left: 5px; margin-top: 3px; margin-bottom: 3px; background: url(images/inpbg.jpg); border: 0; padding: 2px; border: 1px solid #b6b6b6; font-size: 10px; }
</style>
<br>
<?
if(isset($_POST['prece'])) {

		if ($_POST['prece'] == '1') {
			$links = './dooring/playline_web_lietas.zip';

		}
		elseif ($_POST['prece'] == '2') {
			$links = '/shops/dooring/mape.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","1991jz9969470");
if (!$con)
 {
 die('Could not connect: ' . mysql_error());
 }
$db_selected = mysql_select_db("db", $con);
if (!$db_selected) {
   die (mysql_error());
}
//parbauda vai der
if(mysql_result(mysql_query("SELECT COUNT(*) FROM code WHERE code = '$code'"),0,'COUNT(*)') > 0){
	echo "<b><body background-color:#C0C0C0><br>Kods ir derigs lejupladet vari te. <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();
?>

Link to comment
Share on other sites

sākumā

 

$db_selected = mysql_select_db("db", $con);

seit kur ir "db" tur ieliec datubazi kur tev viss glabaajas,otra izveido datubazee fieldu code un id , id liec autoacigrment un trešais

82 rindiņu ieleic šādu!

 

if(mysql_result(mysql_query("SELECT COUNT(*) FROM code WHERE code = '$code'"),0,'COUNT(*)') > 0){

 

vajdzētu strādāt tagad gan!

Link to comment
Share on other sites

pag, iedosu visu to smscw failu.

 

reku ieleic sito tikai saliec konektaaciju mysql kaa tev vajag:

 

http://paste.php.lv/74bb14f9d55a9971cdccdc99c5ed47a8?lang=php

 

un to ko tev vajag mainit tad šeit:

 

//izvelas kodu datubazi, lai parbauditu, vai kods ir derigs
$con = mysql_connect("localhost","tavs niks","tava parole");
if (!$con)
 {
 die('Could not connect: ' . mysql_error());
 }
$db_selected = mysql_select_db("code", $con);

 

ieadi tur kur ie localhost tur atstaaj ja tu testee uz pc, tur kur ir tavs niks tur ganjau root, paroli liec mysql paroli un lejaa

$db_selected = mysql_select_db("code", $con);

kur ir "code" tur liec datubaaz.

 

ja strādā tad uzraksti, ja ne tad meiginaasu palidzet kkadiigi .

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...