Jump to content

rawkinyeti

Members
  • Content Count

    16
  • Joined

  • Last visited

Community Reputation

0 Neutral

About rawkinyeti

  • Rank
    Newbie
  1. Quick (hopefully) question. Ive used this script in a couple of different applications before and it has done what i want it to do. Basically i search my table for someone with the name that they entered from the form. If the are included in the database, they can continue, if they are not, then they are given an error message. <?php$finduser = $conn->prepare("SELECT autonumb FROM faculty WHERE lastname = ? and firstname = ?"); $finduser->bind_param("ss",$lastname, $firstname); $finduser->execute(); $finduser->store_result(); $num_rows = $finduser->num_rows; $find
  2. No, i know I'm wrong. I want to know how i can make it right. I can link the rest of the script, but i use the same variable for a different part and when i take this part of the code out everything works correctly. Ok, read that last part too. Ill try changing those and see if that changes anything. I hadn't even considered that. Thanks a bunch If that doesnt work ill put the whole script on here.
  3. I've been at this for a couple of days now so I can really say i have no idea. Im making a temporary parking pass kiosk. Users will enter their information and get a pass that matches that. Everything works except for trying to count how many passes they have gotten. I have been trying to do it this one way, and the fact i cant get past an error code tells me im doing it wrong. So i was wondering if anyone had any ideas on how i could start this. Ill post my code below to show you. //add user plate to table $stmt = $conn->prepare("INSERT INTO count(plate) values(?)");$stmt->bind_param(
  4. It looks like it was something to do with my table information. Changed all of it to be simpler like 'firstname' and 'plate' instead of 'ENT_FIRST_NAME' and 'VEH_PLATE_LICENSE' and now everything works fine. Not really sure why that happened though
  5. I'm not sure if i used it correctly, but when i used "var_dUmp($stmt)" i got "boolean false". Any chance you could elaborate further? .....
  6. I guess it should also be mentioned that i have an auto-incremented field in this database as well, but since it is auto-inc i dont have to include it in my php code. Correct?
  7. Im working on this code and it keeps giving me the error "Fatal error: Call to a member function bind_param() on a non-object". I've gotten this error before and it has normally been because i have misspelled something or I am missing a character. Something small normally. Ive looked over the same code for about an hour now and the only break through i have is that my head now hurts from intently looking at the computer screen. Any help would be much appreciated. /*** if we are here the data is valid and we can insert it into database ***/$firstname = filter_var($_POST['firstname'], FILTER_S
  8. Did the trick. changed $result to $num_rows and had it see if it was one or zero. Thank for the insight.
  9. Im trying to make it so a username cant be used twice in an application. The database will not accept the duplicate because username is the primary key, but i want to stop the user from advancing if the try and use the same username. So far what i have does not do this. Any suggestions? $stmt3 = $conn->prepare("SELECT username FROM users WHERE username = ?");$stmt3->bind_param("s",$username);$stmt3->execute();$stmt3->store_result();$num_rows = $stmt3->num_rows;$stmt3->bind_result($result); if($result['username'] == $username){ echo "Username has been already used. Plea
  10. Ok i think i got it. Its weird i can do it one way for one of the scripts but its slight different for the next one to work. The first one from last post is still fine, ill repost the newly fixed one. Im new to prepared statements and i have to say im not liking them. Having learned the "standard" php connect to mysql i feel like im trying to learn Spanish after i just went ahead an learned Russian.....Changes are in bold <?phpsession_start();/*** connect to database ***/ /*** mysql hostname ***/ $mysql_hostname = '****'; /*** mysql username ***/ $mysql_username = '*****'; /*** mysql passw
  11. So i have two update scripts using prepared statements. One works fine and updates the record, while the other give me a "Call to a member function bind_param() on a non-object". They are almost identical minus the variables in them. Ive been staring at this for a day now and still nothing. If anyone has any insight i would love to hear from you. This is the code that works... <?phpsession_start();/*** connect to database ***/ /*** mysql hostname ***/ $mysql_hostname = '#######'; /*** mysql username ***/ $mysql_username = '#####'; /*** mysql password ***/ $mysql_password = '######'; /*** d
  12. derp. Thanks a bunch. Project is pretty much complete now
  13. So, I have a couple of different forms where user data is being posted to a database. I want to be able to take data from one of the earlier forms and reuse it again for a latter form that will still be in the same session. Ive tried using session and while i think I'm close i get this error:"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''123452)' at line 1"The 123452 is the piece of data that i am trying to reuse. Ill Post code at the below. Are there certain session parameters that i am not following?Thi
×
×
  • Create New...