PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old December 1st, 2002, 04:24 PM
claire claire is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: paris
Posts: 4 claire User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy error message php

Hello,

I'm completely new here and do not understand most things. I work a little with php and hope someone can help!

I downloaded a 'espace membre' (in french) and set up a llogin page and a mysql database with phpmyadmin. I keep seeing this message when i try to make a new member:

Column count doesn't match value count at row 1

Do you know what I do wrong? I do not understand.
thanks
from
claire

Reply With Quote
  #2  
Old December 1st, 2002, 04:39 PM
infamous-online infamous-online is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 404 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 24 m 44 sec
Reputation Power: 7
could you please post your code where you are having problems at. we can't help you unless you post some code enclosed the php code button like this

[ php] [/php ] without the spaces like this below

PHP Code:
<?
$today 
getdate(); 
$month $today[month]; 
$mday $today[mday]; 
$year $today[year]; 
echo 
"$month $mday, $year"
?>
__________________
Apache Expert

Reply With Quote
  #3  
Old December 2nd, 2002, 07:20 AM
Stephane Eybert Stephane Eybert is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 2 Stephane Eybert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Store your query string in a variable like:

$query = "SELECT * FROM ADMINS";

Then use it to access the table:

mysql_query($query);

It then becomes easy to do a

print $query to see what query you sent to the database engine.

In your case your query has more (or less) columns than what is in the table.

Cheers!

Stephane

Reply With Quote
  #4  
Old December 2nd, 2002, 07:28 AM
claire claire is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: paris
Posts: 4 claire User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thank you for your reply. It is a bit too comlicated to understand yet, but i will try. now i know that the error has to do with a non-matching query-and-table. i will check my code again for that.
it must be something small that is wrong.
thanx again.
i might post the code later as asp-man suggested..
claire

Reply With Quote
  #5  
Old December 2nd, 2002, 07:59 AM
Stephane Eybert Stephane Eybert is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 2 Stephane Eybert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Here is some code to help you...

$query = "SELECT * FROM $db_teacher WHERE id = '$id'";
if (!($result = dbQuery($query))) {
printErrorMessage("$query<BR><BR>$mess_database");
}



// Query the database
function &dbQuery() {
switch(func_num_args()) {
case 1:
return(@mysql_query(func_get_arg(0)));
default:
return(@mysql_query(func_get_arg(0), func_get_arg(1)));
}
}

Reply With Quote
  #6  
Old December 2nd, 2002, 08:52 AM
jasonlotito jasonlotito is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Montreal, CA
Posts: 10 jasonlotito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to jasonlotito
Basically, you have something like this:

Code:
INSERT INTO
    table
(
    field1,
    field2,
    field3
) VALUES (
    'value1',
    'value2'
)


As you can see, the number of fields don't match up with the number of values.

It's easy enough to tell that without needing the source code.

Reply With Quote
  #7  
Old December 2nd, 2002, 09:02 AM
claire claire is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: paris
Posts: 4 claire User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi all,

thank you for helping me. maybe it's just to early for me to start with php...(or maybe i am just stupid). I do not even succeed in pasting this code in properly... (I use the php button, bu if i try to past text there, it only gives the prompt)
I will maybe download another user/login system from this site. so far i have succeeded to log in as a known user, but not to create new users.. I will see if the new code helps. maybe i should just delete the whole id- number thing..
but thanks for the help. I hope i can make myself usefull some day ....
claire
PHP Code:
<?
require("conf.php3");

switch(
$action) {

case 
"add";

$db_link = @mysql_connect($sql_serveur,$sql_user,$sql_passwd)  ;
if(!
$db_link) {echo "Connexion impossible à la base de données <b>$sql_bdd</b> sur le serveur <b>$sql_server</b><br>Vérifiez les paramètres du fichier conf.php3"; exit;}


if(
$pseudo_members==""){echo "Vous devez choisir un pseudo<br><br><a href=\"javascript:window.history.back()\">Retour</a>";exit;}
if(
$passe_members==""){echo "Vous devez choisir un mot de passe<br><br><a href=\"javascript:window.history.back()\">Retour</a>";exit;}

$requete=mysql_db_query($sql_bdd,"select * from members where pseudo=\"$pseudo_members\"",$db_link) or die(mysql_error());
$num=mysql_num_rows($requete);
if(
$num!=0)
    {
    echo 
"Ce pseudo existe déjà, veuillez en choisir un autre<br><br><a href=\"javascript:window.history.back()\">Retour</a>";
    }
else
    {
    

    
$taille 20;
    
$lettres "abcdefghijklmnopqrstuvwxyz0123456789";
    
srand(time());
    for (
$i=0;$i<$taille;$i++)
        {
        
$id.=substr($lettres,(rand()%(strlen($lettres))),1  );
        }
        
    
$requete=mysql_db_query($sql_bdd,"select max(id_member) from members",$db_link) or die(mysql_error());
    
$idmax=mysql_result($requete,0,"max(id_member)");
    
    
    
$idnew=$idmax+1;
    
$requete=mysql_db_query($sql_bdd,"insert into members values ($idnew,\"$id\",\"$pseudo_members\",\"$passe_members\")",$db_link) or die(mysql_error());
    
    
    echo 
"Merci, vous êtes bien enregistré. Cliquez <a href=\"$zone_membre?id=$id\">ici</a> pour entrer dans votre espace privé.";
    }

mysql_close($db_link);

break;

default;
echo 
"    <h2>Nouveau membre</h2>
    <form action=\"adduser.php3\" method=\"post\">
    <input type=\"hidden\" name=\"action\" value=\"add\">
    Chosissez un pseudo<br><input type=\"text\" name=\"pseudo_members\"><br>
    Chosissez un mot de passe<br><input type=\"password\" name=\"passe_members\"><br>
    
    <input type=\"submit\" value=\"Envoyer\">
    </form>
    <font face=\"Verdana\" size=\"2\"><a href=\"index.htm\">Se connecter</a></font>"
;
break;
}
?>


*edit: please use [ php ] and [ /php ] tags for readability!*

Last edited by FrankieShakes : December 6th, 2002 at 01:50 PM.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > error message php


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway