1. #1
    Deleted

    Help with computer coding!

    I cant find whats wrong in my text.. anyone want to help me find it..?

    <?php
    $host="localhost";
    $user="root";
    $pass="";



    $conn = mysql_connect( $host, $user, $pass );
    if (! $conn) {
    print ("Anslutningen misslyckades");
    exit;
    }


    mysql_select_db("bilar");


    $query = mysql_query("SELECT * FROM bilar");


    print ("<table border=\"1\">\n");


    while($t = mysql_fetch_row($query))
    {

    echo "<tr>";
    echo "<td>$t[0]</td><td>$t[1]</td><td>$t[2]</td>";
    echo "<td>$t[3]</td><td>$t[4]</td>";
    echo "</tr>\n";
    }


    print ("</table>");


    mysql_close( $conn );
    ?>



    <?php
    $host="localhost";
    $user="root";
    $pass="";
    ?>



    <form action="<?echo $_SERVER['PHP_SELF']?>" method="POST">
    Registreringsnummer:<br>
    <input type="text" name="reg"><p>

    Bilmärke:<br>
    <input type="text" name="marke"><p>

    Modell:<br>
    <input type="text" name="modell"><p>

    Årsmodell:<br>
    <input type="text" name="arsmodell"><p>

    Pris:<br>
    <input type="text" name="pris"><p>

    <input type="submit">
    </form>
    <?

    $reg = $_POST['reg'];
    $marke = $_POST['marke'];
    $modell = $_POST['modell'];
    $arsmodell = $_POST['arsmodell'];
    $pris = $_POST['pris'];



    $conn = mysql_connect( $host, $user, $pass );
    if (! $conn) {
    print ("Anslutningen misslyckades");
    exit;
    }


    mysql_select_db("user");


    mysql_query("INSERT INTO
    bilar (reg,marke,modell,arsmodell,pris)
    VALUES
    ('$reg','$marke','$modell','$arsmodell','$pris')");
    <?php
    $host="localhost";
    $user="root";
    $pass="";


    $conn = mysql_connect( $host, $user, $pass );
    if (! "conn") {
    print ("Anslutningen misslyckades");
    exit;
    }


    mysql_select_db("bilar");


    if (isset($_POST['reg'])) {
    $reg = $_POST['reg'];
    $query = mysql_query("DELETE FROM bilar WHERE reg='$reg'");
    }


    $query = mysql_query("SELECT * FROM bilar");


    print ("<table border=\"1\">\n");

    while($t = mysql_fetch_row($query))

    {

    echo "<tr>";
    echo "<td>$t[0]</td><td>$t[1]</td><td>$t[2]</td>";
    echo "<td>$t[3]</td><td>$t[4]</td>";
    echo "</tr>\n";
    }



    print ("</table>");

    mysql_close( $conn );


    ?>

    <form action="<?echo $_SERVER['PHP_SELF'];?>" method="POST">
    ange registreringsnummer att ta bort:<br>
    <input type="text" name="reg">
    <input type="submit">
    </form>

  2. #2
    You might want to be a little more specific, what language is that and what is the issue you're having with it?
    Playing since 2007.

  3. #3
    Deleted
    Quote Originally Posted by Nab View Post
    You might want to be a little more specific, what language is that and what is the issue you're having with it?
    it´s php html code and it´s swedish! there is something in the text that isn´t right.. cuz it wont work!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •