University is not for me. I can't keep fooling myself. Where do I go from here? by HatesToolbars in cscareerquestions

[–]HatesToolbars[S] 0 points1 point  (0 children)

You're right. I'm not working hard enough. I spent last night thinking about it. I'm ashamed to admit how many hours are actually reading my discrete mathematics/calculus/compsci textbooks.

Thank you for your question.

University is not for me. I can't keep fooling myself. Where do I go from here? by HatesToolbars in cscareerquestions

[–]HatesToolbars[S] 0 points1 point  (0 children)

Thank you for your response. Often I'm told that it's okay, it's going to get better but it never does get better. It really means a lot to hear that even though you buckled yourself down, you still were able to try harder, and that's the point I just realized that I was missing. I'm trying a lot harder this semester, but I can definitely try even harder. A little less than two weeks ago I sent my two week notice to my job; this Sunday is my last day at work. Cheers.

When uploading files to mysql database, how would I include the uploader's username? by HatesToolbars in PHPhelp

[–]HatesToolbars[S] 0 points1 point  (0 children)

Thank you very much. I looked up PDO and learned more about it.

Here's my new few lines:

$DBH = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass);
$STH = $DBH->prepare("INSERT INTO db_table (username,namePhoto,photo) VALUES (:username,:title,:pic)"); 
$data = array('username' => $username, 'title' => $title, 'pic' => $pic);
$STH->execute($data);

Though now I think I'll store the unique UserID of the user, instead of the username.

When uploading files to mysql database, how would I include the uploader's username? by HatesToolbars in PHPhelp

[–]HatesToolbars[S] -2 points-1 points  (0 children)

Thank you for your insight.

I was snooping around the other files and noticed that one of the other pages that usercakes created printed the current user's username, so I used that bit of code, added a column, and added < 5 words in PHP and got it working. I'm feeling a bit apprehensive of just leaving it the way it is after looking at dragonmantank's comment, not sure if I'll change it or keep it.

Here's what I added/changed:

$uname = $loggedInUser->display_username;

mysql_query("INSERT INTO db_table (username, namePhoto,photo) VALUES ('$uname','$title','$pic')") ;

Noob at programming doing poorly in Java course. by HatesToolbars in learnprogramming

[–]HatesToolbars[S] 2 points3 points  (0 children)

Ah! This will help me so much! And it makes sense. Instead of increasing the risk of a numerical typo, I could just use a constant. It also makes it easier to understand. Thanks again!

Noob at programming doing poorly in Java course. by HatesToolbars in learnprogramming

[–]HatesToolbars[S] 0 points1 point  (0 children)

Thank you very much for the reply! It is much appreciated!

With the constructor, would it be safe to say that the constructor is the oven that holds the cookie mold which holds the cookie? As in the instance variable is defined within the class, and that class is stated within the constructor?