[coding] where's the bug?

while coding that when i visit the site gave me:

Fatal error : Uncaught Error: Call to a member function prepare() on null in /home/vol6_8/epizy.com/epiz_23744660/htdocs/main/test.php:4 Stack trace: #0 {main} thrown in /home/vol6_8/epizy.com/epiz_23744660/htdocs/main/test.php on line 4

and it’s the code

<code><?php
include("config.php");

<code>$stmt = $conn->prepare("INSERT INTO phpbb_crany ('crany_id', 'crany_name', 'crany_breed', 'crany_gender', 'crany_level', 'crany_born', 'crany_mother', 'crany_father', 'crany_element', 'crany_user') VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");

$cb = "jgh";
$cg = rand(0,1);
$cl = "1";
$cb = $_SERVER['REQUEST_TIME'];
$cm = 0;
$cf = 0;
$ce = 1;
$cu = 1;
$stmt->bind_param("ssssssssss",1, $cn, $cb, $cg, $cl, $cb, $cm, $cf, $ce, $cu);// <---- CHANGED - line moved

$stmt->execute();
echo "New records created successfully";
$stmt->close(); $conn->close();

?></code>

Now it throws a bug on line 7, where it says $stmt->bind_param("ssssssssss",1,...). The line has a boolean value in it, and should be removed (the 1 is a boolean value), the $cid and $cn should be defined, $cid with 1 and $cn with “test” and the “s” means that the variable is a string, so will not be functioning, so if some values are booleans/integers/doubles, they will get another error. Then put them like this:
$stmt->bind_param("issisiiiii", $cid, $cn, $cb, $cg, $cl, $cb, $cm, $cf, $ce, $cu);
And someone like @Oxy, please put the discussion from Other Discussions to Development Support!

@Ergastolator1
have same bug probably because values are mistake.

forget onething! i’ve formated values like these in db

will remove to don’t break rules much D:

The .php file that I downloaded has the content of the protection against bots that InfinityFree has added instead of the PHP file itself.
But I downloaded the image from http://cranterns.epizy.com/main/download/file.php?id=1 and it’s working.

whats wrong? :frowning:

I found it

Bug
It’s been on the server for so long that started to move as a logo of Infinityfree

1 Like

new meme XD

2 Likes

One might even say that the bug has a bug ( infinite loop ! )

used PDO code without “issisiiiii”
and worked! thank you all

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.