Jump to content


  • Posts

  • Joined

  • Last visited


Posts posted by Gast

  1. I have never seen a double $ used like that. The only time I can think of two $ being used next to each other is if you echoing a US price next to a variable:

    $price = "100.00";
    echo "The price is \$$price";
  2. [quote author=Daniel0 link=topic=99746.msg393514#msg393514 date=1152361150]
    There is also a setting in php.ini called 'upload_max_filesize'. It's default value is '2M'. You can change it by running the following command in your upgrade script:
    [code]ini_set('upload_max_filesize','whatever size you want');[/code]

    Also, check the POST_MAX_SIZE which is similar to the above. It needs to be roughly the same as UPLOAD_MAX_FILESIZE.
  3. Try this:

    $result = mysql_query("SELECT R_RoomAvailiability FROM Room WHERE R_ID = ".$R_ID." LIMIT 1") or die(mysql_error());
    $row = mysql_fetch_assoc($result);  //<---error is here for some reason
    $R_RoomAvailability = $row['SELECT R_RoomAvailiability'];
    echo $R_RoomAvailability;
  4. Thanks, Ken.

    When I added the [b]echo $rw3['choco_name'];[/b] part, it echoes the name of the animal three times. This is not right, it has the number of stables right, but it should only echo the name once.

    Any other ideas?

    $q1 = "Select * from choco_stables";
    $rs1 = mysql_query($q1) or die("Problem getting stables, query: $q1<br>" . mysql_error());
    while ($rw1 = mysql_fetch_assoc($rs1)) {
        if ($rw1['stable_user'] > 0) { // or however you test for an owned stable
            $q2 = "select * from users where user_id = " . $rw1['stable_user'];
            $rs2 = mysql_query($q2) or die("Problem getting owner of stable, query: $q2<br>" . mysql_error());
            $rw2 = mysql_fetch_assoc($rs2);
            $q3 = "select * from choco_chocobos where choco_owner = " . $rw2['user_id'];
            $rs3 = mysql_query($q3) or die("Problem getting animal, query: $q3<br>" . mysql_error());
            if (mysql_num_rows($rs3) > 0) { // This person owns an animal
                $rw3 = mysql_fetch_assoc($rs3);
    echo $rw3['choco_name'];
    //          more code associated with the animal
    //          more code associated with the owner of the stable

  5. Make a file called "delete.php", and in that file put the code that Kurt posted above, changing the table and field names to work with your database.

    Then wherever you want to have the delete link/button make it go to "delete.php?id=###" where ### is the ID of that particular record. For example if you were echoing each result:

    $sql = mysql_query("SELECT * FROM guestbook ORDER by id");
    while($row = mysql_fetch_assoc($sql)) {
        echo "<a href='delete.php?id=".$row['id']."'>Delete record</a><br />";

    That should help :P
  6. Sorry, I misunderstood. That may help above, though.

    Yes, I have one table which stores the users, simply [b]users[/b], which contains the usual, [i]user_id, user_name, user_email[/i].

    For the stables, the table is [b]choco_stables[/b]:
    [i]stable_id (Primary), stable_user (Foreign)[/i]

    Obviously the "stable_user" relates to the "user_id".

    And finally the actual animals, is the table [b]choco_chocobos[/b]:
    [i]choco_id (Primary), choco_owner (Foreign), choco_level, choco_name...[i]

    Hopefully that may be a little more helpful. :)
  7. Sure, below is the PHP code. I apologise if it is a little confusing...

    function showStables($user_id) {

    // Check if user has any stables to start with
    $sql = mysql_query("SELECT * FROM choco_stables WHERE stable_user = ".$user_id." ORDER BY stable_id") or die(mysql_error());

    // Number of stables...
    $numStables = mysql_num_rows($sql);

    // If no stables...
    if($numStables == 0) {

    <div style='width:515px; padding:5px; background-color:#EFEFEF; border:1px solid #999999;'>
    You do not have any stables. In order to look after your Chocobos, you will need to purchase one. However, as it is your first one, we will give you one for <b>free</b>, but in the future, if you want more, it will cost you <b>2,500 gil</b> for each one!<br />
    <input type='button' class='submits' style='width:200px; margin-top:15px; margin-bottom:15px; font-size:14px; background-image:url(images/orange_fade.jpg); font-weight:bold' value='Get My First Stable' />

    // Already have some stables...
    } else {

    // Start variables...
    $counter = 1;
    $per_row = 2;
    $stableCount = 1;

    // Start table...
    $temp = '<table align="center" width="400" border="0" cellspacing="0" cellpadding="0" style="background-image:url(images/stable_floor.gif)">';

    while($row = mysql_fetch_assoc($sql)) {

    $stableLeft = rand(1, 3);
    $stableRight = rand(4, 6);

    if($counter == 1) {
    $temp .= "<tr>";

    if(($stableCount % 2) == 1) {
    $temp .= '<td width="200" valign="top" class="stable" style="background-image:url(images/stable_background_'.$stableLeft.'.gif);">';
    // Here is where each animal will be displayed on the left...
    $temp.= '</td>';
    } else {
    $temp .= '<td width="200" valign="top" class="stable" style="background-image:url(images/stable_background_'.$stableRight.'.gif);">';
    // Here is where each animal will be displayed on the right...
    $temp.= '</td>';

    if($counter == $per_row) {
    $temp .= "</tr>";
    $counter = 1;
    } else { 

    // Increase counter


    if($counter != 1) { 

    while($counter <= $per_row) { 

    // Odd number of stables?
    if(($numStables % 2) == 1) {
    $temp .= '
    <td valign="top" class="stable" style="background-image:url(images/stable_background_dull_right.gif);">
    $temp .= "</tr>";



    $temp .= "</table>";




  8. I know it sounds stupid, but let me explain.

    For a project myself and obsidian are working on, I have come across a problem. I wont explain the whole project here but here is the problem:

    I need to display 6 "stables", in as in three rows of two. I have done this with HTML, however each user will at some point buy these "stables" so they need to be dynamic, as some of them have a different background image as they are unavailable.

    They may only have bought 3 stables, so the first two of the stables on the first row are available, and the first on the second row. This is a little hard to explain in words, so:

    Available | Available
    Available | Unavailable
    Unavailable | Unavailable

    This is all OK, I have managed to generate all the stables with some available and some unavailable depending on how many the user has bought. But here comes the problem.... The user will have an "animal" that will be in one of the stables. However, they may not have an animal in all of their available stables.

    Both the stables and animals are stored in a database, so I run the query to get the stables and in a while() loop echo the actual stables in HTML. But I need to then run the query for the "animals" to be in the stables at the same time. I dont think it is possible to run two conditions in a while() loop, and the way the HTML is constructed I cannot put the loop inside the other.

    PLEASE HELP! I can provide a link and code if needed.
  9. A simple way round is to set to value of the options to:

    [code]<option value="1|United States" style="padding-left: 20px; background: url(../img/flags/1.gif) no-repeat;" selected>United States</option>
    <option value="2|Norway" style="padding-left: 20px; background: url(../img/flags/2.gif) no-repeat;" >Norway</option>[/code]

    Now that the value is set to "1|United States" and all the others would be similar. When you submit the form, the value of the select field if it was called "country" for example:

    // The value of the countries above split by the pipe (|) character
    $country = explode("|", $_POST['country']);

    // The var $country is now an array
    $country_id = $country[0];
    $country_name = $country[1];

    // Then run your MySQL query

    Hope that helps. :)
  10. This should be moved by one of the mods to third-party scripts as it is asking for support using SMF.

    I havent used SMF before, but take a look at the database I find out the structure and then post it here, then I will be able to help you with the query.
  11. Why not use a mixture of PHP and JavaScript?

    [code]<input type="button" onclick="window.open('help.php?content=whatever');" />

    /* On the help.php popup */
    if(isset($_GET['content'])) {
        switch($_GET['content']) {
            case "abc" :
                echo "page content";
  • 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.