I’ve only just begun using php in my websites and I have this error message on my php photo gallery - Warning: Illegal string offset ‘name’ in ---------- funcs.php on line 1199 and would like to fix it. Any help is appreciated.
Did you declare the variable you are trying to access as a string instead of an array?
I don’t know, since I didn’t write the script - it’s from a download that is a number of years old.
Can you post the code, particularly line 1199 (and maybe a bit around that section)?
This is the code where I think the problem is.
[php]<?php
$copyright = strtr($basis[‘copyright’], $transtable);
$name = $basis[‘auname’];
$email = get_email_link();
$Phormer = “<a href=“http://p.horm.org/er”>Phormer, version “.PHORMER_VERSION.””;
$copyright = str_replace(array('$name', '$email', '$Phormer'),
array( $name , $email , $Phormer),
$copyright);
echo nl2br($copyright);
?>[/php]
You don’t need to guess, it says:
[php]string offset ‘name’ in funcs.php on line 1199[/php]
So, you have an array with ‘name’ as an index that doesn’t exist on line 1199.
So, what do I do about it?
I haven’t seen the code referenced.