Jump to content

Albatross

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Everything posted by Albatross

  1. I'm trying to use an sql string to return all records that do not have a specific item in them. Here's the code : $sql = "SELECT id, charname, ban FROM $table_name WHERE approved == 'none'";[/php In the ban field portion of the form that I use as the front end, there are options the person filling it out can use. What I'm trying to have happen is for this string to show me any records that do not equal 'none' (which is the default option). Short version is that I only want to see this with something other than the word 'none' I tried <> and == but didn't work. Any ideas? ~~~ Ok....in writing this I found my own error. [code=php:0]WHERE approved <> should have been WHERE ban <> Reason I'm leaving this post in is in case anyone else hits the same issue.
  2. Did just that and got this : Column count doesn't match value count at row 1 Not sure what else to try...
  3. It's me again The origional problem was that I was trying to connect across 2 diferent domains, and was specifying a local connection, not a remote one. The fix was in my $connection to use ("www.domain.com", "username", "password") or die... but here's a whole new issue for me... Trying to load data to the db from a form and it's going there, but the fields are all shifted to one side. I'll give an example : my code looks something like this : $sql = "INSERT INTO $table_name (name, history, recruiting, email, im, charname, charage, bio, strengths, whatship, responsibilities, sample, rank, position, role, sim, reportsto, comments, approved, ban, reserved) VALUES ('', '$_POST[name]', '$_POST[history]', '$_POST[recruiting]', '$_POST[email]', '$_POST[im]', '$_POST[charname]', '$_POST[charage]', '$_POST[bio]', '$_POST[strengths]', '$_POST[whatship]', '$_POST[responsibilities]', '$_POST[sample]', '$_POST[rank]' '$_POST[position]', '$_POST[role]', '$_POST[sim]', '$_POST[reportsto]', '$_POST[comments]', '$_POST[approved]', '$_POST[ban]', '$_POST[reserved]')"; $result = @mysql_query($sql, $connection) or die(mysql_error()); and what I get in my db is this : Header: name history recruiting email Data: name history recruiting Any suggestions on what Im doing wrong?
  4. Thank you for your reply. While it didn't get me in, it did tell me that I had a username/password error and is not something I have to take up with my ISP. Thank you
  5. I'm a little stumped here because I've been doing it right along...I write a little application, data gets put into it, user hit's submit, it get's fed to the db and a result page is shown (usually with the submitted data so user can correct if they find errors) Problem this time is I'm getting an error. Here's the code: <? $db_name = "dbname"; $table_name = "table"; $connection = @mysql_connect("localhost", "username", "password") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql = "INSERT INTO $table_name (Name, Age, History, Recruiting, Email, IM, Charname, Charage, Bio, Strengths, WhatShip, Responsibilities, Sample) VALUES ('$_POST[Name]', '$_POST[Age]', '$_POST[History]', '$_POST[Recruiting]', '$_POST[Email]', '$_POST[iM]', '$_POST[CharName]', '$_POST[Charage]', '$_POST[bio]', '$_POST[strengths]', '$_POST[WhatShip]', '$_POST[Responsibilities]', '$_POST[sample]')"; $result = @mysql_query($sql, $connection) or die(mysql_error()); ?> And here is the error when I hit submit : Access denied for user 'username'@'localhost' to database 'dbname' If someone would like to see firsthand the sheet i'm using, please go to http://www.ussretribution.com/coappli.htm The submit button is linked to the code above. The rest of the sheet that contains the php code is just the return page showing the user what they did. Quite frankly, I can't see why it doesn't work and am at a loss here. Any help anyone can offer would be greatly appreciated. (Just got haircut so none left to pull out)
×
×
  • 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.