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 2006-08-21, 11:10 PM
Junior Member
 
Join Date: Aug 2006
Posts: 1
cohan1279 is on a distinguished road
Default update mysql table help!!!

Im trying to update a column in a table, thruogh a signup. basicly its for counting members.


PHP Code:
function saveCountryData (&$country$data)
{
    global 
$countrydb$lockdb;
    if (
$lockdb)
        return;
    
$items explode(" ",$data);
    
$update "";
    
$i 0;
    while (
$tmp $items[$i++])
    {
        
$data $country[$tmp];
        if (
is_numeric($data))
            
$update .= "$tmp=$data";
        else
        {
            
sqlQuotes($country[$tmp]);
            
$update .= "$tmp='$data'";
        }
        if (
$items[$i]) $update .= ",";
    } 
PHP Code:
    
    
      mysql_query
("INSERT INTO $countrydb (members);");
    
$ucountry loadCountry(mysql_insert_id());
    
    
$ucountry $ucountry++;
    
saveCountryData($ucountry,"members"); 
Code:
CREATE TABLE country (
  id tinyint unsigned NOT NULL auto_increment,
  name tinytext NOT NULL,
  pres mediumint unsigned NOT NULL default 0,
  vpres mediumint unsigned NOT NULL default 0,
  gov mediumint unsigned NOT NULL default 0,
  tres mediumint unsigned NOT NULL default 0,
  ally1 smallint unsigned NOT NULL default 0,
  ally2 smallint unsigned NOT NULL default 0,
  ally3 smallint unsigned NOT NULL default 0,
  war1 smallint unsigned NOT NULL default 0,
  war2 smallint unsigned NOT NULL default 0,
  war3 smallint unsigned NOT NULL default 0,
  cash bigint unsigned NOT NULL default 100000,
  peasants bigint unsigned NOT NULL default 1000,
  omistrp bigint unsigned NOT NULL default 0,
  dmistrp bigint unsigned NOT NULL default 0,
  armtrp bigint unsigned NOT NULL default 0,
  lndtrp bigint unsigned NOT NULL default 0,
  flytrp bigint unsigned NOT NULL default 0,
  seatrp bigint unsigned NOT NULL default 0,
  wizards bigint unsigned NOT NULL default 0,
  offense float(5,3) NOT NULL default 1.000,
  defense float(5,3) NOT NULL default 1.000,
  bpt float(5,3) NOT NULL default 1.000,
  costs float(5,3) NOT NULL default 1.000,
  magic float(5,3) NOT NULL default 1.000,
  ind float(5,3) NOT NULL default 1.000,
  pci float(5,3) NOT NULL default 1.000,
  expl float(5,3) NOT NULL default 1.000,
  mkt float(5,3) NOT NULL default 1.000,
  food float(5,3) NOT NULL default 1.000,
  runes float(5,3) NOT NULL default 1.000,
  farms float(5,3) NOT NULL default 1.000,
  pic tinytext NOT NULL,
  url tinytext NOT NULL,
  motd text NOT NULL,
  members smallint NOT NULL default 0,
  tag tinytext NOT NULL,
  password tinytext NOT NULL,
  PRIMARY KEY (id)
) TYPE=MyISAM;
ok im very new to php and mysql whats wrong with this code? i cant seem to update members no matter what i try.....


FATAL ERROR: Failed to update country data members='' for country #!

Please help!
Reply With Quote
  #2 (permalink)  
Old 2006-08-22, 11:17 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

Looks like nothing is being given back to the query, the members='' indicates there isnt anything there.
__________________
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
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 11:28 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.