Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    errore banale su script php

    mi potete aiutare per favore visto che non capisco pienamente il php chiedo ha voi!!!!

    ho uno script questo:riporto solo la parte incriminata
    Codice PHP:
    <?php
    $limit 
    10;
    global 
    $mysql;
    $mysql = new mysqli('localhost''root''''html_it_articles');
    if(
    $mysql)
    {
        die(
    "Errore di connessione al database, impossibile procedere");
    }
    $query = ("SELECT COUNT(*)AS tot FROM articles");
    $result $mysql->$query->fetch_assoc();

    $page = isset($_GET['p']) ? $_GET['p'] : 1;
    $totals $result['tot'];
    $totals_pages ceil($totals $limit);

    $articles $mysql->query("
        SELECT
            AR.id AS id,
            AR.title AS title,
            CONCAT(SUBSTR(AR.article, 1, 200),  ' ...') AS content,
            CONCAT(AU.surname, ' ', AU.name) AS author
        FROM
            articles AR,
            authors AU
        WHERE
            AR.author_id = AU.id
        ORDER BY id DESC
        LIMIT "
    .(($page 1) * $limit).",".$limit);
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <title>Articoli</title>
        </head>
        <body>
            <ul>[*][url="News.php"]Lista articoli[/url][/list]
            

    Articoli totali: <?php echo $totals?></p>
            <table width="500px">
                <?php
                
    while($article $articles->fetch_assoc())
                {
                    
    printf('<tr>
                            <td>%d. [url="show.php?id=%d"]%s[/url] (%s) </td>
                        </tr>
                        <tr>
                            <td>

    %s</p></td>
                        </tr>
                        <tr>
                            <td><hr /></td>
                        </tr>'
    ,
                        
    $article['id'],
                        
    $article['id'],
                        
    $article['title'],
                        
    $article['author'],
                        
    $article['content']
                        );
                }
                
    ?>
            </table>
            

    Pagina <?php echo $page?> di <?php echo $totals_pages?> 

            <?php
            
    if($page 0)
            {
                echo 
    '[url="?p='.($page 1).'"]&lt; prev[/url] | ';
            }else
            {
                echo 
    '&lt; prev | ';
            }
            if(
    $page <= $totals_pages)
            {
                        echo 
    '[url="?p='.($page 1).'"]next &gt;[/url]';
            }else
            {
                        echo 
    'next &gt;';
            }
            
    ?>
            </p>
        </body>
    </html>
    che mi da questo errore:
    Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /membri/sk1zzo/News.php on line 183

    E LA RIGA 183 E QUESTA
    $mysql = new mysqli('localhost', 'root', '', 'html_it_articles');

  2. #2
    Utente di HTML.it L'avatar di nicola75ss
    Registrato dal
    Nov 2004
    Messaggi
    12,923
    Manca il ; nella riga antecedente.

  3. #3
    ADESSO MI DA QUESTO ERRORE
    Fatal error: Cannot instantiate non-existent class: mysqli in /membri/sk1zzo/News.php on line 183

  4. #4
    Utente di HTML.it L'avatar di nicola75ss
    Registrato dal
    Nov 2004
    Messaggi
    12,923
    Non capisco perchè abbia aperto un altro thread. Qui chiudo ma in futuro fai più attenzione alle regole. E questo è già il secondo richiamo della serata.

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.