Jump to content

benanamen

Members
  • Posts

    2,134
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by benanamen

  1. @ginerjm, I actually set up a test DB. It was just the quotes. If you mean the bind like PDO::PARAM_INT it didn't make any difference at all. If I used named placeholders I would have caught the quotes right off but I like my question marks.
  2. @ginerjm, I think I got confused with this: "I still think it is because he bound the age as a string rather than an int" I was thinking you were saying it didn't work because he didn't do this: $stmt->bindValue(':age', $_POST['age'], PDO::PARAM_INT); Must have misunderstood you.
  3. I dont believe that. And I don't know enough about the OP's situation to feel comfortable to have him do a mass update on his data because of my say so. I was leading to a solution to give him the dates he wanted on output without changing his data. It must of went in the way it did for some reason. OP's dont always ask the right questions to achieve the ultimate purpose. They ask for an answer to what they "think" they need to do. Still dont know if changing all the dates is the right thing to do.
  4. Dang Mysqli, PDO would have given me the data, not an Object. Nevertheless, the result counts are right. What you have not shown is the code for logged_in()
  5. Oh @Barand, I was trying to teach the brutha a little something, something, not hand him the answers. LOL! By the way, he didnt want to change anything to Fridays. He wants Saturdays AND Sundays to be the next Monday. He is going to jack his dates.
  6. @0x00, You didnt mention unixtime. Nevermind.
  7. So you are trying. Look at your code closely. Where are you supposed to put FROM? https://dev.mysql.com/doc/refman/5.0/en/select.html
  8. Why would you do that? * Anyone know why the quotes default to two spaces before your text? And can it be changed without going back and editing the post?
  9. The query I posted is not the answer to your question. As posted, we are not going to just do it for you. Learn what the query I gave you is doing and you will be halfway to having your answer.
  10. OP, are you also needing a solution to convert the dates BEFORE they get into the DB or just update the dates that are already in there? And, do you want to actually change the existing dates or perhaps add a monday_date column or even just calculate Mondays date on output? This will show you a SELECT: SELECT DATE_ADD( '2015-10-24', INTERVAL ( 9 - IF ( DAYOFWEEK('2015-10-24') = 1, 8, DAYOFWEEK('2015-10-24') ) ) DAY ) AS NEXTMONDAY; I will leave it to someone else to show you the update.
  11. No, ginerjm, it is exactly as @macgyver said. Remove the red quotes and there is no problem $stmt = $db ->prepare ("INSERT INTO people (name, age) VALUES (':name', ':age') "); I thought it was a good opportunity to bring up strict mode. In my experience, most people don't even know it exists. It has also jumped around from version to version as to the default setting. Check out this read from the Mysql Devs about it. http://mysqlserverteam.com/improvements-to-strict-mode-in-mysql/ * I think I will add this to my list of why I use positional placeholders (?,?) instead of named parameters. You just cant mess up a question mark. (Yeah, I know, you can have too many or not enough..)
  12. Yes, but allow me to rephrase, The reason the OP is seeing that error is because he is running in strict mode. If strict mode was disabled Mysql would not throw an exception and add :name and a zero to the DB. So the problem itself is not caused by strict mode, it just throws an exception instead of entering what it can into the DB. I am just not always up for giving detailed info, but I could have phrased it better. Thanks for keeping my blade sharp.
  13. The problem you are having is because you are running MySQL in strict mode. To verify, run this query: SELECT @@sql_mode https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sql-mode-strict @mac_gyver is right, age should be calculated from birth date. Age is always changing, you don't want to store a hard number.
  14. Post an sql dump of your DB. Why are you creating variables on your insert and then not using them?
  15. Try doing $stockin = $page->fetchQuery() If that doesnt work try $stockin = $page->fetchQuery(0) By the way, your mysql code is obsolete. You need to use PDO with prepared statements.
  16. Post your Class. At first glance I would say it might have to do with $stockin = $page->fetchQuery(1)
  17. Run this and show me the result. <?php $sql = "SELECT role FROM users WHERE username='user'"; $result = $mysqli->query($sql); $result->fetch_assoc(); print_r($result); ?>
  18. See a problem here? mysql> LOAD DATA LOCAL INFILE '/tmp/airports.dat' REPLACE INTO TABLE airportsFIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' ( apid, name, city, country, iata, icao, y, x, elevation, timezone, dst, tz_id);
  19. That comment pretty much sums up this thread so far. Why don't you tell us exactly what you are trying to accomplish rather than asking about how to do what you think needs to be done
  20. You need to define what 'kind' of communication.
  21. Oops, I gave you a dump of the live server with real data. active_specialty is on the Dev version. Same thing as active, just ones or zeros. I will test the query. Need to make sure it works with the chart as well. Thanks for your efforts.
  22. You dont make sense, you say I want to select all student that there year is college Then you say My error is when I enter year != College. If you want where it does NOT EQUAL college use <> . Select * from student where year <> '".$year."' and age ="5" and favorite number = "10"
  23. The fact that you consider the correct information NON useful shows a complete unwillingness to learn and get better. You obviously didn't even take two seconds to google what hundreds to thousands of other programmers say about using extract. You are going to have a long hard road ahead of you. Good luck getting anyone to help you. * I dont need to "look" advanced. My posts speak for themselves as to my level of expertise.
  24. Not really slick, really bad programming practice.
×
×
  • 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.