[Q] input & $row['total']

[Q] input & $row['total']

QA

[Q] input & $row['total']

답변 1

본문

<div>
<input type="button" name="" value="버튼" onClick="aa()" >검사
</div>


<script>
function aa(){
<?php
include_once('./_common.php');
  $sql = "SELECT COUNT(*) total FROM g5_member WHERE mb_id = '$_SERVER[REMOTE_ADDR]'";
  $result = sql_query($sql);
  $row = sql_fetch_array($result);
?>
    }

alert("<?php echo $row['total']; ?>");
</script>

 

 

 

클릭하면메시지

 

 

 

알람 나오게

 

 

 

하고싶어요

 

까망눈이라.. 소스좀 알려주세요 ~~~

이 질문에 댓글 쓰기 :

답변 1

ajax 한번 검토해 보세요

https://stackoverflow.com/questions/5316697/jquery-return-data-after-ajax-call-success

<script>
function aa(){
<?php
include_once('./_common.php');
  $sql = "SELECT COUNT(*) total FROM g5_member WHERE mb_id = '$_SERVER[REMOTE_ADDR]'";
  $result = sql_query($sql);
  $row = sql_fetch_array($result);
?>
alert("<?php echo $row['total']; ?>");
    } 괄호 이동
</script>

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 37
© SIRSOFT
현재 페이지 제일 처음으로