Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Everything posted by cfrost

  1. I followed everything you said and got a lot of value out of it. Again, I thank you for that added value. I just felt those things could have been said in a different way. Your responses have all had parts that came off as a guy who's seen too many beginners and forgot what it was like to be one. That's understandable. I just thought it might be worth noting that this could push new coders away from the field and although that may be good job security it isn't the best thing for the industry.
  2. I'm not butthurt. I just felt Mac answered my question in a more productive way. Your first post had valuable information in it but it came off as you talking down to me which adds no value. Again, it's hard for someone with tons of experience to relate to someone with none. Experience has put you in a position where if you don't have an answer you know where to look. That's not the case for people just starting out. I assure you I will not turn to the forum to fix every little issue I run into, I did put some time into trying to fix it but at some point asking someone is much more effective since the fix was made in a few minutes. On top of that I got some good feedback on what interface is preferred to connect to a DB, a reminder that I should look into exceptions and a couple good recommendations for IDE's which will help me avoid simple mistakes in the future. I got a lot out of that post that 2 people were kind enough to respond to. On the topic of IDE's I have used eclipse for Java and although I liked it, it was quite resource heavy. I think I'll give Netbeans a shot. I did look into PhpStorm after your initial post and it seems pretty awesome but the price tag is too much for a hobby. If I ever decide to get serious about the language then I will lean that way.
  3. It was a starting point man ease up. I had no way of knowing what the industry standard was at this point so I went with top result on google which was dated recently as well. The 2 days you speak of was 2.5 hours and I could have spent that just trying to figure out what the industry standard is for db connections but now I learned it from a more knowledgeable source without realizing it was an issue at all. Any way around it I fixed my original problem which was unrelated to anything you responded with. I'll give you exceptions, I could have benefited from looking into those initially. The fact that I spent a few hours over a 28 hour period does not bother me at all. It's a side project and I'm just getting my feet wet. I'll look into docs more but they don't tend to be that easy to read and with garbage code all over the internet I'm bound to have more questions that seem like a waste of time to a seasoned vet. I do apologize but at the same time you're free to not read my questions and/or not respond to them. Can I ask which IDE you do prefer?
  4. Thanks for the response! I pulled parts of this code from different places and made an assumption that I was taking working code. I will look into exceptions but I just wanted to do this quick and dirty first and figured echo's would suffice for now. After fixing connecterrno to connect_errno (I still have to look into the difference between this and connect_error) I did get an error message that I searched and was able to find out that I couldn't connect to root the way I was trying so I created a new user and it worked! As I mentioned I am not with the times on PHP so I used mysqli since it was in the first couple examples I found when Googling connections. I'll look into PDO for sure. I'm open to recommendations on IDE but as far as this little snippet goes I was trying to do it quick and dirty so the next step is a proper IDE and learning Exceptions. Thanks again!
  5. I haven't been using PHP for a while now so this is my first time trying to test with mysqli. I believe I am getting connected properly as my error message does not display. This php code is on the same server as the database. I've left out the success case in this code because I know I'm failing before it and this is exactly what's on my live test page: <?php require('cfd.php'); $mysqli = new mysqli($dbhost, $dbuser, $dbpassword, $dbdatabase); if ($mysqli->connecterrno) { echo "Failed to connect to MySQL: (" . $mysqli->connecterrno . ") " . $mysqli->connect_error; } $testSQL = "SELECT * FROM testTable WHERE id = 1;"; if (!$testResult = $mysqli->query($testSQL)) { printf("Error message: %s\n", $mysqli->error); exit; } $testResult->free(); $mysqli->close(); ?> This is showing the output "Error message:" with no error message afterwards. Is anyone seeing something I've done wrong? I've been staring at this piece of code for 2 hours and I know it's going to be something simple but not having the experience I'm also worried I could just be missing something. *Edit* This query has been run directly on the server in a terminal and it runs successfully. Thanks!
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.