Jump to content

kiqeri

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by kiqeri

  1. Did you mean the form <form id="to-watch"> ?

    And is it calling below's javascript function?

    $(function() 
    {
    $('#to-watch').submit(function(event) {
                event.preventDefault()
                $(this).hide('fast');
                var movie_id_watch = $('#to-watch [name="MOVIE_ID_TO_WATCH"]').val();
                var user_id_watch = $('#to-watch [name="USER_ID_TO_WATCH"]').val();
                $.ajax({type: 'POST', url: 'to_play_add.php', cache: false, timeout: 10000,
                      data: {to_watch_user_id: user_id_watch, to_watch_movie_id: movie_id_watch},
                      success: function() {
                            $('#div_show_play').text('Added to your to play list').
                                  append(html).show('fast');
                      },
                      error: function() {
                            $('#div_show_play').text('There is a problem').show('fast');
                      }
                });
          });
    });

     

    as far as I know we cannot call function using that way. Sorry if I misunderstood, though.

    Guess I'm not helping  :-[

  2. I don't know if this is going to help or not, but instead of escaping from php a few times for html, why don't you just use echo instead, so the coding will look neat. Just a suggestion if you don't mind.

    Is the error said "unexpected $end" ? because you didn't tell the second problem.

    I tried to correct it and the error is because of the first 'if' isn't close (the bracket is still open).

     

    <div id="to_play"> 
    <?php
    if($rank>=1)
    {
    include"scripts/connect.php" ;
    mysql_connect('localhost',$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    $userquery_to_play = mysql_query("SELECT * FROM to_watch WHERE (to_watch_movie_id='$title') AND (to_watch_user_id='$loggedinusername')");
    
    if (mysql_num_rows($userquery_to_play) > 0) 
    {
    $user_to_play = mysql_result($userquery_to_play,$i,"to_watch_user_id");
    echo "<div><span class='rulesub'>This is in your to play list</span><br></div>";
    }
    else if($rank>=1)
    {
    include"scripts/connect.php" ;
    mysql_connect('localhost',$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    $userquery_in_rating = mysql_query("SELECT * FROM rateing WHERE (title='$title') AND (user_id='$loggedinusername')");
    }
    else 
    {
    echo "<script type='text/javascript'>";
    //  your javascript
    echo "</script>";
    echo "<form id='to-watch'>";
    echo "<input type='hidden' name='MOVIE_ID_TO_WATCH' value='<?php echo $title; ?>'>";
    echo "<input type='hidden' name='USER_ID_TO_WATCH' value='<?php echo $loggedinusername; ?>'>";
    echo "<input type='submit' value='Add to my to play list'>";
    echo "</form>";
    echo "<div id='div_show_play' class='rulesub' align='left'>";
    echo "</div>";
    
    }
    }
    ?>

     

    sorry if it doesn't help.

  3. how is the latest result? Does it giving you all the query from your database?

    Maybe it should be this:

     

    $topic = $_Get['id'];
    $result = mysql_query("SELECT * FROM students WHERE topic LIKE'%$topic%'");
    
    while($row = mysql_fetch_array($result))
      {
    echo "<tr><p>";
      echo "<th><p>" . $row['month']." " .$row['datetime']."</p></th>";
      echo"<th><p>". $row['topic'] ."</p></th>"; 
      echo "<th><p>" . $row['gender'] . "</p></th>";
      echo "<th><p>" . $row['fname'] . "   " . $row['lname'] . "</p></th>";
      echo "<th ><p>" . $row['id'] . "</p></th>";
      echo "</tr>";
      
    echo "</table>";

     

    Because if the $result is $result = mysql_query("SELECT * FROM students)

    then the looping will fetch all the array because your $result doesn't have condition.

     

     

×
×
  • 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.