Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Errore T-String

  1. #1

    Errore T-String

    Ciao, ho inserito nel sito questo script:
    Codice PHP:
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
    “[url]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”[/url]>
    <html xmlns=”[url]http://www.w3.org/1999/xhtml”[/url]>
    <head>
    <title>The Internet Joke Database</title>
    <meta http-equiv=”content-type”
    content=”text/html; charset=iso-8859-1” />
    </head>
    <body>

    <?php if (isset($_GET[‘addjoke’])): // L’utente vuole aggiungere una barzelletta
    ?>

    <form action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>” method=”post”>
    <label>Type your joke here:

    <textarea name="&rdquo;joketext&rdquo;" cols="&rdquo;40&rdquo;">
    </textarea>
    </label>

    <input type=”submit” value=”SUBMIT” />
    </form>

    <?php else: // Default page display

    // Connettiti al server database
    $dbcnx = @mysql_connect(‘’‘’);
    if (!
    $dbcnx) {
    exit(
    );

    }
    // Seleziona il database delle barzellette
    if (!@mysql_select_db(‘joke’)) {
    exit(
    ‘’);

    }

    // Se una barzelletta viene inviata
    // aggiungila al database
    if (isset($_POST[‘joketext’])) {
    $joketext $_POST[‘joketext’];
    $sql “INSERT INTO joke SET
    joketext
    =’$joketext’,
    jokedate=CURDATE();
    if (@
    mysql_query($sql)) {
    echo 


    Your joke has been added
    .</p>;
    } else {
    echo 


    Error adding submitted joke
    ‘ .
    mysql_error() . ‘’;
       
       }
      
    }

    echo 


    Here are all the jokes in our database
    :</p>;
    // Richiedi il testo di tutte le barzellette
    $result = @mysql_query(‘SELECT joketext FROM joke’);
    if (!
    $result) {
    exit(


    Error performing query
    ‘ .
    mysql_error() . </p>);

    }

    // Mostra il testo di ogni barzelletta in un paragrafo
    while ($row mysql_fetch_array($result)) {
    echo 


    ’ 
    $row[‘joketext’] . </p>;

    }

    // Questo link caricherà la pagina
    // con il form di invio della barzelletta
    echo 

    [url="”’"]Add a Joke![/url]</p>;
    endif;

    ?>

    </body>
    </html>
    ma il sito mi da un errore nella riga 40:
    Parse error: syntax error, unexpected T_STRING in /var/www/netsons.org/mediasource/joke.php on line 40.
    Di che errore si tratta?
    grazie anticipatamente

  2. #2
    magari se evidenzi la riga con l'errore ti possiamo aiutare meglio...

  3. #3
    La riga è quella selezionata di rosso
    36 // Se una barzelletta viene inviata
    37 // aggiungila al database
    38 if (isset($_POST[‘joketext’])) {
    39 $joketext = $_POST[‘joketext’];
    40 $sql = “INSERT INTO joke SET
    41 joketext=’$joketext’,
    42 jokedate=CURDATE()”;
    43 if (@mysql_query($sql)) {
    44 echo ‘

    Your joke has been added.</p>’;
    45 } else {
    46 echo ‘

    Error adding submitted joke: ‘ .
    47 mysql_error() . ‘’;

  4. #4
    scusa ma perchè hai messo la query su più righe??

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.