Jump to content

lAZLf

Members
  • Posts

    89
  • Joined

  • Last visited

    Never

Posts posted by lAZLf

  1. Simplest way would be:

       echo "<td><a href='http://dracolas.comli.com/clan/profile.php?username=$username'>$username</a></td>";

     

    You see, when you did:

       echo "<td><a href="http://dracolas.comli.com/clan/profile.php?username=$username">$username</a></td>";

    the quotes in the html you want to print cut off the echo function, meaning that the URL "http://dracolas.comli.com/clan/profile.php?username=$username" is going to be cut off, which is a big syntax error.

  2. On my website, I have this column that I want to be a specific height. It just occurred to me that on firefox (i use normally use safari), the height of the column in the table is way off. Could I target which browser displays which amount of pixels?

    In safari I want it to be 200px and in firefox I want it to be 140px.

  3. It won't be the same, it will get information via database. If you want to see the code in action so far go to http://www.annarboruncovered.com/

    You'll see that with the "while" loop it takes all the information out of the database, and displays something different in each row of the table. The same concept will be with the new pages, but they will only display the "feed" i post per page, where then I will make it so that users can comment on them.

  4. I want to be able to store a whole php/html code on a variable so it would be easier for me to write it to a file.

     

    Why do you want to do that?

    If you read the code I posted, It is writing/editing files. I want to be able to write a page similar to the current one, but of course I will change it a bit. I figured it would make more sense to use a variable in the fwrite(); function.

  5. Not sure I know what you mean. What would you then do with this variable?

     

    The OP says he want to write it to a file.

     

    The easiest way to do this would be using the nowdoc syntax to specify the string, but that requires PHP 5.3.0. Any other method potentially involves a lot of escaping.

    how do you escape strings? As far as I know I haven't ever done it.

  6. I'm sure you can, but how?

    I have a page that creates a new page for every feed on it. I want to be able to store a whole php/html code on a variable so it would be easier for me to write it to a file. I'm sure this is an easy to solve problem.

    If it matters, here's the code:

    <?php
    // Connect to the database server
    mysql_connect("localhost", "xxxxx", "xxxxx") or die(mysql_error());
    
    // Open to the database
    mysql_select_db("annarbo1_Archive") or die(mysql_error());
    
    // Select all records from the "Individual" table
    $result = mysql_query("SELECT * FROM Archive ORDER BY date DESC")
    or die(mysql_error());
    session_start();
    $user = $_SESSION['valid_user'];
    ?>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>ANN ARBOR UNCOVERED - your informational destination</title>
    <link href="Level2_Verdana_Forms.css" rel="stylesheet" type="text/css" />
    <script src="hideorshow.js" type="text/javascript">
    </script>
    </head>
    
    <body>
    <div align="center">
    <div id="black"><div id="centerer">
    	<table id="slogantopnav"><tr><td id="valign"> <div id="menu">
    <div id="links">
    
    	 	  <a href="index.php" class="link"> HOME</a>  
          <a href="#" class="link"> ANN ARBOR</a>  
          <a href="#" class="link"> ABOUT</a>  
          <a href="#" class="link"> LINKS</a>  
          <a href="#" class="link"> CONTACT</a><br/>
      <a href="restaurants.php" class="link"> RESTAURANTS</a>  
          <a href="clubs.php" class="link"> CLUBS</a>  
          <a href="#" class="link"> SHOPS</a>  
          <a href="#" class="link"> STUDENT MAGAZINES</a>
          </div>
      </div>
    
      </td><td id="login">
      <?
      if (!isset($_SESSION["valid_user"])) {
    	  echo'
    	<form action="login.php" method="post">
    	<table cellspacing="0">
    	<tr><td><input type="text" name="username"width="300" value="username"/></td></tr>
    	<tr><td><input type="password" name="password"width="300" value="password"/></td></tr>
      	<tr><td><input type="submit" value="login"/></td></tr>
    	</table>
    	</form>';
      } else {
    	echo"Welcome  ".$user;
    	echo "<br>
    		 <a href='logout.php' class='link' >logout</a>";
      }
      ?>
      
      </td></tr></table>
      </div>
    
    </div>
    
    
    
    <table id="top" cellspacing="0">
    <tr height="110"><td id="landscape"><a href="index.php"><img id="img" src="header.png" /></a></td></tr>
     </table>
      <table width="900" id="main" cellspacing="0">
    
    	<tr>
          <td height="212">
      <div id="scroll">
      <table id="table" cellspacing="0">
          <?
    
    
    while($row=mysql_fetch_array($result)){
    
    $content = "hi".$row['title'];
    $file_name= $row['title'].".php";             
    $fp = fopen ($file_name, "w");
    fwrite ($fp, $content);
    fclose ($fp);
    
    echo'
    
            <tr>
              <td height="20" class="title">'.$row['title'].'</td><td class="title"><div align="right">'.$row['date'].'
    	  </div>
    	</td>
          </tr>
      
    <tr>
        <td height="100" colspan="2" class="content">'.$row['content'].'
    </td>
        </tr>
    
    <tr><td> <a href="'.$file_name.'" class="link">[comments]</a>
    </td></tr>';
    
    }
    ?>
    
        </table>
    </div>
    </td><td rowspan="2"id="sideadvert"></td>
        <tr>
          <td height="37" colspan="2"><div id="copyright" align="center">© Copyright Ittai Svidler 2009</div></td>
        </tr><tr><td id="footer" colspan="2"></td></tr>
      </table>
      
      
      
    </div>
    
    </body>
    </html>

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