SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    i cant find the error

    ( ! ) Parse error: syntax error, unexpected T_DOUBLE_ARROW in C:\wamp\www\Delete\index.php on line 89

    PHP Code:
    <?php
    if (get_magic_quotes_gpc())
    {
        function 
    stripslashes_deep($value)
        {
            
    $value is_array($value) ?
                
    array_map('stripslashes_deep',$value) :
                
    stripslasges($value);
                
            return 
    $value;
        }
        
        
    $_POST array_map('stripslashes_deep'$_POST);
        
    $_GET array_map('stripslashes_deep'$_GET);
        
    $_COOKIES array_map('stripslashes_deep'$_COOKIES);
        
    $_REQUEST array_map('stripslashes_deep'$_REQUEST);
    }

    if (isset(
    $_GET['addjoke']))
    {
        include 
    'form.html.php';
        exit();
    }

    $link mysqli_connect('localhost''root''nestle324');
    if (!
    $link)
    {
        
    $error 'Unable to connect to the database server.';
        include 
    'error.html.php';
        exit();
    }

    if (!
    mysqli_set_charset($link'utf8'))
    {
        
    $output 'Unable to set database connection encoding.';
        include 
    'output.html.php';
        exit();
    }

    if (!
    mysqli_select_db($link'ijdb'))
    {
        
    $error 'Unable to locate the joke database.';
        include 
    'error.html.php';
        exit();
    }

    if (isset(
    $_POST['joketext']))
    {
        
    $joketext mysqli_real_escape_string($link$_POST['joketext']);
        
    $sql 'INSERT INTO joke SET
            joketext="' 
    $joketext '",
            jokedate=CURDATE()'
    ;
        if (!
    mysqli_query($link$sql))
        {
            
    $error 'Error adding submitted joke: ' mysqli_error($link);
            include 
    'error.html.php';
            exit();
        }
        
        
    header('Location:. ');
        exit();
    }

    if (isset(
    $_GET['deletejoke']))
    {
        
    $id mysqli_real_escape_string($link,$_POST['id']);
        
    $sql "DELETE FROM joke WHERE id='$id'";
        if (!
    mysqli_query($link$sql))
        {
            
    $error 'Error deleting joke: ' mysqli_error($link);
            include 
    'error.html.php';
            exit();
        }
        
        
    header('Location:. ');
        exit();
    }

    $result mysqli_query($link,'SELECT id, joketext FROM joke');
    if (!
    $result)
    {
        
    $error 'Error fetching jokes: ' mysqli_error($link);
        include 
    'error.html.php';
        exit();
    }

    while (
    $row mysqli_fetch_array($result))
    {
        
    $jokes[] = $array('id' => $row['id'], 'text' => $row['joketext']);
    }

    include 
    'jokes.html.php';
    ?>

  2. #2
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Remove $ from the array.


Bookmarks

Posting Permissions

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