Improvements To Member Registration Site Reg.php

No, there is bind_param() in mysqli, but no bindParam().

http://php.net/manual/en/mysqli-stmt.bind-param.php

1 Like

That’s still not right because in the quote I quoted above, you were mixing OOP (something) with Procedural mysqli_*. Even if your naming conventions were completely misleading, the line that I quoted still tried to use procedrual mysqli_* with OOP (something). Because OOP uses the connection like $var->, but procedural usually passes the connection as an argument.

1 Like

For some reason I’m able to red heart (love) this post of your’s but not LIKE it.
How-about fixing my code where I went seriously wrong and attaching it in this thread ? Then I, and the future newbies who pour into this thread, can really understand what I’m doing wrong and what your suggestions are. That way, we never make the same mistake again. I’ll see if I can LIKE or not that post too. You know how it is. Reading text is one thing but seeing an image tells a thousand words. Seeing a sample from you would help us to sink your suggestions in our heads like an image. I think you know what I mean.

I’ve seen “thank you” and “like” icons on posts on many forums but this is the only forum where you can “love” a post aswell as “like it” (do both). Lol!

1 Like

Off Topic

I think you’re confused about something here. :slight_smile:

The heart icon is the symbol for “likes” on this forum. It’s the only one we have; no other options for “love” or “thank you”. It’s been that way since we moved to Discourse.

1 Like

I said other forums have the “thank you” icon and some the “like” but your forum has both the “love” and the “like”. As soon as I click the “love” or red heart icon, I see a “like” icon appears. I then have a choice to either like the post or leave it at the “love”. Or, am I misunderstanding here ? Maybe, unless I “like” the “love” is not shown ? Is that how it works ? So, this “red heart” or “love” icon is just a trigger to bring-out the “like” icon ? Why did you do things like that as to “like” a post we have to do 2 things by clicking 2 icons “love” then “like”.

1 Like

Quite frankly, I’m not good with forums. I hardly prowl on forums as in the past I have hardly got any results from them. Prowling programming forums nowadays for a change as I see I am getting results. Programmers are not snobbish and bother to reply and most of them are polite. Try voicing your opinions on an internet marketing forum and see how rude people can be. Frankly, I hate those kinds of people.

I’m here to stay a while. I’ll be keeping this forum busy with my coding questions. I’ll keep programmers standing on their toes. They’ll dislike me at first not knowing where all the questions are coming from but soon they’ll figure things out for themselves and come to realize the reasons behind the coding questions. They’ll see what I’m upto and start liking me. They’ll watch my footsteps wondering what’s next coming their way. I just spotted that I got a badge “Earned trust level 2”. Don’t know how I earned that or what it really means. Maybe insignificant. I thought I might find myself banned tonight for opening this thread bragging to take on all the top 10 popular websites on the net all by myself. Ha! Ha! Ha! Maybe, it is already starting. My magic is probably leaking behind my back without my awareness and some members here have probably sniffed them out. Lol! This is encouraging me to thinkup a game for this forum. A game programmers can engage with everynight for a break when they need a break from programming. Let me see what kind of game idea I can come-up with. I’m not good with games, however. This’ll be a good opportunity to change that.

1 Like

I think you’re smoking some real good stuff! :stuck_out_tongue_winking_eye:

1 Like

Nah! I don’t smoke, nor drink. Maybe, I’m an Android ? Lol!

1 Like

Off Topic

As explained already, we didn’t. There is one heart icon. Hover over it, and you’ll see the tooltip “like this post”. Click on it once, and it adds your “like” to the post. That’s it. End of story. No second click required, no “love” option - nothing else.

1 Like

The problem with doing that is that some posters would just use that as a way of getting their problems fixed, without necessarily learning anything. It’s far better IMO for the original poster to fix their own code based on the advice and critique they are given, and then post the updated code themselves.

5 Likes

There you go mysqli with prepared statements procedural.

I didn’t made any special edit to tell_a_friend.php because its only mail() function in and nothing special, and i leave to you dynamic_dropdown_options_from_mysql.php example so you can implement in what you need for.

test.zip (8.6 KB)

As i told you i’m short with time, but it’s tested and working.

1 Like

The first thing I would do is completely remove this whole “I can ONLY use Procedural mysqli_* because I am a beginner”. And I “will” replace it later when I learn more. That kind of thinking only just keeps you in the dark. If you don’t experiment for yourself, you aren’t going to learn anything. And we’ll always be back here time and time again asking the same old questions that should have been answered a super long time ago.

