Jump to content

aebstract

Members
  • Posts

    1,105
  • Joined

  • Last visited

Posts posted by aebstract

  1. Basically, you don't have anything yet? You'll have a database that holds your user's information. When they are logged in, you display information based on the information you pull from the database. 1 page for all users, it will look correct specific for the user, depending on what information gets pulled from the database.

  2. I don't think it would really be a "problem" off the bat, you may run in to security issues or something. I wouldn't recommend anything like that honestly, what is wrong with using post? Might want to take note of this too:

     

    Although the RFC doesn’t lay down any length-related guidelines, Internet Explorer – with its insistence on finding ways to make things difficult for us – enforces a maximum URL length of 2,048 characters.

  3. http://php.net/manual/en/function.rand.php

     

    The manual has awesome information, like this post:

     

    <?php
    // Generate a random character string
    function rand_str($length = 32, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890')
    {
        // Length of character list
        $chars_length = (strlen($chars) - 1);
    
        // Start our string
        $string = $chars{rand(0, $chars_length)};
       
        // Generate random string
        for ($i = 1; $i < $length; $i = strlen($string))
        {
            // Grab a random character from our list
            $r = $chars{rand(0, $chars_length)};
           
            // Make sure the same two characters don't appear next to each other
            if ($r != $string{$i - 1}) $string .=  $r;
        }
       
        // Return the string
        return $string;
    }
    ?>
    

  4. oops forgot semi colon

    <option <?php if ( $var == $anothervar ) { echo "SELECTED=\"SELECTED\"; } ?> value=\"lalalla.html\">lalalla

     

     

    <option <?php if ( $var == $anothervar ) { echo "SELECTED"; } ?> value=\"lalalla.html\">lalalla

     

    actually it'd be like that ;) Just needed the basic though, was stupid to not think of it. Thanks! :)

  5. Okay turned out I had a number wrong, changed it and matched up correctly. Now I get a new error though:

     

    violation of PRIMARY or UNIQUE KEY constraint "INTEG_617" on table "SOITEM"

     

     

    and with what I'm using you can't use show:

    Token unknown - line 1, column 1

    SHOW

  6. Oh man that's gonna really suck. I'm having to add a line to an order for something and I'm gonna have to track all the foreign keys down to the roots and all in sql. The database tool has a tab showing foreign keys, so I can just go by that but this should take a little while. :( There's 7 of them for this table, and I bet there's more on the others.

  7. violation of FOREIGN KEY constraint "INTEG_618" on table "SOITEM"

    Foreign key reference target does not exist

     

    INSERT INTO SOITEM (SOITEM.ID, SOITEM.PRODUCTID, SOITEM.SOID, SOITEM.TYPEID, SOITEM.STATUSID, SOITEM.UOMID, SOITEM.SOLINEITEM, SOITEM.DESCRIPTION, SOITEM.PRODUCTNUM, SOITEM.CUSTOMERPARTNUM, SOITEM.TAXABLEFLAG, SOITEM.QTYTOFULFILL, SOITEM.QTYFULFILLED, SOITEM.QTYPICKED, SOITEM.DATELASTFULFILLMENT, SOITEM.DATESCHEDULEDFULFILLMENT, SOITEM.REVLEVEL, SOITEM.REPAIRFLAG, SOITEM.TBDPRICEFLAG, SOITEM.EXCHANGESOLINEITEM, SOITEM.QBCLASSID, SOITEM.NOTE, SOITEM.SHOWITEMFLAG, SOITEM.ITEMADJUSTID, SOITEM.UNITPRICE, SOITEM.TOTALPRICE, SOITEM.ADJUSTAMOUNT, SOITEM.TOTALCOST) 
    SELECT '1459', '991', SOITEM.SOID, '20', SOITEM.STATUSID, SOITEM.UOMID, '3', 'Restocking Fee', 'Restocking Fee', SOITEM.CUSTOMERPARTNUM, SOITEM.TAXABLEFLAG, SOITEM.QTYTOFULFILL, SOITEM.QTYFULFILLED, SOITEM.QTYPICKED, SOITEM.DATELASTFULFILLMENT, SOITEM.DATESCHEDULEDFULFILLMENT, SOITEM.REVLEVEL, SOITEM.REPAIRFLAG, SOITEM.TBDPRICEFLAG, SOITEM.EXCHANGESOLINEITEM, SOITEM.QBCLASSID, SOITEM.NOTE, SOITEM.SHOWITEMFLAG, SOITEM.ITEMADJUSTID, '29.74', '29.74', SOITEM.ADJUSTAMOUNT, SOITEM.TOTALCOST
    FROM SOITEM
    WHERE SOITEM.ID = '116'
    

     

    Excuse it for being so long and seeming to be a mess, it's only going to be manually ran once and never again. What could be causing this error?

  8. Not sure if it will make a difference, but I would try this:

     

    <?php
    $array=$_POST['imgid'];
    include('config.site.php');
    foreach($array as $key=>$val){
       $q = "UPDATE galleries SET order='$val' WHERE id='$key'";
       mysql_query($q) or die(mysql_error());
    }
    
    ?>
    

  9. Yes you can use the ID as the identifier, and since it should be set to auto increment, everyone will have their own unique ID. It's actually how you should identify them. If you make other tables that need to refer to users, you can make a column called userid or something, and refer to that ID.

     

    Your second and third question tie in some php (if that's what you're using)

     

    You're gonna run a query to grab the results on login, which you may have something basic already? Should be similar to this:

    $result = mysql_query("SELECT * FROM users WHERE username='username_input' AND password='password_input'");
    
    while($row = mysql_fetch_array($result))
      {
      $userid = $row['ID'];
      }
    

     

    This is where I set my sessions, when there is a match, I grab the id and set the session with that. (I use sessions, I'm not sure how you're doing it, just mentioning this)

     

    Third question, what you wanna do is check if it is empty or not and then do something from there. So before your query you run some php tests

    if (empty($_POST['username'])){
    $username = $username;
    } else {
    $username = $_POST['username'];
    }
    

     

    Something along those lines, then your "$username" variable is set to either what it previously was, or what they want it changed to. Then run an UPDATE query on all the rows that they have options to change. There are a few ways to do it, this is how I would probably do it.

  10. TypesOfFood

    ID  Name

    1    MEAT

    2    FRUIT

    3    VEGITABLES

     

    AvailableFoods

    ID  TypeID    Name

    1    2            Apple

    2    2            Orange

    3    2            Banana

    4    2            Kiwi

    5    3            Brocoli

    6    3            Carrot

    7    1            T-Bone Steak

     

    FoodsInStock

    ID    Name

    1      Apple

    2      Apple

    3      Banana

    4      Banana

    5      Banana

    6      Banana

     

     

    SELECT *
    FROM AvailableFoods
    LEFT OUTER JOIN FoodsInStockTable
    ON AvailableFoods.Name = FoodsInStock.Name
    WHERE AvailableFoods.TypeID = '2' AND FoodsInStock.Name IS NULL
    

     

    Not sure what you're doing with the null part, but this will do it correctly. If I understand what you're trying to do anyway.

  11. I have 4 tables, 2 of the tables I have 1 row of returned information and another I will have 1+ rows and it'll be random.

     

    Part: ID - returns 1 row

    Product: partid - returns 1+ rows

    Soitem: productnum, productid, soid

    SO: ID - returns 1 row

     

    What I need to do is pull some information from soitem where (soitem.soid = so.id) and (product.id = soitem.productid)

    The thing is that I pull anywhere from 1 up towards 4 rows from product based on product.partid = part.id. I need to grab the 1 row from soitem where there is a similarity based on the results populated from soitem.soid. I hope this makes sense.

  12. I don't think it will be, but what I got so far is a query to grab a few pieces of information:

     

    SELECT so.dateissued, so.num, soitem.taxableflag, soitem.totalprice, so.shiptoname
    
    FROM so
    JOIN soitem ON so.id = soitem.soid
    
    WHERE so.taxrate > '0'
    AND so.dateissued >= '12-1-09'
    AND so.dateissued <= '12-31-09'
    AND billtozip = '95334'
    
    ORDER BY so.shiptoname, so.dateissued
    

     

    What I'm needing to do on the results, is have a total for each unique shiptoname and have it show in the results under each shiptoname's section. For this report there happens to be 3 unique shiptonames and like 50 results. Thing is I can only run 1 query and I don't think I can control the outcome enough to do it :(

  13. I think in this situation I would set it up somewhat similar to how you have it. I would have 3 tables: artist info, albums, tracks. I'm not sure what you're using "categories" for, but I think it could be used as a column in your albums tables (If I am thinking of this correctly) Inside albums, I would have a column that refers to an artist id and in the tracks I would have a column to reference to an album id. That way you can keep everything tied together. Hope this helps a bit!  ;)

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