Jump to content

marcus

Members
  • Posts

    1,842
  • Joined

  • Last visited

Posts posted by marcus

  1. [quote author=taith link=topic=122835.msg507068#msg507068 date=1169057091]
    assuming your are variable based, it wouldnt matter where you include() it...
    if their not... you need to include() it exactly where you want the file to show.
    [/quote]

    What you're saying is

    [code=php:0]
    <?php
    //have you top part here
    //put your include filename here for content
    //put your footer here
    ?>
    [/code]
  2. What Jesirose said would work. But to make it much easier if you had more than one page and instead of including each page separately you could do something like:

    [code=php:0]
    $page = $_GET['go'];

    if(isset($page)){
      if(file_exists("$page.php")){
      include("$page.php");
      }else {
      header("Location: index.php");
      }
    }else {
    include("indexContent.php");
    }
    [/code]

    Each file name would be $page.php, say $page was contact, it would include contact.php, etc...
  3. You should check if they're blank.

    And don't put PHP tags around HTML unless you're echoing it.

    [code=php:0]
    if(!isset($varname)){
    echo "not there";
    }else {
    //query
    }
    [/code]

    Ted, if you're inserting into the database without supplying given table fields then the first field of that query would be $name in place of the id. It's best if you made the query with given values

    [code=php:0]
    $sql = "INSERT INTO table (name,email,etc) VALUES('$name','$email','$etc')";
    [/code]

    If no value is given for idea it won't go blank, but to keep that from even happening just make the id value NULL
  4. Make admin addon for a game I am making, hehe. Deleting news, the while statement is not spitting out the results.

    [code=php:0]
    //START...DELETE NEWS************
    if($act == deletenews){
    $nid = $_GET[nid];

    if(!isset($nid)){
    $sqlBB = "SELECT * FROM news ORDER BY id DESC";
    $resAA = mysql_query($sqlBB) or die(mysql_error());
    echo "<table border=0 cellspacing=3 cellpadding=2>\n";
    echo "<tr><td class=boardB align=left>News Title<td class=boardB>Author<td class=boardB>Delete Link\n";
    while($rowBB == mysql_fetch_array($resAA)){
    echo "<tr><td class=boardB align=left>$rowBB[title]<td class=boardB>$rowBB[poster]<td class=boardB><a href='admin.php?act=deletenews&nid=$rowBB[id]'>Delete News ID #$rowBB[id]</a>\n";
    }
    echo "</table>";
    }else {

    $sql = "SELECT * FROM `news` WHERE `id` =$id";
    $res = mysql_query($sql) or die(mysql_error());
    if(mysql_num_rows($res) == 0){
    error("This news article does not exist!");
    }else {

    $sql = "DELETE FROM `news` WHERE `id` =$id";
    $res = mysql_query($sql) or die(mysql_error());
    echo "This news article has been deleted!<br><a href='admin.php?act=deletenews'>Go Back</a>";
    }
    }
    }
    //END....DELETE NEWS*************
    [/code]
×
×
  • 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.