Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8616433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:37:07+00:00 2026-06-12T05:37:07+00:00

The Error I keep getting is: stripslashes() expects parameter 1 to be string, array

  • 0

The Error I keep getting is: stripslashes() expects parameter 1 to be string, array given in /target.php on line 30

This is my code for this site, I am new to this and i’ve been trying to do it for over 30 minutes.

I am sorry for asking such a stupid question.

<?php

// rnprofile.php
include_once 'rnheader.php';

if (!isset($_SESSION['user']))
    die("<br /><br />You need to login to view this page");
$user = $_SESSION['user'];
echo "<h3>Edit your Profile</h3>";
if (isset($_POST['text'])) {
    $text = sanitizeString($_POST['text']);
    $text = preg_replace('/\s\s+/', ' ', $text);
    $query = "SELECT * FROM rnprofiles WHERE user='$user'";
    if (queryMysql($query) != false) {
        queryMysql("UPDATE rnprofiles SET text='$text'
            where user='$user'");
    } else {
        $query = "INSERT INTO rnprofiles VALUES('$user', '$text')";
        queryMysql($query);
    }
} else {
    $query = "SELECT * FROM rnprofiles WHERE user='$user'";

    $result = queryMysql($query);
    $sth = $dbh->prepare($query);
    $sth->execute();
    if (queryMysql($query) != false/* mysql_num_rows($result) */) {
        $row = $sth->fetchAll(PDO::FETCH_ASSOC);
        //$row = mysql_fetch_row($result);
        $text = stripslashes($row[1]);
    }
    else
        $text = "";
}
$text = stripslashes(preg_replace('/\s\s+/', ' ', $text));
if (isset($_FILES['image']['name'])) {
    $saveto = "$user.jpg";
    move_uploaded_file($_FILES['image']['tmp_name'], $saveto);
    $typeok = TRUE;
    switch ($_FILES['image']['type']) {
        case "image/gif": $src = imagecreatefromgif($saveto);
            break;
        case "image/jpeg": // Both regular and progressive jpegs
        case "image/pjpeg": $src = imagecreatefromjpeg($saveto);
            break;
        case "image/png": $src = imagecreatefrompng($saveto);
            break;
        default: $typeok = FALSE;
            break;
    }
    if ($typeok) {
        list($w, $h) = getimagesize($saveto);
        $max = 100;
        $tw = $w;
        $th = $h;
        if ($w > $h && $max < $w) {
        $th = $max / $w * $h;
        $tw = $max;
    } elseif ($h > $w && $max < $h) {
        $tw = $max / $h * $w;
        $th = $max;
    } elseif ($max < $w) {
        $tw = $th = $max;
    }
    $tmp = imagecreatetruecolor($tw, $th);
    imagecopyresampled($tmp, $src, 0, 0, 0, 0, $tw, $th, $w, $h);
    imageconvolution($tmp, array(// Sharpen image
        array(−1, −1, −1),
        array(−1, 16, −1),
        array(−1, −1, −1)
            ), 8, 0);
    imagejpeg($tmp, $saveto);
    imagedestroy($tmp);
    imagedestroy($src);
    }
}
showProfile($user);
echo <<<_END
<form method='post' action='rnprofile.php'
enctype='multipart/form-data'>
Enter or edit your details and/or upload an image:<br />
<textarea name='text' cols='40' rows='3'>$text</textarea><br />
Image: <input type='file' name='image' size='14' maxlength='32' />
<input type='submit' value='Save Profile' />
</pre></form>
_END;
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:37:09+00:00Added an answer on June 12, 2026 at 5:37 am

    from PDO::FETCH manual

    PDO::FETCH_ASSOC: returns an array indexed by column name as returned
    in your result set

    PDO::FETCH_NUM: returns an array indexed by column number as returned
    in your result set, starting at column 0

    you have used FETCH_ASSOC then you must use column name as key of $row

        $row = $sth->fetchAll(PDO::FETCH_ASSOC);
        $text = stripslashes($row['column_name']);
    

    or change it to FETCH::NUM

     $row = $sth->fetchAll(PDO::FETCH_NUM);
     $text = stripslashes($row[1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting this error in the $('#savetickets-list') line. I want to dynamically add
With the following code, I keep getting error C2535 when I compile. It's complaining
I'm trying to code some stuff for a game but I keep getting error
I keep getting this error and have no idea why. I googled and scanned
I keep getting this error on emulator: I copied this from a tutorial and
I keep getting this error Error in readPNG(destfile) : libpng error: PLTE: CRC error
I keep getting this error with my Play 2.0 application: play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[MatchError:
I keep getting this error when using django templates in Google App Engine: TemplateSyntaxError:
I'm trying to enter http://localhost/phpmyadmin/index.php but I keep getting : Error MySQL said: #1130
I'm confused by this syntax error I keep getting when I try to execute:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.