Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I don't know php but this is the first php code I see that is READABLE, seriously, I usually see php code as complicated mess that I just run away from, but this one is pretty clean! good luck fixing that bug :)
-
Basically $d=""; is string for PHP according to my assumption...an later I'm comparing it
-
Well, you try to insert $d into database...but you just assigned $d = ""; - what were you about to do?
-
@ElToastGrande no I'm not inserting $d; into the database, I took that variable as a dummy variable to compare, to check if the current user has submitted the required information in the database in order to proceed further...
This is a snippet of the code. -
And idk if this might be relevant to you, but isset checks for set variables, not null
So if I go $_POST['stuff'] = null;
isset($_POST['stuff']) returns true -
@Stalker This is a snippet of the original code...core problem is $d=""; and my audacity to compare string with int without typecasting.
-
Ok, I'm lacking context with this one
Shouldn't be that hard, but...what's the bug exactly like? -
@ElToastGrande Okay, you see, I'm trying to check whether the user has entered the data which is required in order to proceed further, for that I took $d="" as a dummy variable. and that dummy variable is string rather than int.
-
olback109817yThere is a string to int function in PHP, also shouldn't bindValue(1, $d) be bindValue("s", $d) instead? 🤔
-
@Username987654 I successfully resolves it..
I was checking in Table if the I'd exists or not..and on basis of those results I would further proceed..
The error was the result from select wouldn't store in $d and if it would've store a variable it would be string instead of int eg $d="0" instead of $d=0... Which would lead to the error , meaning I cannot compare string with rowsCount() -
@olback The closing tag of a PHP block at the end of a file is optional, and in some cases omitting it is helpful when using include() or require(), so unwanted whitespace will not occur at the end of files, and you will still be able to add headers to the response later. It is also handy if you use output buffering, and would not like to see added unwanted whitespace at the end of the parts generated by the included files. - php manual
-
olback109817y@Username987654 Had no idea about this, I guess you learn something new every day. ☺️
Related Rants
I fucking hate myself for having this bug in the first place, I thought I had it solved, committed and pushed to git but still, it persists.
I'm trying to check if the value I'm inserting into the database exists or not, this is my useless fucking way to do it...
What the actual FUCK.
I'm in my own existential pain trying to solve this shit and it's still not working
SEND HELP PLEASE
undefined
php
bug