Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Linux, Apache, MySQL > MySQL Help

MySQL Help Post any question relating to MySQL here and hopefully someone can help

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2005-01-23, 10:15 PM
dan dan is offline
Junior Member
 
Join Date: Jan 2005
Posts: 4
dan
Default

ok in the process of developing a new site in replace of my old site(on the same host and mysql sever if that helps any) I got "Unknown column 'user_id' in 'field list'" as a database error message for this code:

if ($a AND $b AND $c AND $d AND $e AND $f) {
$query = "SELECT user_id FROM user_profile WHERE user_name = '$HTTP_POST_VARS[user_name]'"; //it won't go past this point!!!!!!!!//
$db_query= @mysql_query($query) or die (mysql_error());
$row = @mysql_fetch_array($db_query) or die (mysql_error());
if ($row){
$message = "That username is already taken. Please select another.
";
} else {
$query2 = "INSERT INTO user_profile (username, password, permission, first_name, last_name, email, site, first_login) VALUES ('$HTTP_POST_VARS[user_name]', '$password', '!', '$HTTP_POST_VARS[first_name]', '$HTTP_POST_VARS[last_name]', '$HTTP_POST_VARS[email]', '$HTTP_POST_VARS[website]', '$timestamp')";
$query_db2 = mysql_query($query2) or die (mysql_error());


now, I'm 100% sure this feild exists, and 100% sure i'm connected to the database
any help would be much appreciated, thank you
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2005-01-24, 07:28 AM
Xnuiem's Avatar
Senior Member
 
Join Date: May 2004
Location: DFW, Texas
Posts: 1,104
Xnuiem will become famous soon enough
Send a message via Yahoo to Xnuiem
Default

That error means only one thing, the field is not in that table.

Make sure the field is there, make sure everything is spelled right.

Also, $HTTP_POST_VARS is deprecated, use $_POST
__________________
I rarely give code examples.
No, I have never used IIS or Windows of any kind as a web server. Get a real OS!
Please don't PM me, I won't respond.
Reply With Quote
  #3 (permalink)  
Old 2005-01-24, 12:26 PM
dan dan is offline
Junior Member
 
Join Date: Jan 2005
Posts: 4
dan
Default

phpMyAdmin is telling me those fileds exist and i just copied and pasted them into my code.

also the following code produces "Unknown column 'entree_id' in 'order clause'" as an error:

default:
$sql = "SELECT * FROM journal_entree ORDER BY entree_id DESC LIMIT $start, 5 ";
$query = mysql_query($sql) or die(mysql_error());
$row =mysql_fetch_array($query);
while($row){
$entree[id] = $row[entree_id];
$entree[user_id] = $row[user_id];
$entree[subject] = $row[subject];
$entree[time] = $row[time];
$entree[entree] = $row[entree];
$entree[ip] = $row[ip];
$entree[browser] = $row[browser];
$sql2 = "SELECT username FROM user_profile WHERE user_id = $entree[user_id]";
$query2 = @mysql_query($sql2) or die(mysql_error());
$entree[name] = @mysql_fetch_array($query_db) or die(mysql_error());
}
return $entree;
break;
}


I've copied and pasted the fields into my code from phpMyAdmin as well. It seems like every mysql query I'm exicuting is returning these type of errors. Could it have anything to do with my configureation? Could it be that i have to many databases?I have 5 up right now.
Reply With Quote
  #4 (permalink)  
Old 2005-01-24, 01:04 PM
Xnuiem's Avatar
Senior Member
 
Join Date: May 2004
Location: DFW, Texas
Posts: 1,104
Xnuiem will become famous soon enough
Send a message via Yahoo to Xnuiem
Default

number of databases wont have anything to do with it.

You may not be connected to the correct database.
__________________
I rarely give code examples.
No, I have never used IIS or Windows of any kind as a web server. Get a real OS!
Please don't PM me, I won't respond.
Reply With Quote
  #5 (permalink)  
Old 2005-01-24, 03:08 PM
dan dan is offline
Junior Member
 
Join Date: Jan 2005
Posts: 4
dan
Default

this is how I connect to my database. I also copy and pasted the name of the data base from phpMyAdmin into $db_info[db].

//CONNECT TO DATABASE//
$db_connection = mysql_connect($db_info[host], $db_info[username], $db_info[password])
or die(mysql_error());
//SELECT DATABASE//
mysql_select_db ($db_info[db], $db_connection) or die (mysql_error());


I'm stummped!!!!
Reply With Quote
  #6 (permalink)  
Old 2005-01-25, 07:10 AM
Junior Member
 
Join Date: Jan 2005
Posts: 2
satty_dey
Default

Please check that the field name user_id does not have a preceeding or trailing blank space, I experienced similar kind of issues and found that there was a trailing blank space
Reply With Quote
  #7 (permalink)  
Old 2005-01-25, 01:39 PM
dan dan is offline
Junior Member
 
Join Date: Jan 2005
Posts: 4
dan
Default

YOU ARE THE BEST HUMAN IN THE FACE OF THIS EATH!!!!!!!!!!!!!!! DO YOU KNOW HOW MUCH TIME I SPENT ON THIS THING AND IT WAS A BLANK SPACE!!!!!!!!!!!!!! I LOVE YOU!!!!!!!!!!!! IF YOU WERE A WOMEN I"D MARRIE YOU ON THE SPOT!!!!!!!!!!!!!!!!!
Reply With Quote
  #8 (permalink)  
Old 2005-01-27, 03:24 AM
Junior Member
 
Join Date: Jan 2005
Posts: 2
satty_dey
Default

Glad that it solved your problem, btw I'm a guy and I'm already married
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.5 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.5 (a popular PHP IDE) and NuCoder 2.0 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 05:32 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.