Jump to content

Cook

Members
  • Posts

    64
  • Joined

  • Last visited

    Never

Everything posted by Cook

  1. At the very bottom of the page giving the structure of your table, there's a link that allows you to insert data into the table from a file.
  2. Now your delete query is not well formed. Do you need the name condition? If so, your need to put an and in between the two tests. But then, where does your $name var come from? $sql = "DELETE FROM venues WHERE id = '$id' name='$name'";
  3. Suggest you post the current version of your script.
  4. Your $id is also given to your script via the GET method, not the POST method, so change this line: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]$id = $_POST[\'id\'];[/span][!--PHP-Foot--][/div][!--PHP-EFoot--] to this: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]$id = $_GET[\'id\'];[/span][!--PHP-Foot--][/div][!--PHP-EFoot--] And this line: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]$name = $_POST[\'name\'];[/span][!--PHP-Foot--][/div][!--PHP-EFoot--] appears to be pretty useless.
  5. Ok, think I got it, try adding this right after your $id and $name init at the beginning of your script: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]$task = $_GET[\'task\'];[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]
  6. You connect to your db server, but you don't select a db to work with. Try adding a mysql_select_db() call right after your mysql_connect() call. :edit: my bad, didn't see you were using mysql_db_query() rather than mysql_query(), let me have another look at this code then...
  7. SELECT * FROM `table` ORDER BY RAND() LIMIT 3
  8. You could use MySQL's date formatting functions instead of PHP's as a workaround. I don't have my reference booklet with me here, but you can look it up in the MySQL manual. For my part I prefer to do all date and time manipulations within MySQL as part of my queries, so that I directly get formatted dates and times the way I need it out of my result sets.
  9. Backticks are fine for all identifiers within MySQL queries, to protect from using an identifier that would also be a keyword. Your query should be just fine like so, ie the way you put it at first. Is there anything wrong with it? Do you get an error? [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--] $table_name = $_GET[\'table_name\']; $query = \"SELECT * FROM `$table_name` ORDER BY `id`\"; [/span][!--PHP-Foot--][/div][!--PHP-EFoot--]
  10. Just to make sure, are your timestamp fields of type timestamp (as opposed to datetime)?
  11. I must confess, I bought it, FP2003. I should have broken my leg that day instead. I now code everything by hand, I mean everything, PHP, JS, HTML, CSS, SQL, with a simple yet good text editor, with syntax highlighting for many languages and powerful find/replace capabilities. I'm a bit of a control freak. Generated code scares me, so inefficient, so unreadable, so unmaintainable, you name it.
×
×
  • 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.