v2.5.2
Giriş yap

Jquery Aktif Pasif Buton (Mysql)

gumushikmet
1,281 defa görüntülendi

Merhaba arkadaşlar;
Mysql de veri kayıtı yapıldığı zaman (0-1) sayfadaki butonun (veya link) aktif olmasını jquery ile yapmaya çalıyorum.
Yardımcı olabilirseniz sevinirim. Teşekkürler.

gumushikmet
1884 gün önce

Arkadaşlar tekrar merhaba,
Sorunumu çözdüm, belki benim gibi acemi arakaşlarında bir gün işine yarar diye kodu yazıyorum.

<?php require_once('Connections/connect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {

$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {

case "text":
  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  break;    
case "long":
case "int":
  $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  break;
case "double":
  $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  break;
case "date":
  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  break;
case "defined":
  $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  break;

}
return $theValue;
}
}

mysql_select_db($database_connect, $connect);
$query_rapor = "SELECT * FROM rapor where id =84";
$rapor = mysql_query($query_rapor, $connect) or die(mysql_error());
$row_rapor = mysql_fetch_assoc($rapor);
$totalRows_rapor = mysql_num_rows($rapor);
?>

<!DOCTYPE html>
<html>
<head>

<title>Rapor Onay</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" ></script>
 

</head>
<body>

<button type="button" id="buton" >Rapor yaz </button>

<script type="text/javascript">

$sayi=<?php echo $row_rapor['durum']; ?>

deneme=($sayi);

if (deneme==1)

{
document.getElementById("buton").disabled = false;
}

else
{

document.getElementById("buton").disabled = true;

}
</script>

</body>
</html>
<?php
mysql_free_result($rapor);
?>