Jump to content

pengu

Members
  • Posts

    154
  • Joined

  • Last visited

    Never

Posts posted by pengu

  1. Amazing, thought someone would respond by now.

     

    Anyways, I've got this far (see code). But it's not loading my pages into the DIV.

    Works firefox.

    No go Chrome.

     

    <!DOCTYPE html>
    <html>
    <head>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
            $('.spLink').click(function(e) {
                    e.preventDefault();
                    var href = $(this).attr('href');
                    $('.spResult').load(href);
    			//alert(href);
            });
    });
    
    </script>
    </head>
    <body>
    
    <h1>Test</h1>
    <p><a href="./test.html" class="spLink">Click</a></p>
    <p><a href="test2.html" class="spLink">Click</a></p>
    <p><a href="test3.html">Click</a></p>
    
    <div class="spResult">
    </div>
    
    </body>
    </html>
    

  2. First off, I hope I've posted this in the correct spot.

    Apologies if I have not.

     

    All I want is a couple of links, lets say 1 2 and 3, they're all href links that lead to some page, but they have an "id" within the HREF.

    So when I click them, I want them to load the results into a div, not just load another page.

     

    What I have so far..

    <!DOCTYPE html>
    <html>
    <head>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript">
    	$("#spLink").click(function(){
    		$("#spResult").html(ajax_load).load();
    	});
    </script>
    </head>
    <body>
    
    <h1>Test</h1>
    <p><a href="test.html" id="spLink">Click</a></p>
    <p><a href="test2.html" id="spLink">Click</a></p>
    <p><a href="test3.html" id="spLink">Click</a></p>
    
    <div id="spResult">
    </div>
    
    </body>
    </html>
    

     

    Help!

  3. Hi,

     

    I'm trying to figure out how to get some numbers out of a string.

     

    Example of strings

    $string1 = "3-tech";
    $string2 = "109-bobby";
    $string3 = "4-Charlie1994";
    $string4 = "55-Mr-Smith";
    

     

    What I want to do is grab everything BEFORE the "-" and the first dash.

    I'm having a brain meltdown atm and just can't figure it out, I know it's something simple.

  4. In this case you either do what I mentioned above, or query your database for the data on a 'as needed' basis. This is common practice. Simply storing a heap of information in some kind of global configuration is not a good idea for security and performance reasons.

     

    Thanks for your help.. but I disagree about security.

    Performance I'm not quite sure.

     

    Will wait to see what others say.

  5. I can't post too much.. sorry.

    Basically vBulletin is able to do something as following.

     

    somepage.php

    <?PHP
    
       include "globals.php"; //can't remember what it is exactly called..
    
    echo $vbulletin->userinfo["userid"];
    echo $vbulletin->userinfo["posts"];
    
    //etc etc
    
    ?>
    

     

    Now I have my own database, seperate to vBulletin, full of information that I need.. lets say its a shopping cart as an example, basically wont something the same as this vbulletin to have like, I don't know a count of how many items are in "my" shopping cart.

     

    I hope this helps.

  6. you could just do this upon user login and store it in the session?

     

    I could, but then I'd have a million things in sessions.

    I also want something dynamic, so if the database changes, say more items are added, the sessions wont reflect this change.. unless set again.

  7. Hi guys,

     

    I'm just curious as to how I would go about to create a "globals.php" page much similar to the one vBulletin uses just as an example.

    I have some ideas but I'm not 100% sure.

    In my mind it works sort of like this.

     

    - Do a query to grab all relevant data for the user

    - Put it in an array

    - Take data from array .. $array['user'] (example)

     

    Could anyone tell me if I'm waaaaaaaaay off and if so offer some guidance, links perhaps?

     

    Thank you! :)

  8. I swear I had read a tutorial on this site, but I must be mistaken as I can't find it.

     

    I did some googling on it.. but not to happy with the tutorials.  Just wondering if someone could point me in a better direction.

     

    I'm wondering if I can take advantage of these.  Like if I put these in a "config" file that is called on every PHP page and I have 2 or 3 SQL queries that I always want to run, a SELECT and UPDATE (maybe a delete).  I could call these at will.. right?  Without having to rewrite the query a million times?

     

    Any help is most appreciated.

  9. As said above. Names are wrong.

     

    Keep in mind you're uploading your files to a PUBLIC forum.  You should ALWAYS ALWAYS, change your usernames/passwords in files you upload.

     

    <label>Username: </label><input type="text" style="height: 1em;" size="15" name="username" required> <--! this should be username.. not password -->
    <br>
    <label>Password: </label><input type="password" style="height: 1em;" size="15" name="passWord" required>
    

  10. Hey guys,

     

    I'm working on a little image thingy.  What I want to do, is use a URL such as ,

     

    Grab data from it, put the into variables and create an image with the data.

     

    I read the tutorial on this website and sort of got stuck.. with external XML files, ALSO this doesn't look like your normal XML file.

    Here is the code I have thus far.. I got stuck at the 'playerstats' part..

     

    <?php
    
    $rss = new SimpleXMLElement('http://steamcommunity.com/profiles/76561197968575517/stats/L4D2/?xml=1', null, true);
    
    
    
    foreach($rss->xpath('playerstats') as $item)
    
    {
    
            echo <<<EOF
    
            <p> {$item->steamID64} <br />
    
            {$item->hoursPlayed} </p>
    
    
    
    EOF;
    
    }
    
    ?>
    

  11. Also..

     

    <form method='post' action='pay2.php'>
    First Name: <input type='text' name='first' value="<?php echo ($_POST['first']); ?>"  <br/>
    Last Name: <input type='text' name='last' value="<?php echo ($_POST['last']); ?>" <br/>
    Hours of Work: <input type='text' name='hours' value="<?php echo ($_POST['hours']); ?>" <br/>
    Hourly Pay Rate: <input type='text' name='rate' value="<?php echo ($_POST['rate']); ?>" <br/>
    <input type='submit' value='submit'>
    </form>
    

     

    This is wrong, the VALUES should be like 'first', 'last', 'hours' etc etc..

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