Jump to content

Pikachu2000

Staff Alumni
  • Posts

    11,369
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Pikachu2000

  1. As long as you're editing things, you'll probably find debugging a lot easier if you make the query string readable by getting rid of all that obnoxious concatenation. $query = "INSERT INTO image ( title, type, name, alt, img, description, date) VALUES ( '$title', '{$_FILES['userFile']['type']}', '{$_FILES['userFile']['name']}', '$alt', '$image', '$description', NOW() )";
  2. You want the MySQL function NOW(), not $NOW(), and it shouldn't be in quotes in the query string.
  3. I'm assuming since you posted in the MS SQL forum, you're indeed using Microsoft SQL? If so, here are all of the mssql functions: http://us1.php.net/manual/en/ref.mssql.php If not, what database are you using?
  4. You've say echoed the whole query when the error occurs? Post that as well. INT(2) only sets the display width, not the number of digits the field can hold, a single '1' would be padded with a zero to read '01'.
  5. I'm going to guess that $id has no value. If the `id` field in the database is an autoincrement field, you can just leave it out of the query entirely. Why use INT(2) by the way?
  6. You aren't executing the query, you're just passing the variable containing the query string (as would be implied by "string given") to mysql_fetch_array().
  7. Why did you change it to something you didn't want, when there was a message clearly indicating you can only change it once a year?
  8. MySQL's DATE() function should help you. SELECT field FROM table WHERE DATE(datetime_field) BETWEEN '2010-01-02' AND '2011-12-31'
  9. This topic has been moved to Introductions. http://www.phpfreaks.com/forums/index.php?topic=355488.0
  10. Most of your problem is in the way you're quoting things. String values get enclosed in single 'quotes'. Normally, table and field names don't need to be enclosed in anything unless they happen to be MySQL reserved words, in which case, they get enclosed in `backticks`. Backticks are not used in the php functions to connect to the db.
  11. You're using single 'quotes' where you should be using `backticks`.
  12. Where did you get that IP address from? Is MySQL on your local machine, or is it on a hosted server?
  13. Yup, that's the problem. Is it your server, or hosted?
  14. You haven't told us what "the problem" actually is, including any errors, etc. you're getting, and what you've already tried to debug it yourself.
  15. It sounds like you're in SQL strict mode. What does this query show you when you execute it in phpMyAdmin or from the mysql command line? SELECT @@SESSION.sql_mode
  16. You can't mix mysql_* extension functions with mysqli_* extension functions. Pick one or the other. You should be developing with the following directives in your php.ini file. Find the directives, edit their values then restart Apache. error_reporting = -1 display_errors = On
  17. Being that you were looking for $_GET variables, leaving method="post" out of the form wasn't causing the problem because form methods default to get when no method is specified. Regarding your database question, I'm not really sure what you're asking . . .
  18. Where do you see ternary syntax in that code? I've looked through it 4 times, and I'll be damned if I can spot it.
  19. There was nothing really wrong with the syntax the way you had it to begin with. The logic, on the other hand, needs some work, and string values need to be escaped. Numeric values do not need to be escaped by some catch-all function; they need to be validated and cast as the correct data type.
  20. This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=355432.0
  21. It would appear that in reality, there is not. Have you echoed the query string yet?
  22. $totalcost, being a presumably numeric value is unquoted in the query string. If there is no value, you'll need to explicitly assign it 0 or NULL. You also should be developing with the following directives in your php.ini file: error_reporting = -1 and display_errors = On.
×
×
  • 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.