/    Sign up×
Community /Pin to ProfileBookmark

parameters error I think

Hi, now I know next to nothing about PHP so I apologise now for anything I say that is rubbish, but I have been tasked to attempt to fix a website that I think has stopped working since the hosting company upgraded to PHP 5.3 on their servers. The website has not changed at all in 2 yrs? So I know its not the code itself although this may not need to change!!

I am getting the below error on all the menu items for the website, below that I have put the code relevant to the file referenced and line 54.

I would be extremely grateful for any help on this as I have no clue about PHP, but do have a decent IT head ?

Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a reference, value given in /home/korfball/public_html/bristoluni/system/system_files/database/mysqli.php on line 54
Query execution failed! (No data supplied for parameters in prepared statement)

Line 54 in the file has this – call_user_func_array(array($this->stmt, ‘bind_param’), $params);

If needed I can post up the whole file if this helps. The hosting server is running PHP 5.3.28

Many thanks in advance for any help on this

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@roberm2506authorSep 07.2014 — Hi, also just been looking thru the error.log file and found the below, so this is when it started, the PHP startup error started that day too!!

[29-Jun-2014 15:18:17 Europe/London] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/timezonedb.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/timezonedb.so: cannot open shared object file: No such file or directory in Unknown on line 0

[29-Jun-2014 15:18:17 Europe/London] PHP Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a reference, value given in /home/korfball/public_html/bristoluni/system/system_files/database/mysqli.php on line 54

Thanks
Copy linkTweet thisAlerts:
@NogDogSep 07.2014 — It's probably best fixed wherever you define $params so that it stores references to variables instead of values, but a quick work-around would be something like:
[code=php]
$tmp = array();
foreach($params as $key => $val) {
$tmp[$key] =& $params[$key];
}
call_user_func_array(array($this->stmt, 'bind_param'), $tmp);
[/code]
Copy linkTweet thisAlerts:
@KryDosSep 07.2014 — Hi ?

[B]call_user_func_array()[/B] can only pass parameters by value (in PHP 5.3).

Try to call [B]bind_param[/B] function directly. Like this:
[code=php]
$this->stmt->bind_param($params);
[/code]
Copy linkTweet thisAlerts:
@roberm2506authorSep 07.2014 — Thanks NogDog, I'll take a look and see if I can work out where $params is defined, I have been passed this by the Uni as they have no one to fix it and I happen to be the only IT guy they know!! Many thanks, I'll have a look tonight and let you know. Thanks for the super quick response ?
Copy linkTweet thisAlerts:
@roberm2506authorSep 07.2014 — NogDog, you are a genius ? The work around has worked, so for now that's absolutely brilliant for me. Looking at the file I only see $params = array () would this be where you mean $params being defined? I've put it below:

$params = array();

$params[] = "";

foreach ($args as $arg)

{

$params[0] .= "s";

$params[] = $arg;

Is this where you mean.. Not that I am that bothered now as it seems to be working fine, couple of pictures don't display but I don't really care about those, they may not have worked before!!

Thanks again for the help on this, that's brill, thanks.
Copy linkTweet thisAlerts:
@roberm2506authorSep 07.2014 — Thanks for taking the time to look and reply KryDos, I gave your bit of code a go but just got a different error. NogDogs workaround has fixed this so I just want to say thanks again for responding to the post ?
Copy linkTweet thisAlerts:
@NogDogSep 07.2014 — NogDog, you are a genius ? The work around has worked, so for now that's absolutely brilliant for me. Looking at the file I only see $params = array () would this be where you mean $params being defined? I've put it below:
[code=php]
$params = array();
$params[] = "";
foreach ($args as $arg)
{
$params[0] .= "s";
$params[] = $arg;
[/code]

Is this where you mean.. Not that I am that bothered now as it seems to be working fine, couple of pictures don't display but I don't really care about those, they may not have worked before!!

Thanks again for the help on this, that's brill, thanks.[/QUOTE]


Yeah, I think you could just change the last line of that snippet to:
<i>
</i> $params[] =[B][COLOR="#B22222"]&amp;[/COLOR][/B] $arg;
×

Success!

Help @roberm2506 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...