Jump to content

only one

Members
  • Posts

    437
  • Joined

  • Last visited

    Never

Posts posted by only one

  1. yea i think it should work the only thing is when you are checkning if it already exists when you are creating a new one

     

    you might want to use the mysql_num_rows(); function to count how many of thing exists, then if($get_title > 0){ echo "already exists"; } else insert it...

     

  2. i cobe my webasite with includes, like,

    include("$page.php");

     

    the only problem is when a page doesnt exist i get an error like

    Warning: main(the page.php): failed to open stream: No such file or directory in the place.php on line 1...

     

    is there any way of stoping this from happening without haveing to do a big long list of if's or make up every page possible

  3. [b]ill get you started
    what you want is something that stores the time someone sterted downloading something in a database,
    let them fill in a form that lets them select their connection speed, then find out a sort of avarage download time

    now you want something like[/b]
    [code]
    <?
    //current time
    $currenttime = date(YmdHis); // visit 'http://nl2.php.net/date'
    //their ip
    $ip=$_SERVER['REMOTE_ADDR'];
    //calculations
    $downloadtime = $currentime + their avarge download time;
    //insert it into your database
    mysql_query(INSERT INTO downloaders `downloadtime`, `ip` VALUES '$downloadtime', '$ip');
    ?>[/code]

    [b]then i dont know how your site works but heres the code for retrieving it[/b]

    [code]<?
    //retreive stuff from databse
    $time = date(YmdHis) + 50; //gives them 50 minutes from the hour to download it, if its any greater than 10 past the hour this doesnt always work very well, but this is only very basic....
    $query = mysql_query("SELECT downloadtime FROM dowloaders WHERE downloadtime > $time") or die(mysql_error());
    $row = mysql_fetch_array($query);
    //allows no more than 10 peaople at once to download it
    $num_rows = mysql_num_rows($query);
    if($num_rows>10){ echo "currently unavailable"; }
    else { echo "<a href=download url>Click here to download</a>"; }
    ?>[/code]

    [b][color=red]this wont work![/color][/b]
  4. everyone starts from somewhere....

     

    first you want to make a field

     

    just call you first field "field" or something

    type a number into the Length/Values* textfield id recommend 255 for now, this lets you only use up to 255 characters or numbers in your field wen you put something inside it "dont touch anything else yet", you can now create you table.

     

    now that you have created a table with a field in it look along the top for a tab saying "insert"

     

    type something into the textbox and click "go", this will insert a row into your table inside the database

     

    there are alot of things fields can do, first of all the different types,

    "varchar" lets any characters and numbers including <>!"£$%^&*(){}[]#/\| can be inserted into the field

    "tinyint" just means, a few numbers

    "text" lets you use as much of anything that you want, if you use text you dont need any lengths or values

    youll get to know the rest as you use them

    dont ask me what attributes are for because i never use them myself

    NULL just means weather the feild is left blank or if it has a deafault (put it on "NOT NULL" it doesnt really make a difference)

    the "Default**" just means that everytime theres a new row made that feild automatically gets the thing you want put into it automatically

    the Extra usually uses an auto_increasement function, this can only be enabled if that feild is the primary key (note: there can only be one primary key) if you put it one auto_increasement id advise you to put the feild type on int, this only allows numbers to be used in the feild, the auto increasement function lets makes the every new row automatically get +1, eg: if you use an id for something like a user id, everyone that registers will automatically get a new id,

    thats most of the basics

     

    hope you understand, if you dont mail me ;)

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