Jump to content

computernerd21

Members
  • Posts

    12
  • Joined

  • Last visited

Posts posted by computernerd21

  1. Thanks for the reply. So what your saying is that vertrigo is just to test mysql and php on your computer meaning locally right? Can I use the folders and files that I have ready on them to copy them into the website document root? and how should I use my mysql databases, meaning, should I export them as zip files and then import them in ithe same root folder? I'm confused about the 4th part:'Setup any mysql databases you need from your server control panel'. thanks again, sorry for all the questions ^__^ and I really apreciate you replys :D

  2. Hi, I'm not sure if this is the right forum to post this question, but I'll still post it. I'm a newbie programmer, have 1 year experience of php, mysql and html and know how to make a basic website, but I've never actually uploaded the already written code on the internet.So my question is, if you use vertrigo serv and have folders full of php files, what do you do after getting a domain? I read that dreamweaver does that for you, but i also read that it is a closed source software with limitations if you get the free version.The other choice is using FileZilla(which I don't fully understand yet ) i presume.

     

  3.  

    Try this

    <?php
     
    function myt($border, $total_cols, $total_rows, $words)
    {
        $borderParam = ($total_cols==1) ? "border='{$border}'" : '';
     
        $table = "<table {$borderParam}>\n";
        for($row=0; $row<$total_rows; $row++)
        {
            $table .= "<tr>\n";
            for($col=0; $col<=$total_cols; $col++)
            {
                $table .= "<td>{$words}</td>\n";
            }
            $table .= "</tr>\n";
        }
        $table.="</table>";
        return $table;
    }
     
    ?>
    <html>
    <head></head>
    <body>
    <?php echo myt(1, 2, 4, 'lalalala'); ?>
    </body>
    </html>

    thank you it worked, the main problem was the the variables in the loops, i didnt realise they had to be different :D 

  4. You are assembling <td>'s based on a $row loop. Perhaps you mean to use the $column parameter.

     

    Then you can use the $row parameter to have an outer loop that makes $row number of <tr> rows.

    ah my mistake but it doesn`t really matter. actually i figured it out: when looping and inside looping again i was using the same variable $i and im guessing the last $i (meaning the <td> one) was replacing the first $i(meaning the <tr> one) and automatically i still got only one <tr> so now i used another variable $k for example and it worked :D thank you for the reply though appreciate it .

  5. hi i would like to know why this doesnt work .the problem is that it doesnt give me multiple  tr-s like td-s.it only works for one tr and multiple td-s. help apreciated :D

      <html><head>
    </head>
    <body>
    <?php
    
    
    function myt($border,$column,$row,$words){
    $table="<table border='".$border."'>";
    if($column==1){
    $table.='<tr>';
    for($i=1;$i<=$row;$i++){
    $table.="<td>".$words."</td>";
    
    
    
    
    };//end of for
    $table.='</tr>';
    }//end of if
    else{
    for($i=1;$i<=$column;$i++){
    $table.="<tr border='".$border."'>";
    for($i=1;$i<=$row;$i++){
    $table.='<td>'.$words.'</td>';
    }
    $table.='</tr>';
    };//end of column for
    };//end of else
    $table.="</table>";
    
    
    return $table;
    
    
    };//end of function
    //echo myt (1,1,10,'word'); WORKS!!!
    echo myt(1,2,4,'lalalala');
    
    
    
    
    ?>
    </body>
    </html>
  6. so i have  problem with using mysql and php. i wanted to create a guestbook using a table which has: id,date, name,mail,txt and ip. and then i wrote this:

     

     

    <?PHP

        $connect = mysql_connect("localhost","","");
        mysql_select_db("site1",$connect);
        mysql_query("SET NAMES utf8") or die(mysql_error());
    $read = mysql_query('SELECT  * FROM guestbook ORDER BY date ') or die(mysql_error()) ;
        $mass = mysql_fetch_array($read);
     
      ?>
    </head>
      <body>
     
     
      <form action='bb.php?click' method='post'>
    name:<input type="text" name="name" /><br />
    mail:<input type="text" name="mail" /><br />
    comment:<textarea name="txt" rows="7"></textarea><br /> 
    adress
       <input type='submit' value='ENTER' />
      </form>  
     
      <?PHP
        if(isset($_GET['click'])) {
        $date = date("Y-m-d");
    $mass['ip'] =$_SERVER['REMOTE_ADDR'];
        $_POST['mail'] = htmlspecialchars($_POST['mail']);
        $_POST['mail'] = stripslashes($_POST['mail']);
        $_POST['mail'] = trim($_POST['mail']);
     
        $ins = mysql_query("INSERT INTO guestbook(name,mail,txt)
      VALUES('$_POST[name]','$_POST[mail]','$_POST[txt]')");
     
         if(isset($ins)) {echo $mass['name']." ";echo $mass['mail']." ";echo $mass['date']."<br />";
    echo $mass['text']."<br />";
    echo "<hr width=100% />";
     
    }
         else echo mysql_error(); }
        
      ?>
     
     
    and after i insert and submit something it doesnt recognize the $_POST variables because the they dont exist anymore so what should i do???
     
  7. using $_SESSION and rand(1,10) function i want to creat this:
    odd: random odd number appears
    even:random even number appears
    sum; sum of all the numbers that have appeared
    for ex:
    the first two random numbers are
    odd:3
    even:6
    sum:9
    and the next number that appears is 5 then it should be like this:
    odd:5
    even:6
    sum:14 meaning(3+6+5)
    i tried like this:

     

    <?php 
    session_start();
    $_SESSION["number"] = rand(1,10);
    if(isset($_POST["check"])){
    if ($_SESSION["number"]%2==0){$_SESSION["odd"]= $_SESSION["number"];
    }
    else if($_SESSION["number"]%2!=0){$_SESSION["even"]= $_SESSION["number"];
    }
    else session_register_shutdown();
    $_SESSION["sum"] == $_SESSION["odd"]+$_SESSION["even"];
    }
     
     
    ?>
    <body>
     
     
    <form action="index4.php?check" method="post"> 
    ODD number:<?php echo $_SESSION["odd"];?> <br />
    EVEN number:<?php echo $_SESSION["even"];?><br />
    SUM of all the numbers that have appeared:<?php echo $_SESSION["sum"];?><br />
     
     
     
    <input type="submit" value="submit" />
     
     
    </form>
    </body>
     
    but the problem im having is that it cant identify the indexes odd even and sum so if anybody could help me i will aprecciate it :D 

     

     

     

     

     

     

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