If you truly have learned anything from this topic, you should know that ANY programming language that seems to thrive almost ALWAYS uses OOP. Python uses OOP, Ruby uses OOP. Heck, even proper Javascript uses OOP. If all you do is use procedural and your answer to everything is always “I am a beginner and I am new to this.” Then you obviously won’t succeeded in learning how to properly use PHP. If you genuinely want to learn and create a successful app, you’d probably listen to everyone’s suggestions.

But, I aint you. So again

You can lead a horse to water, but you can’t make it drink.

2 Likes

Thank you very much!
I haven’t been online for 3 days and am back to find samples waiting for me. I’m feeling happy now. :slight_smile:

Anyone else are welcome to download and experiment with my codes and mlukac89’s updates. See how much you can modify to turn it into something unforseen or better!
Enjoy!

Don’t forget to attach your updates, though, for others to benefit!

Ha! Ha! Take it easy my friend! The horse has drank a lot of milk and if he starts drinking water too right now then he’ll be too full-up and might throw-up. Result would be, no millk nor water remaining in the belly. Would thirst later-on. Let the horse wait a while for it to have a leak. Then the stomache would be full empty to drink all the bucket water. Actually, the horse intends to drink the whole well, let alone the bucket. :wink:
You and droopsnoot been a great help to me in this forum for quite a while and now mlukac89’s practically finished my project for me where I was stuck and been an astounding support! Bit by bit, all my barriers are getting removed thanks to people in this forum and a few in others.
Yes, I know, if we just drop by to forums and have people like you give us everything on our plates then we never try things ourselves and get lazy and never gain the work experience that we need to become pros. But, I tried things myself and was really stuck on 2 things (mysqli prepared statements and password hashing). Thanks to mlukac89, that is likely over now.
I have a little surprise for everyone in the very near future. You’ll see where my enthusiasm has lead me to. You’ll be surprised what a beginner level coding can lead you to. And, you’ll be surprised what beginners can plan to build. :wink:

I had in mind to jump into pdo and that is a good start to begin with oop. I just thought, I’ve come this long with mysqli which is procedural and it would be a shame to quit just before the end. Let’s finish mysqli prepared statements and password hashing and then I’ve got nothing much important to learn about mysqli and can migrate to pdo. Tonight, I research on password hashing. Tomorrow, and maybe a few more days (half a wk) I will try finishing my scripts (social network & searchengine) and then I can try learning a little pdo from the youtube tutorials I downloaded that show you how to build your own social network, web crawler & searchengine and a whole lot of other stuffs. Don’t worry, I won’t start learning pdo from youtube tutorials but from text tutorial. Would use youtube videos for work experience on the side.
I’ve been suggested some good pdo links. Can start from them.

For learning PDO this is a best website to learn from with so many examples https://phpdelusions.net/pdo

2 Likes

Yeah, I know. I’ve been suggested that by one programmer twice or thrice and maybe by another one or two too. Have already noted that. Will use it when I migrate to pdo.
But right now, hunting for a good tutorial for a beginner related to password hashing.
Been suggested these:

But they don’t look like for beginners like me, though.

Somebody suggested this for curl or web scraping which I’m gonna checkout tonight:
https://scrapy.org

You, and everybody here are welcome to make suggestions to my thread named “Recommend Me Some Tutorials”.

For password hashing just use php built in function password_hash($entered_password, PASSWORD_DEFAULT); and to check it use password_verify($entered_password, $password_from_database);

http://php.net/manual/en/function.password-hash.php

2 Likes

Hi,

I have a few questions as I failed to understand some of the wisdom behind your warnings.

Q1. You say I should never tell user that username or password exists in this way I did die(‘That Username ‘.htmlspecialchars($_POST[‘member_registration_username’]).’ is already registered!’); its enough to tell them die(‘Username in use, please select another one.’); same for email.

But telling a user his chosen Username is already in use, isn’t that the same as telling him his Username is already registered ? What is the difference between the 2 and what are the risks of doing things the way I did and how does it eliminate any risk by telling user his Username is in use over telling his his username is already registered ?

Q2. You ask why I don’t use die(") in row 1. Sorry, but I don’t understand to which part of the script you are referring to. Can you point it out on my original script where I went wrong and an example of how it should’ve been so I understand my mistake and don’t repeat it ?

Q3. You ask why I’m using an “if” in prepared statement. I myself found this odd too but I catually copied it from a tutorial. Can’t remember from where now but it might have been from here:

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

Scroll one page down and focus on the heading:

"Example #1 mysqli::prepare() example

Object oriented style".

Notice the following there:
" /* create a prepared statement */
if ($stmt = $mysqli->prepare(“SELECT District FROM City WHERE Name=?”)) { "

Nevertheless, I’m still giving pan6831 a LIKE and a red heart for atleast going through my code! :winky:

1 Like

I noted that link. I suspect it teaches you what NOT to do.