Jump to content


  • Posts

  • Joined

  • Last visited

Gimple's Achievements


Member (2/5)




Community Answers

  1. I'm creating a content site where I show previews of the articles. In the HTML (which is stored as a TEXT row in my database) there is a <a name="continue"></a> tag in it. I want to end up with a variable that has everything before that tag to display to my user, and cut off everything after it (and including it). What's the best, or a good way, to accomplish this?
  2. Where do you get a free SSL? It has to be signed by a trusted third-party to avoid being blocked by browsers and blacklisted from the search engines, right?
  3. Whoops. I kinda figured that, but I was so set on making my site secure, I changed every query to a prepared statement. I guess I wasted a few hours of my time. Oh well.
  4. Never mind. I should have Googled before asking. I just realized I needed to use a foreach() loop instead of a while(). EDIT: By the way, I've looked but can't seem to find where I change the thread to "Answered". How do I do that?
  5. Hi, With Jacques1's MAJOR help I've been updating my code and changing all queries to run with prepared statements. But it looks like I've run into what will probably be my last problem before this project is complete. After I query my database, how do I run a while() loop to return the data? Here's what I've got, and it's not working: $prospects = $conn->prepare("SELECT * FROM prospects WHERE decline=:decline"); $prospects->execute([ 'decline' => false ]); while($prospect = $prospects->fetchAll()){ //code } I've also tried just fetch(), but no go. Do you know why this isn't work and how I can fix it?
  6. Hi again. I seem to have encountered a problem. My code was using mysql_insert_id() to get the id of the inserted row, but now that I've changed the query to prepared statements that doesn't seem to be working. Doesn't mysql_insert_id() work with prepared statements? If not, how can I get the id of the row I just inserted in my database?
  7. Ah ha! Bingo! It's all working now. Wow, this is great. Thanks so much for your help!
  8. I'm trying to use fetch(), but clearly I'm getting it wrong, because nothing's happening. Here's my code: $users = $conn->prepare("SELECT * FROM users WHERE email=:email"); $users->execute([ 'email' => $email ]); if(!$users->rowCount()){ header("Location: ?error=3"); } else{ $user = fetch($users); if($password == $user['password']){ //code } else{ header("Location: ?error=4"); } } Where am I going wrong?
  9. Great. I actually figured out I could use rowCount() doing some Googling. Now I've encountered another problem I haven't had any luck with Google yet. I was using mysql_fetch_array() to fetch an array from my query, but that doesn't seem to be working now. Is that old mysql too? If that doesn't work, how would I go about fetching an array from my database? Once I got that figured out, I think I'm good.
  10. OK, I'll update my connection using PDO. One question about that. In your example, what does $dsn stand for? Is that host name? Also, what would I know use instead of mysql_num_rows() to check if the query returned any results?
  11. The script still isn't running. Here's all of my code, just in case there's a problem elsewhere. $dbHost = 'localhost'; $dbUser = 'gimple'; $dbPass = 'XCw3@#'; $dbName = 'gimple'; $conn = new mysqli($dbHost, $dbUser, $dbpass, $dbName); $users = $conn->prepare("SELECT * FROM users WHERE email=:email"); $users->execute([ 'email' => $_POST['email'] ]); if(!mysql_num_rows($users)){ //code } else{ //code } Any idea?
  12. I seem to be having a problem with the correct syntax. Been trying to change my queries to prepared statements, but the script does nothing. Here's an example of my code: $users = $conn->prepare("SELECT * FROM users WHERE email=?"); $stmt->bind_param("s", $email); $email = $_POST['email']; $users->execute(); if(!mysql_num_rows($users)){ //code } else{ //code } What am I doing wrong?
  13. Thanks Benanamen! Very helpful. I didn't think the solution was going to be only a few lines of short code!
  • 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.