[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
4Archive logo
CODING IS FOR MEXICAN NIGGER SLAVES NOT WHITE...
If images are not shown try to refresh the page. If you like this website, please disable any AdBlock software!

You are currently reading a thread in /r9k/ - ROBOT9001

Thread replies: 59
Thread images: 3
File: Screenshot_13.png (32 KB, 856x647) Image search: [iqdb] [SauceNao] [Google]
Screenshot_13.png
32 KB, 856x647
NO HABLO PHP/SQL

>Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given on line 9
>Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given on line 10

WHY
>>
Please help, I've been trying to make this cursed anal code work for 3 days straight
>>
>NO HABLO PHP

This is funny. Why isn't it a meme yet
>>
you posted this on /g/

just put some time into it

even i can do php and sql shit and i didnt finish high school
>>
>>25843981
Help me and I will give you more memes
>>
php is fucking shit
go learn ruby or python or node.js or literally any other server-side language for fuck's sake
>>
>>25843905
because
>mysqli_prepare() returns a statement object or FALSE if an error occurred.
thus error occured
>>
>>25844002
>just put some time into it
My whole life the last 3 days has consisted of nothing but the pain of this code not working, after attempt after attempt, while people who could easily tell me what to do tell me to put more time into it

And I just dropped out of high school and this website I'm making is pretty much my only change of having any income, so PLS
>>
use pdo instead of this mysqli bullshit
>>
>>25843905
>writing PHP
It's 2016! COME ON!
>>
>>25843905
>$_POST[IP]
why not
$_SERVER['REMOTE_ADDR'];
?
>>
>>25844120
Suggestion?
>>
>>25843905
>PHP
>Coding
Playing digital lego is not coding, mate.
>>
>>25844135
their approach is kind of stupid, but in fairness a load balancer or proxy could be in the way
in which case they should be using the x-forwarded-for header
>>
File: pepo.jpg (8 KB, 400x343) Image search: [iqdb] [SauceNao] [Google]
pepo.jpg
8 KB, 400x343
>>25844159
>STOP DOING THIS
>STOP USING THAT

JUST TELL ME WHAT TO DO
>>
>>25844050
if this is not enough
>check if mysqli_connect really connects to DB
>your sql query might be fucked up (table does not exist etc)
>>25844156
use PHP framework like symfony2 or zend...
or use python framework like django
>>
>>25844156
PHP is on the way out. Of course all top sites are still running PHP but new projects are now mostly being started in other languages/frameworks. This is because PHP is a piece of shit language and it is no longer the only real solution. Check out Python+Django or Rails or whatever Flavor of the Month.js
>>
>>25844191
Get into ASP.NET.
>>
>>25844213
lmao
this fuckin guy
>>
>>25844213
I use foundation
>>
File: 1447346734036.jpg (20 KB, 150x200) Image search: [iqdb] [SauceNao] [Google]
1447346734036.jpg
20 KB, 150x200
>>25844213
why would you limit yourself to microsoft users only?
>>
I'll check out python then. Expect a new failure thread soon
>>
>>25844253
That's not what ASP.NET does at all, retard. You simply replace the garbage that is Javascript/PHP with actual logical code.

>>25844271
>python
lol
that's still an improvement over PHP
>>
>>25844191
ignore tripfags

Procedural style _prepare returns a bool, that's why you're getting the error.
try the OO approach, maybe that works
>mysqli_stmt::prepare ( string $query )
>>
>>25844343
>>25843905
cont.

see this:
http://php.net/manual/en/mysqli-stmt.prepare.php
youre trying to continue with a statement, but got a bool instead.
>>
>>25844310
>you need ms server to host that pile of crap.
and don't even try to convince me that mono is ok solution for unix/linux based servers
>>
>>25844343
mysqli_prepare is returning a bool because it's failing (does anybody even read the docs?? double click function name, right click "search google", READ)

you need to show your schema here.
>>
>>25844382
kinda what I said few posts ago. if error occurs that function returns FALSE. thus 2 warnings about getting boolean instead of mysqli_stmt.
>>
>>25844397
>mysqli_prepare is returning a bool because it's failing (does anybody even read the docs?? double click function name, right click "search google", READ)

>Return Values
>Returns TRUE on success or FALSE on failure.
>>
>>25844397
Don't bother, I'm ditching PHP and if Python or Ruby doesn't work for me I'm actually killing myself
>>
>>25844484
OK, you know what? This is exactly why PHP should never ever be used. Behold:

http://php.net/manual/en/mysqli.prepare.php

>Return Values
>mysqli_prepare() returns a statement object or FALSE if an error occurred.

So which is it, you piece of shit langauge??
>>
>>25844579
>returns false instead of using exceptions or some other sane error-handling method

this is why php is shit
>>
>>25844510
it is not about language. you are going to have same issues with other programming languages as well. I understand that you are probably trying to self educate and it is fine. but you need to follow some good practices. first of all you should always check for exceptions / errors. I mean every time you run function/method that can fail there is usually parameter or return statement that needs to be checked or exception to be handled. that way you avoid having massive code that throws error "somewhere".
>>
>>25844610

Yeah... I like exceptions for that reason. Wrap the whole mess in a try / catch, dump the error, and voila, there's your problem.
>>
>>25844607
$what_ever = mysqli_prepare(......);
if(!$what_ever) {
return some_error_message_or_what_ever_you_want;
}
//rest of the code...

I don't see the problem, proper way to handle it is same as in any other language.
c based language would return null instead of object if error.
>>
>>25844677
a modern non-shitty language would throw an exception
by returning false or the correct value, it violates the semantics of return
it should return a value or null if no value could be returned, and throw an exception if appropriate
>>
Also gonna go with failed to connection therefore $connection is returning false. Put this below line 7:

echo mysqli_connect_error();
>>
>>25844741
well you can always wrap that function into another that does what you want. throw exception for example. latest PHP supports them.
don't get me wrong, I am not fan of PHP myself but I was forced to use it for one of my projects.
>>
>>25844842
the point is that you shouldn't have to do shit like that to make the language work the way it ought to
not to mention that the standard library isn't even remotely consistent in the ways that it deals with errors
>>
>all these anons being dicks to OP

I swear to god, most coders are fucking dicks.
>>
>>25844938
the field is getting oversaturated
it's becoming competitive to the point where it's a disadvantage to help others
>>
>>25844889
well you don't really have to, unless you are using outdated shit like mysqli. I used symfony2 framework with doctrine as orm and it was pretty much ok.
and consistency is price you have to pay for being open source I guess. yes it is shit language but it gets the job done.
>>
>>25844029
>php a shit
>lists all the languages that are slower than php

PHP ES SCRIPTO LANGO NOMERO UNO
>>
>>25845053
almost every single scripting language is at the same level as php when it comes to speed.
>>
>>25844610
>I'm not smart enough to do that, sorry
>>
>>25845178
i unconsciously meme arrowed that
>>
>>25844938
Not even being a dick. PHP is an awful, very outdated, limited language. OP cripples himself by trying to stick to it. Look here (>>25844579) for a good example of how shitty it actually is as a language.
>>
>>25845406
Didn't know there were alternatives, I'm new as fuck
>>
I would probably start with c#, java or perhaps python. c/c++ if you actually care/want to know how computer works.
>>
>>25845589
Ignore the tripfag PHP gets a lot of hate due to how shit some beginner code can be but with enough experience it can be a great language which is why everyone uses it.

Maybe use a PHP framework like other people have suggested if you are really unsure.
>>
>>25845676
I've experimented with C++ before, but I really just want my website to work, not understand the universe
>>
>>25845877
how about using some existing cms system like joomla, drupal or wordpress?
>>
>>25845834
no it fucking isn't
it's a terrible language for dozens of reasons
>>
>>25843905
>>25843958
> i can't understand it
> its dumb
>>
>>25844002
haha high school doesnt matter for that shit bro you never learn any kind of coding in high school that is useful unless its self taught. It just shows you are a low life fagget that dropped out and can actually do something. I graduated from highschool and college and I bet you know just a little more code than I do, but ive only been teaching myself for just over a month ;)
>>
>>25845956
WP isn't customizable enough for my site, haven't tried the other ones
>>
>>25846856
Unless WP is very customizable and my dumbass haven't realized it
>>
>>25843905
> I will send 24 parameters with that function
> PHP sucks
>>
>>25847186
Speak english, I'm tired of this god forsaken mexican
Thread replies: 59
Thread images: 3
Thread DB ID: 433295



[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at [email protected] with the post's information.