Jump to content

rhodesa

Staff Alumni
  • Posts

    5,253
  • Joined

  • Last visited

Posts posted by rhodesa

  1. is there a field in the DB you can sort by? like an auto_increment id? assuming it's called script_id, you would just do:

    <select name="script" id="script">
    <option value="" selected>- Script -</option>
    <?php
    //Include connection
    include("conn.php");
    
    $sql = "SELECT DISTINCT(script) FROM scripts ORDER BY script_id DESC";
    $result = mysql_query($sql); 
    while($row = mysql_fetch_array($result)) {
    ?>
    <option value="<? echo $row["script"]; ?>"><? echo $row["script"]; ?></option>
                           <?
    }
    ?>                 
    </select>

  2. how about:

    <select name="script" id="script">
    <option value="" selected>- Script -</option>
    <?php
    //Include connection
    include("conn.php");
    
    $sql = "SELECT DISTINCT(script) FROM scripts";
    $result = mysql_query($sql); 
    while($row = mysql_fetch_array($result)) {
    ?>
    <option value="<? echo $row["script"]; ?>"><? echo $row["script"]; ?></option>
                           <?
    }
    ?>                 
    </select>

  3. to elaborate...the parent would look like:

    <input type="button" value="Open Child" onclick="child_win = window.open('child.html');">
    <input type="button" value="Alter Child" onclick="child_win.document.getElementById('child_ele').innerHTML = 'Here is the new text';">

    and the child like this:

    <p id="child_ele">Here is some text before</p>

  4. you are defining all the code in a function, but never executing the function...it should be more like this:

     

    //check total size of directory and set variable $totalsize
    function dir_size($dir) {
    $totalsize=0;
    if ($dirstream = @opendir($dir)) {
    while (false !== ($filename = readdir($dirstream))) {
    if ($filename!="." && $filename!="..")
    {
    if (is_file($dir."/".$filename))
    $totalsize+=filesize($dir."/".$filename);
    
    if (is_dir($dir."/".$filename))
    $totalsize+=dir_size($dir."/".$filename);
    }
    }
    }
    closedir($dirstream);
    return $totalsize;
    }
    
    $totalsize = dir_size($dir);

  5. ok...couple of things....

     

    first: you don't set $totalsize...it's in your function, but not in your script

     

    second: after any header() call, you should always have an exit; to make sure the script doesn't keep working:

    if(($_FILES["user_file"]["size"] > 2097153))
    {
      header ('Location: upload_errorsize.php');
      exit;
    }

    ...do that for all your header()s

     

    third: make sure you sql is working by changing this:

    $result2 = mysql_query($query,$link);

    to this:

    $result2 = mysql_query($query,$link) or die (mysql_error($link));

     

    fourth: these lines are redundant and should be removed since it already happens at the top:

      $link=mysql_connect($hostname, $adminuser, $adminpass) or die("couldnt connect to database");
      mysql_select_db("$database") or die("Could not select database");
    

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