そのため、Mysql の許可テーブルで新しい番号を取得すると、シーン選択ページが自動的に更新されるように、このシステムに取り組んできました。ログイン用の Php と、メンバー テーブルの許可行の番号を取得するための Php が正常に動作しています。
私の問題はJqueryにあります(昨日使い始めました:p)このphpドキュメントに接続するスクリプトの先頭にJquery Ajax接続を追加しました:
connect.php :
<?php
mysql_connect($dbhost, $dbuser, $dbpass);
//Select Database
mysql_select_db($dbname) or die(mysql_error());
// Retrieve data from Query String
//this selects everything for the current user, ready to be used in the script below
$result = mysql_query("SELECT * FROM members WHERE username = '".$_SESSION['Username']."' LIMIT 1");
//this function will take the above query and create an array
//with the array created above, I can create variables (left) with the outputted array (right)
while($row = mysql_fetch_array($result)) { var_dump($row); $permission = $row['permission']; }
echo '<u><b>Permision ID:</b></u> - - No:' .$permission ;
?>
ログインしてからその公園に行くと、すべてのデータが完全に呼び出されます。問題は JQuery にあると思います。
index.php - JQuery:
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$.ajax({
url:'connect.php',
datatype:"application/json",
type:'get',
data: 'q='+permission,
success:function(data){
count('#result').append(html);
},
error:function(){
// code for error
}
});
if (['permission'] = '1') {
$('#middle').load(function() {
$('#Scene1').fadeIn('slow', function() {
// Animation complete
});
});
}
//2,3,4,5,6 ommited
});
}
if (['permission'] = '7') {
$('#middle').load(function() {
$('#Scene7').fadeIn('slow', function() {
// Animation complete
});
});
}
//-->
</script>
そのスクリプトは、データベース内の番号がシーンの番号と同じ場合に表示スタイルを継承するように設定する必要があります。
背景を説明するために、これが私のシーンです。
#Scene1 :
<div id="middle">
<ul id="Scene1" style="display:none;">
<h2 id="unlocked">Act One</h2>
<li id="navi3"><a href="#"><img src="Images/Scene-one-unlocked-unpressed.png" alt="Scene One completed" height="255px" width="340px"/></li></a>
<img id="arrow"
src="Images/Right-Arrow.png"
height="80px"
width="120px"/>
<li id="navilockedr"><img src="Images/Scene-two-locked.png" alt="Scene Two locked" height="255px" width="340px"/></li>
<img id="banner"
src="Images/crime-scene-banner.png"
height="5px"
width="900px"/>
<h2 id="locked">Act Two</h2>
<li id="navilockedl"><img src="Images/Scene-three-locked.png" alt="Scene three locked" height="255px" width="340px"/></li>
<img id="arrow"
src="Images/Right-Arrow.png"
height="80px"
width="120px"/>
<li id="navilockedr"><img src="Images/Scene-four-locked.png" alt="Scene four locked" height="255px" width="340px"/></li>
<img id="banner"
src="Images/crime-scene-banner.png"
height="5px"
width="900px"/>
<h2 id="locked">Act Three</h2>
<li id="navilockedl"><img src="Images/Scene-five-locked.png" alt="Scene five locked" height="255px" width="340px"/></li>
<img id="arrow"
src="Images/Right-Arrow.png"
height="80px"
width="120px"/>
<li id="navilockedr"><img src="Images/Scene-six-locked.png" alt="Scene six locked" height="255px" width="340px"/></li>
</ul>
私の構文が正しいかどうか、または「connect.php」への接続に失敗しただけかどうかわからないため、JQueryに熟練した人が私を正しい方向に向けることができるかどうか疑問に思っていました。