Jump to content

aixen083

Members
  • Posts

    25
  • Joined

  • Last visited

aixen083's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. what do you this is the best way on how to solve this problem ?
  2. Sir it doesn't fix the error instead i get this error array(0) { } Notice: Undefined index: org_id
  3. Please Help me to solve my problem.. I'm having some difficulties in solving the issue please HELP me I have this code <div class="span5"> <?php $get_id = $_GET['org_id']; $oid = isset($_GET['org_id'])?$_GET['org_id']:""; $query_vote=mysql_query("select * from votes where position='President' and voters_id='$session_id'"); $count=mysql_num_rows($query_vote); $row=mysql_fetch_array($query_vote); $id=$row['vote_id']; if ($count==1){ ?> <script type="text/javascript"> jQuery(document).ready(function() { $('#delete<?php echo $id; ?>').tooltip('show'); $('#delete<?php echo $id; ?>').tooltip('hide'); }) </script> <h6>My Candidate for President</h6> <div class="none"><img class="img-polaroid" src="admin/<?php echo $row['img']; ?>" width="88" height="88"/> <a><?php echo $row['firstname']." ".$row['lastname']; ?></a> <a class="btn btn-danger" data-placement="right" id="delete<?php echo $id; ?>" title="Click to Remove" href="#<?php echo $id; ?>" data-toggle="modal"> <i class="icon-remove icon-large"> </i></a> <!---delete modal --> <?php include('delete_user_modal.php'); ?> <!---delete modal --> <?php }else{ ?> <h6>Candidate for President</h6> <?php $result = mysql_query("SELECT candidates.candidates_id, candidates.firstname, candidates.lastname, candidates.img FROM candidates INNER JOIN voters ON voters.org_id = candidates.org_id WHERE position='President' AND candidates_id='$get_id' "); while($row=mysql_fetch_assoc($result)) { $id=$row['candidates_id']; ?> <script type="text/javascript"> jQuery(document).ready(function() { $('#a<?php echo $id; ?>').tooltip('show'); $('#a<?php echo $id; ?>').tooltip('hide'); }) </script> <div class="picture"><img data-placement="bottom" id="a<?php echo $id; ?>" title="Drag the Image to the ballot Box to Vote for <?php echo $row['firstname']." ".$row['lastname']; ?>" class="img-polaroid" src="admin/<?php echo $row['img']; ?>" width="88" height="128"/> <br> <a><?php echo $row['firstname']." ".$row['lastname']; ?></a> </div> <?php } ?> <?php } ?> <div> But the problem is that im getting this error in my page Notice: Undefined index: org_id please help me and give me some advice on how to resolve this
  4. this is my login page.. <?php include('header.php'); session_start(); ?> <body data-spy="scroll" data-target=".bs-docs-sidebar"> <!-- Navbar ================================================== --> <?php include('navbar.php');?> <!-- Subhead ================================================== --> <div class="container"> <!-- Docs nav ================================================== --> <div class="row"> <div class="span6 offset3"> <!-- Dropdowns ================================================== --> <section id="dropdowns"> <div class="login"> <div class="bs-docs-example"> <div class="alert alert-info"><strong><i class="icon-user icon-large"></i> Voters Login</strong></div> <hr> <h5>Please Enter the Details Required Below</h5> <hr> <form class="form-horizontal" method="POST"> <div class="control-group"> <label class="control-label" for="inputEmail">ID Number:</label> <div class="controls"> <input type="text" name="id_number" id="inputEmail" placeholder="ID Number" required> </div> </div> <div class="control-group"> <label class="control-label" for="inputPassword">Password:</label> <div class="controls"> <input type="password" name="password" id="inputPassword" placeholder="Password" required> </div> </div> <div class="control-group"> <div class="controls"> <script type="text/javascript"> jQuery(document).ready(function() { $('#save').tooltip('show'); $('#save').tooltip('hide'); }) </script> <button data-placement="right" id="save" title="Click to Login" type="submit" name="login" class="btn btn-success"><i class="icon-signin icon-large"></i> Sign in</button> <a href="register/index.php" > Register </a> </div> <?php if (isset($_POST['login'])){ $id_number=$_POST['id_number']; $password=md5($_POST['password']); $login_query=mysql_query("SELECT voters.id_number, voters.voters_id, candidates.candidates_id, candidates.firstname, candidates.lastname, candidates.img FROM candidates INNER JOIN voters ON voters.org_id = candidates.org_id WHERE id_number='$id_number' AND password='$password' AND status='Unvoted'")or die(mysql_error()); $row=mysql_fetch_array($login_query); $login_query1=mysql_query("select * from voters where id_number='$id_number' and password='$password' and status='Voted'")or die(mysql_error()); $count1=mysql_num_rows($login_query1); $count=mysql_num_rows($login_query); $id=$row['voters_id']; if ($count > 0){ $_SESSION['id']=$id; ?> <script> window.location="vote_home.php"; </script> <?php }else if($count1 == 1){ ?> <br> <div class="alert alert-danger">You can only vote once per Organization.</div> <?php }else{ ?> <br> <div class="alert alert-danger"><strong>Access Denied!</strong> Please Check your Organization.</div> <?php } } ?> </div> </div> </form> </section> </div> </div> </div> </div> <?php include('footer.php'); ?> <?php include('script.php'); ?> </body> </html> and after that this is my vote_home.php <?php include('header.php');?> <?php include('session.php');?> <body data-spy="scroll" data-target=".bs-docs-sidebar"><?php include('navbar_home.php'); ?> <div class="container"><div class="row"><div class="span4"> <section id="dropdowns"><?php include('president.php');?></section> <section id="dropdowns"><?php include('secretary.php');?></section> <section id="dropdowns"><?php include('treasurer.php'); ?></section> </div> <div class="span3"><?php include('balot.php'); ?></div> <div id="jk" class="span4 pull-right"> <section id="dropdowns"><?php include('vice_president.php'); ?></section> <section id="dropdowns"><?php include('auditor.php'); ?></section> <section id="dropdowns"><?php include('pro.php'); ?></section> </div></div></div> <?php include('footer.php'); ?><?php include('script.php'); ?> </body> </html> now this is my president.php script <div class="span5"> <?php $query_vote=mysql_query("select * from votes where position='President' and voters_id='$session_id'"); $count=mysql_num_rows($query_vote); $row=mysql_fetch_array($query_vote); $id=$row['vote_id']; if ($count==1){ ?> <script type="text/javascript"> jQuery(document).ready(function() { $('#delete<?php echo $id; ?>').tooltip('show'); $('#delete<?php echo $id; ?>').tooltip('hide'); }) </script> <h6>My Candidate for President</h6> <div class="none"><img class="img-polaroid" src="admin/<?php echo $row['img']; ?>" width="88" height="88"/> <a><?php echo $row['firstname']." ".$row['lastname']; ?></a> <a class="btn btn-danger" data-placement="right" id="delete<?php echo $id; ?>" title="Click to Remove" href="#<?php echo $id; ?>" data-toggle="modal"> <i class="icon-remove icon-large"> </i></a> <!---delete modal --> <?php include('delete_user_modal.php'); ?> <!---delete modal --> <?php }else{ ?> <h6>Candidate for President</h6> <?php $result = mysql_query("SELECT voters.id_number, candidates.candidates_id, candidates.firstname, candidates.lastname, candidates.img FROM candidates INNER JOIN voters ON voters.org_id = candidates.org_id WHERE position='President'"); while($row=mysql_fetch_assoc($result)) { $id=$row['candidates_id']; ?> <script type="text/javascript"> jQuery(document).ready(function() { $('#a<?php echo $id; ?>').tooltip('show'); $('#a<?php echo $id; ?>').tooltip('hide'); }) </script> <div class="picture"><img data-placement="bottom" id="a<?php echo $id; ?>" title="Drag the Image to the ballot Box to Vote for <?php echo $row['firstname']." ".$row['lastname']; ?>" class="img-polaroid" src="admin/<?php echo $row['img']; ?>" width="88" height="128"/> <br> <a><?php echo $row['firstname']." ".$row['lastname']; ?></a> </div> <?php } ?> <?php } ?> <div>
  5. it works fine but it didn't get the exact i want to do.. any ways. do you have another option on how to perform this ?
  6. my bad 1st i only store 1 id number for voters.. the problem is that how the voters determine if that candidates are same org_id as the voters.org_id because
  7. the id_number, password, status are in the same column of voters table.
  8. Sir this is my 1st query i made $login_query=mysql_query("SELECT voters.voters_id, candidates.candidates_id, candidates.firstname, candidates.lastname, candidates.img FROM candidates INNER JOIN voters On voters.org_id = candidates.org_id WHERE id_number='$id_number' and password='$password' and status='Unvoted'")or die(mysql_error()); so i try to create new query in you suggestions. $login_query=mysql_query("SELECT v.voters_id, c.firstname, c.lastname, c.image FROM candidates c INNER JOIN voters v ON v.org_id = c.org_id WHERE id_number='$id_number' and password='$password' and v.voters_id = $id_number and status='Unvoted'")or die(mysql_error());
  9. No sir, only 1 organization per student and teacher.
  10. Good Day, Please help me to create a simple organisation management in php so this is the scenario, i have 3 tables (organisation, student, teacher) the simple system works fine But the problem is that adding organisation to my system. ? because before i just type it in my query WHERE org_name = 'COMTECH' to my students query and to my index query after i log in as a student how can i add organisation and create a log in that connects the student on the organisation that he is registered ? So this the example data in my database table Organisation.tbl org_id: 1 org_name: COMTECH org_description: computer fundamentals Student.tbl Teacher.tbl student_id: 1 teacher_id: 1 username: student username: teacher password: demo password: demo firstname: alvin user_type: Admin lastname: biares So right no im having hard time to solve the problem that if the organisation was created and the students are registered to that organisation the student can see only the teachers who are already registered in that organisation. ? please help me..
  11. excuse me sir what is the importance of this script/code ? $loggedInID
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.