Jump to content

Oldiesmann

Members
  • Posts

    72
  • Joined

  • Last visited

    Never

Posts posted by Oldiesmann

  1. If you want to enclose variables in single quotes, then you either need to use double quotes for the query string or escape the single quotes. Also, <head> cannot come after <body>. Try this:

    [code]<html>
    <head>
    <link href="resultcss.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <?php
    include('config/file.php');

    if($_POST['platform'] == ''){
     
    $platform = $_GET['platform'];
    $developer = $_GET['developer'];
    $publisher = $_GET['publisher'];
    $fletter = $_GET['fletter'];
    $sortby = $_GET['sort'];
    $perpage = $_GET['perpage'];
    $order = $_GET['order'];

    }else{

    $platform = $_POST['platform'];
    $developer = $_POST['developer'];
    $publisher = $_POST['publisher'];
    $fletter = $_POST['fletter'];
    $sortby = $_POST['sort'];
    $perpage = $_POST['perpage'];
    $order = $_POST['order'];

    }

    if (!$link = mysql_connect($sqlserver, $sqlusername, $sqlpassword)) {
      echo 'Could not connect to mysql';
      exit;
    }

    if (!mysql_select_db($sqldatabase, $link)) {
      echo 'Could not select database';
      exit;
    }

    //////////////////////////////////////////////////////////

    if($fletter == '%'){
    $resource1 = mysql_query("SELECT * FROM nuke_seccont WHERE secid LIKE '$platform' AND developer LIKE '$developer' AND publisher LIKE '$publisher' ORDER BY " . $sortby . " " . $order) or die(mysql_error());
    }ELSE{
    $resource1 = mysql_query("SELECT * FROM nuke_seccont WHERE secid LIKE '$platform' AND developer LIKE '$developer' AND publisher LIKE '$publisher' AND fletter='$fletter' ORDER BY " . $sortby . " " . $order) or die(mysql_error());
    }

    $total_results = mysql_result($resource1, 0, 0);

    $total_pages = ceil($total_results / $perpage);
    $current_page = (isset($_GET['page'])) ? $_GET['page'] : 1;
    $current_offset = ($current_page - 1) * $per_page;

    echo "total pages: $total_pages<br>current page: $current_page<br>current offset: $current_offset";

    }
    ?>
    </body>
    </html>[/code]

    The rest of the code that you have after that should be fine.
  2. Can you post the exact code for the query? It looks like MATCH() and AGAINST() aren't being passed the appropriate parameters.

    See one of the following pages in the MySQL manual for more info (depending on which version of MySQL you're using):

    4.1 and lower: http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html
    5.0: http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html
    5.1: http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html
  3. Try this instead:

    [code]require_once("/home/ipetresc/public_html/arts/config.php");
    include($CONFIG['script_path'] . '/news.php');
    require_once($CONFIG['script_path'] . '/functions/functions.php');
    require_once($CONFIG['script_path'] . '/functions/mysql.php');
    require_once($CONFIG['script_path'] . '/functions/template.php');[/code]

    $CONFIG['script_path'] won't be defined until after you include the config file, and since it's the path to the FNews directory (I think), you don't need to append it to the full server path.
  4. You do have to download the smarty library, but you can put the smarty files in whatever directory you want, and you shouldn't have to modify your PHP config file as long as you tell your script where to find the smarty files (or smarty.class.php is in the same directory as the script). You can also use ini_set() to change the include_path if you want.
  5. [code]$sql = "SELECT u.*, p.* FROM users AS u, people AS p";

    if($_GET['name'] != "")
    {
    $sql .= "WHERE u.show = '1' OR p.show = '1'";
    }

    $sql .= " LIMIT $from, $mr";[/code]

    When looking at the results, remember that columns from users will be prefixed with a "u." and columns from people will be prefixed with a "p.".
  6. "HTTP request failed" most likely means it couldn't load the website. Besides - file_get_contents loads the contents into a string, not an array, so print_r wouldn't work (either use echo or print).

    What problem are you trying to solve here? It doesn't take that long to look that info up.
  7. [quote author=Barand link=topic=100564.msg397043#msg397043 date=1152890441]
    [quote author=Oldiesmann link=topic=100564.msg397037#msg397037 date=1152890124]
    Almost there :)

    [code]<?php
    $Course = array('blah1', 'blah2', 'blah3');
    $Coursearray = implode("','", $Course);      // <-- inner quotes

        $SqlQueryA = "SELECT Course_Name
                      FROM tblMeeting
                      WHERE Course_Name IN ($Coursearray)"; // <-- No quotes needed here...
    ?>
    [/code]

    Since the query statement is already in double quotes, you don't need single quotes around $Coursearray.
    [/quote]

    If you you remove those quotes the query becomes

    ....WHERE Course_Name IN ( blah1','blah2','blah3) ";

    which is now clearly wrong
    [/quote]

    For some reason I was thinking that implode("', '") would put the ' at the beginning and end as well... Not trying to cause any problems :)
  8. That's definitly more complicated than it needs to be in my opinion. Using a switch statement should simplify things tremendously:

    [code]<?php
    /* sample.php */
    require_once('functions.php');

    $valid = TRUE;

    if(isset($_POST['submit']))
    {
        foreach(array_keys($_POST) AS $key)
        {
            switch ($key) {
                case "id":
                    $valid &= LettersAndDigits($_POST['id']);
                    break;
                case "item_title": case "item_type": case "city": case "state": case "country": case "item_description": case "hit_counter":
                    $valid &= Variable($_POST[$key]);
                    break;
                case "quantity_available": case "duration": case "end_time":
                    $valid &= isDigits($_POST[$key]);
                    break;
                case "starting_bid":
                    $valid &= Dollars($_POST['starting_bid']);
                    break;
                case "bid_increment":
                    $valid &= BidIncrement($_POST['bid_increment']);
                    break;
                case "reserve_price":
                    $valid &= ReservePrice($_POST['reserve_price']);
                    break;
                case "auto_relist":
                    $valid &= isLetters($_POST['auto_relist']);
                    break;
                case "paypal_id":
                    $valid &= EmailorEmpty($_POST['paypal_id']);
                    break;
                case "submit":
                    break;
            }
        }
        if($valid)
        {
            header("Location: uploadformconfirmation.html");
            exit;
        }
    }
    ?>[/code]

    Still probably not the best way of doing things, but it's a lot simpler (note the minor change to header - you have to tell PHP that this is a location header or it won't work).
  9. Almost there :)

    [code]<?php
    $Course = array('blah1', 'blah2', 'blah3');
    $Coursearray = implode("','", $Course);      // <-- inner quotes

        $SqlQueryA = "SELECT Course_Name
                      FROM tblMeeting
                      WHERE Course_Name IN ($Coursearray)"; // <-- No quotes needed here...
    ?>
    [/code]

    Since the query statement is already in double quotes, you don't need single quotes around $Coursearray.
  10. Here's a slightly simpler version:

    [code]<?php
    // Connect to the database server...
    $connect = mysql_connect('localhost', 'username', 'password') or die("Could not connect to server!");

    // Tell MySQL which database we're working with
    $db = mysql_select_db('database', $connect) or die("Couldn't select database!");

    // Execute the query
    $query = mysql_query("
    SELECT COUNT(member.Name) AS counter, account.Name
    FROM member
    INNER JOIN account act ON act.Name = member.Name
    GROUP BY member.Name
    ") or die("Error executing query! MySQL said: " . mysql_error());

    // Display the result
    echo 'Result: ' . mysql_result($query, 0);
    ?>[/code]
  11. I use PHP Designer 2006. I stumbled across this software through php-editors.com, and haven't looked back. PHP Designer 2005 was nice, but 2006 has some improvements. My favorite part is that it actually uses proper syntax highlighting colors, which many free editors don't seem to support for some reason.

  12. [quote author=ober link=topic=99076.msg395384#msg395384 date=1152647294]
    I wonder if anyone from the SMF team is reading this......
    [/quote]

    I am...

    There are a couple of different mods that will do what akitchin has requested:

    http://mods.simplemachines.org/index.php?mod=192 - Karma description mod. This one allows the user to add a reason for each karma action, which is then displayed to the recipient of that action

    http://mods.simplemachines.org/index.php?mod=192 - Karma Log. This one logs all the karma actions. Currently doesn't work with this version of SMF, but I can always update it for you if you're interested in it.

    There's also the "Karma Wait Time" option. This lets you specify how many minutes a user must wait between consecutive karma actions. This will prevent people from sitting there smiting and/or applauding the same user over and over again.
  13. [quote author=moberemk link=topic=99052.msg391975#msg391975 date=1152112676]
    Aah. Okay, that explains that. Thanks for clearing that up for me.
    Now the only thing I don't get is why every time I post, it brings me back to the parent forum. Couldn't that maybe become some sort of option for those of us whom it merely annoys? It's a useful feature for some, but because I always browse the forum in tabs, I just don't need it around, and I'm used to being able to look over my post and make sure that I said what I meant.
    [/quote]

    Profile -> Look and Layout Preferences
    Check the box next to "Return to topics after posting by default"

    There's also a quick reply box available (in the same section - set "Use quick reply on topic display" to "Show, on by default")
×
×
  • 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.