Jump to content

bravo14

Members
  • Posts

    296
  • Joined

  • Last visited

Posts posted by bravo14

  1.  

    <script type="text/javascript">
                $(document).ready(
                  function() {
                  $('#mtxStory_en').blur(function(){
    
            var intro = $("#mtxStory_en").html().split("<br>")[0];
            alert (intro);
            $('#mtxIntro_en').html(intro);
    
    
    });
    });
    </script>
    

     

    the html for the textareas

     

    <table>
    <tr> 
    <td width="150" class="label">Headline</td>
    <td class="content"> <input name="txtHeadline_en" onBlur="setIdentifier_en();" type="text" class="box" id="txtHeadline_en" size="50" maxlength="100"></td>
    </tr>
    <tr> 
    <td width="150" class="label">Story</td>
    <td class="content"> <textarea name="mtxStory_en" cols="200" rows="90" class="editor" id="mtxStory_en"></textarea></td>
    </tr>
    <tr> 
    <td width="150" class="label">Identifier</td>
    <td class="content"><input name="txtIdentifier_en" type="text" id="txtIdentifier_en" class="box"> </td>
    </tr>
    <tr> 
    <td width="150" class="label">Introduction</td>
    <td class="content"><textarea name="mtxIntro_en" cols="70" rows="4" class="box" id="mtxIntro_en"></textarea></td>
    </tr>
    </table>
    
  2. Changed it to jQuery using the following

     

    <script type="text/javascript">
    $(document).ready(
    function() {
                 $('#mtxStory_en').blur(function(){
    
            var what = $(this).html();
            alert (what);
            $('#mtxIntro_en').html(what);
    
    
    });
    });
    </script>
    

     

    but the textarea with the id mtxIntro_en doesn't populate and I don't get any errors displayed in firebug.

  3. I am trying to populate a textarea with the text up to the first <br> tag in a html editor using the code below.

     

     

    <script>
    function setIntro_en() {
        var title = document.getElementById('mtxStory_en').html();
        alert (title);
        var title = title.split('<br>')[0];
        alert(title);
            <!--document.getElementById('mtxIntro_en').value = title; -->
    }
    </script>
    

     

    I am getting an error saying 'document.getElementById(...).html is not a function'

     

     

  4. I am using the following code

     

    foreach ($fbdata->data as $post )
    {
    $posts .= '<li>';
    $posts .= '<p>' . $post->message . '</p>';
    $posts .= date('d-M-y', strtotime($post->created_time));
    $posts .= '</li>';
    }

     

    and if the message propeerty doesn't exist I get the message above.

     

    Any ideas on the best way to fix this?

  5. Hi all

     

    I am using the following rewrite rule

     

     

    RewriteRule ^news([a-z0-9_-]+)/([a-z0-9_-]+)(/)?$ news.php?id=$1&identifier=$2
    

     

    when I use the link generated I get a 404 Not Found but if I go the genuine URL e.g. www.jasondoyle69.com/news.php?id=[id]&identifier=[identifier], then the page is displayed correctly.

     

    My question is, how do I do the rewrite rule for this, where there two php variables?

     

  6. Hi all

     

    I am using media queries in my css to create a responsive site, when I view the site on a mobile, the site responds as I intend it to.

     

    However if I view it on a desktop and resize the screen, it doesn't respond as I would like, the idea is, if I resize  the desktop version enough then I will view the mobile version.

     

    in one css file I have

     

     

     
    @media screen and(max-width: 1024px) {
     
    css styles
     
    }
    

     

    and then on another file, I have the following, the idea with this is when I get below the specified screen size the items don't show

     

     

    @media screen and (min-width: 1024px) {
     
    }
    

     

    if you need any more info let me know.

     

    Thanks

     

    Mark

  7. Hi all

     

    i am using the code below, but am getting the error

     

    Object of class mysqli_result could not be converted to int

     

     

    <?php
      $sql="SELECT lng,lng_prefix FROM tbl_languages where active = 1";
      $result=mysqli_query($dbConn, $sql)or die(mysqli_error($dbConn)); //problem line
      if(mysqli_num_rows($result==1)){
          ?>
    

     

    The code continues with what I want to happen based on the result.

     

    What does the error mean and how do I fix it?

  8. Hi guys

     

    I am using the code below to show distinct months using one query then for each month I am trying to show a list of fixtures for the month, the problem I have is only one month is showing.

     

    where am i going wrong?

     

     

    <?php
    //find distinct months
    $sql="SELECT DISTINCT MONTH( match_date ) AS
    MONTH FROM tbl_fixtures
    WHERE season_id =$current_season
    UNION SELECT DISTINCT MONTH( match_date ) AS
    MONTH FROM tbl_gp
    WHERE season_id =$current_season";
    $result=mysqli_query($dbConn, $sql);
    if(mysqli_num_rows($result)>0){
        while($row=mysqli_fetch_assoc($result)){
            $month=$row['MONTH'];
            echo '<div class="fixtureMonth">
                  <h2>'.$months[$month].'</h2>
                  </div>
                  <div class="fixtures">';
                  //find fixtures for month
            $sql="SELECT Opposition, match_date, competition, tbl_clubs.club_name AS club, image, HomeAway, team, opposition_points, points
            FROM tbl_fixtures
            INNER JOIN tbl_clubs ON tbl_fixtures.club = tbl_clubs.club_id
            WHERE season_id =$current_season and MONTH(match_date)=$month
            UNION SELECT Opposition, match_date, \"SGP\" AS competition, \"SGP\" AS club, \"sgp.png\" AS image,  \"\" as HomeAway, \"\" as team, \"\" as opposition_points, points
            FROM tbl_gp
            WHERE season_id =$current_season and MONTH(match_date)=$month
            ORDER BY match_date";
            $result=mysqli_query($dbConn,$sql)or die(mysqli_error($dbConn));
            if(mysqli_num_rows($result)==0){
                echo no_fixtures_found;
            }
            else{
                echo '<table class="fixturesTable">';
                while($row=mysqli_fetch_assoc($result)){
                    echo'<tr>
        <td>'.date("d-M-Y",strtotime($row['match_date'])).'</td>
              <td><img src="'.$shopConfig['url'].'images/'.$row['image'].'"/></td>
              <td>'.$row['Opposition'].'</td>
              <td>'.$row['HomeAway'].'</td>
              <td><b>'.$row['team'].'</b>-'.$row['opposition_points'].'</td>
              <td>'.$row['team'].'</td>
              </tr>';
                }
                echo '</table>';
            }
            echo '</div>';
        }
        
    }
    ?>
    
  9. Hi guys

     

    I am trying to echo a database record, the record is stored in polish and is stored ok.  When I am echoing the data I am using the utf8_encode($row['headline'])

     

    However some of the characters are showign as ? the charset of the page is set to

     

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

     

    Is there anything else I am missing or anything else may be causing the problem.

     

     

  10. Hi Guys

     

    I am using media queries to set a different CSS if a mobile device.  I am using 100% width on certain containers but the styling is using 100% based on the landscape orientation and not whichever way the device is being displayed.

     

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>

     

    .slicknav_menu{

    visibility:visible;
    position:fixed;
    top:0;
    width:100%;
    z-index:100;
    }
     
    as mentioned, this uses the landscape width even if the site is being displayed in portrait.
     
    How can I fix this?
  11. I am using the following css

     

     

    .content {
        min-height: 850px;
        color: #CCC;
        padding-right: 320px;
        background-image:url(../images/wheelie.png);
        background-repeat: no-repeat;
        background-position: right bottom;
    }
    

    however the background image only shows in the desktop version of safari, I have checked firefox and chrome and mobile safari.

     

    I can't see why.

  12. I have had a go and come up with the following query

     

     

    SELECT  COUNT( `points` ) AS `rides`, SUM( `points` ) AS `pts`, SUM(IF(`points`=3,1,0)) AS `wins`, SUM(IF(`points`=2,1,0)) AS `2`,
    SUM(IF(`points`=1,1,0)) AS `1`, SUM(IF(`points`=0,1,0)) AS `0`,  rider_name
    FROM tbl_heat
    WHERE card_id = 38
    GROUP BY `rider_name` 
    ORDER BY pts DESC, wins desc, `2` desc, `1` desc, `0` desc, (select * from tbl_heat a, tbl_heat b WHERE a.heat = b.heat AND a.card_id= 38 order by points desc)
    LIMIT 8
    

     

    However I am not getting any result at all

  13. Hi all

     

    Going to try and explain this as best as I can.

     

    I currently have a query that sorts a list of records by number of points, then wins, 2nd places, 3rd places etc, the query is as follows

     

     

    SELECT  COUNT( `points` ) AS `rides`, SUM( `points` ) AS `pts`, SUM(IF(`points`=3,1,0)) AS `wins`, SUM(IF(`points`=2,1,0)) AS `2`,
    SUM(IF(`points`=1,1,0)) AS `1`, SUM(IF(`points`=0,1,0)) AS `0`,  rider_name
    FROM tbl_heat
    WHERE card_id = 38
    GROUP BY `rider_name` 
    ORDER BY pts DESC, wins desc, `2` desc, `1` desc, `0` desc
    LIMIT 8
    

     

    this query has resulted in this result

     

    '5','15','5','0','0','0','Jaroslaw Hampel'
    '5','11','3','1','0','1','Greg Hancock'
    '5','11','2','2','1','0','Andreas Jonsson'
    '5','11','2','2','1','0','Matej Zagar'
    '5','10','2','2','0','1','Chris Holder'
    '5','9','1','3','0','1','Fredrik Lindgren'
    '5','8','2','0','2','1','Krzystof Kasprzak'
    '5','7','1','2','0','2','Tai Woffinden'
     
    What I need to do is if all of these fields are the same for multiple rows I need to sort those by their result in the same heat.
     
    I have a table called tbl_heat, and it contains the following fields
     
    card_id, heat, rider_name, points
     
    So where card_id and heat are the same I need to find which out of the riders on equal points etc scored the most in that heat.
     
    for example in the example above Matej Zagar and Andreas Jonsson would be the other way round based on their heat result.
    Hope that makes sense.
     
    Let me know if you need me to clarify any of this, hard one to try and explain.
  14. Hi Guys

     

    I have a number of arrays that are posted from a form

     

    They are

    $home_rider

    $order

    $away_rider

    $awayorder

     

    for each home rider I want to to action the following query

     

    "INSERT INTO tbl_lg_rider_order (`name`,`card_id`,`homeaway`,`riderorder`) VALUES ('$homerider',$card_id,'h','$homeorder')"

     

    and for each away rider I want to do the following

     

    "INSERT INTO tbl_lg_rider_order (`name`,`card_id`,`homeaway`,`riderorder`) VALUES ('$awayrider',$card_id,'a','$awayorder')"

     

    I am using the following code

     

     

    $i=0;
    for($i){
    $homerider=$home_rider[$i];
    $homeorder=$order[$i];
    $homesql="INSERT INTO tbl_lg_rider_order (`name`,`card_id`,`homeaway`,`riderorder`) VALUES ('$homerider',$card_id,'h','$homeorder')";
    echo $homesql;
    $i++;
    }
    $i=0;
    for($i){
    $awayrider=$away_rider[$i];
    $awayorder=$awayorder[$i];
    $homesql="INSERT INTO tbl_lg_rider_order (`name`,`card_id`,`homeaway`,`riderorder`) VALUES ('$awayrider',$card_id,'a','$awayorder')";
    echo $awaysql;
    $i++;
    }
    

     

    I am getting an error saying Parse error: syntax error, unexpected ')', expecting ';'

     

    Where am I going wrong?

  15. Hi

     

    I am trying to use mail(), but when I try it i am not receiving the email.  Code is as follows

     

    $username=$_POST['username'];
    $email=$_POST['email'];
    $password=$_POST['password'];
    //email user
    $from='registrations@ispeedwayscores.com';
    $to=$email;
    $subject='Thank you for registering at iSpeedwayScores';
     $message ='<html> 
      <body bgcolor="#000000" style="color:#FF9900; font:Verdana, Arial, Helvetica, sans-serif"> 
        <center> 
        
            <h1>Welcome to iSpeedwayScores</h1> <br/> 
            <p>Hi!</p> <br> 
            <p>Thank you for joining iSpeedwayScores, this is your <b>FREE</b> online speedway scorecard site.</p>
    <p>Your login details are provided below:</p>
        Username: '.$username.'<br/>
    Password: '.$password.'<br/> 
          <p>We hope you enjoy using the site, if you do, please tell others, if not please tell us</p>
     
     <h3>iSpeedwayScores</h3>
      </body> 
    </html>'; 
       //end of message 
        $headers  = "From: $from\r\n"; 
        $headers .= "Content-type: text/html\r\n"; 
     
        //options to send to cc+bcc  
        $headers .= "Bcc: mark@bravo14.co.uk"; 
     
        // now lets send the email. 
        if(mail($to, $subject, $message, $headers)){
    $message=" Message sent successfully";
    $regsuccess = "Message sent successfully";
    }
    else{
    $message=" Message not sent";
    $regfailure ="Message not sent";
    }
    
     
    Although I get the Message sent successfully notification on screen.
  16. I have tried the query above and get the following result

     

    rider_name  rides                  pts  pos  Troy Batchelor 7 20 16 Niels-Kristian Iversen 7 16 9 Peter Kildemand 7 15 1 Greg Hancock 7 11 13 Jaroslaw Hampel 6 10 14 Darcy Ward 6 9 8 Tai Woffinden 6 9 11 Michael Jepsen Jensen 6 8 6 Krzysztof Kasprzak 5 7 10 Matej Zagar 5 7 3 Andreas Jonsson 5 6 5 Nicki Pedersen 5 5 2 Martin Smolinski 5 5 15 Fredrik Lindgren 5 4 4 Kenneth Bjerre 5 3 12 Chris Harris 5 3 7 Mikkel Michelsen 1 0

    17

     

    The pos field should be the order as the rows are displayed above so Troy Batchelor 1, Niels Kristian Iversen 2 etc etc

  17. I have a query at the moment that gives a name, number of rides and number of points

     

     

    SELECT  COUNT( `points` ) AS 'rides', SUM( `points` ) AS 'pts', rider_name
    FROM tbl_heat
    WHERE card_id = $card
    GROUP BY `rider_name`
    ORDER BY pts DESC
    

     

    what I want to do now is add the position in a league table, I have tried amending the query and have the following

     

     

    SELECT @serial := @serial +1 AS pos, rider_name
    FROM(
    SELECT  COUNT( `points` ) AS 'rides', SUM( `points` ) AS 'pts', rider_name
    FROM tbl_heat
    JOIN (
    
    SELECT @serial :=0
    ) AS init
    WHERE card_id = $card
    GROUP BY `rider_name`
    ORDER BY pts DESC
    ) as sorted
    

     

    however this query doesn't give what I am after, not sure how far off getting it right, any help would be great

  18. Hi

     

    I have a database table containing 'european' names e.g.Roman Čejka

     

    To echo this on a page I have used

     

     

    <?php echo utf8_encode($gp_row['reserve2']);?>
    

     

    However the Č is still showing as '?', any ideas what I am doing wrong?

  19. Hi

     

    I have an AJAX call that populates a select menu based on the selection from a previous menu.  All works on on desktop browser, Safari, Firefox IE etc, however when using iOS the second select menu isn't populating.

     

    the AJAX request is as follows

     

     

    <script>
    function getXMLHTTP() { //fuction to return the xml http object
            var xmlhttp=false;
            try{
                xmlhttp=new XMLHttpRequest();
            }
            catch(e)    {
                try{
                    xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch(e){
                    try{
                    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                    }
                    catch(e1){
                        xmlhttp=false;
                    }
                }
            }
    
            return xmlhttp;
        }
    
    
    
        function getTeam(strURL) {
    
            var req = getXMLHTTP();
    
            if (req) {
    
                req.onreadystatechange = function() {
                    if (req.readyState == 4) {
                        // only if "OK"
                        if (req.status == 200) {
                            document.getElementById('away-team').innerHTML=req.responseText;
                        } else {
                            alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                        }
                    }
                }
                req.open("GET", strURL, true);
                req.send(null);
            }
    
        }
            function getGP(strURL) {
    
            var req = getXMLHTTP();
    
            if (req) {
    
                req.onreadystatechange = function() {
                    if (req.readyState == 4) {
                        // only if "OK"
                        if (req.status == 200) {
                            document.getElementById('gp').innerHTML=req.responseText;
                        } else {
                            alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                        }
                    }
                }
                req.open("GET", strURL, true);
                req.send(null);
            }
    
        }
    </script>
     
     
    

     

    and the trigger for it...

     

    <select name="year" class="txtfield" onChange="getGP('find_gp_ajax.php?season='+this.value)">
    

     

    Any ideas why the call won't work on iOS?

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