Jump to content


no error but empty variables :/

  • Please log in to reply
1 reply to this topic

#1 Cabomba

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 06 April 2003 - 01:21 AM

ello !
im currently workin on a script what allows members to change their profile. im runnin this code on ma localhost, but i have problems with my web hosting. there is no mysql error, everythin seems to work fine but all my variables are empty...

here is my code :

function edit_profile(){

global $member_id, $login, $password,$nom; 

global $prenom, $email, $position, $age;

global $location, $pc_specs, $sensitivity; 

global $connection, $pastclans, $interests; 

global $fav_map, $fav_weapon, $config, $PHP_SELF;

$id_lien = db_connect($nomdb = \'\');

if(!$id_lien) error_message(sql_error());

$recherche = "SELECT * FROM utilisateurs WHERE (User_ID=\'$member_id\' AND login=\'$login\' AND password=\'$password\')";

$resultat = mysql_query($recherche);

if(!$resultat) error_message(sql_error());

$donnees_rech = mysql_fetch_array($resultat);

$nom = $donnees_rech["nom"];

$prenom = $donnees_rech["prenom"];

$email = $donnees_rech["email"];

$position = $donnees_rech["position"];

$age = $donnees_rech["age"];

$location = $donnees_rech["location"];

$pc_specs = $donnees_rech["pc_specs"];

$sensitivity = $donnees_rech["sensitivity"];

$connection = $donnees_rech["connection"];

$past_clans = $donnees_rech["past_clans"];

$interests = $donnees_rech["interests"];

$fav_map = $donnees_rech["fav_map"];

$fav_weapon = $donnees_rech["fav_weapon"];

$config = $donnees_rech["config"];


<p><b><? echo $login ?></b> - Editing profile</p>

<form name="form" method="post" action="<?echo "$PHP_SELF?module=editprofile&action=submit" ?>" enctype="multipart/form-data">

         <table width="90%" border="0" cellspacing="2" cellpadding="2">


                     <td width="100">first name</td>


                          <input type="text" name="prenom" value="<? echo $prenom ?>" class="border"></td>


etc, etc .....

I tried everything... i thought there were a problem with ma global variables (?) so i cut the code and tried it out of the function, etc etc... but nothing worked, i always get the same problem :

the variables supposed to be displayed in the form are empty. the $login is the only one working cause i registered it in the session, but i cant take anything from the database....

the most strange thing is that it works perfectly on my localhost and the query result isnt empty ?!? :/

thank you for your help. I spent 4 hours on it, its time to go to bed :*(

#2 Cabomba

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 06 April 2003 - 09:59 AM

in fact, in the WHERE clause, the $password was my MySQL pass.
I renamed the member password of the session into $member_pass and wrote WHERE blabla ... AND password = \'$member_pass\' and it works :P
6 hours tryin to debug my code because of a simple variable .. arrgh

the only strange thing is that it doesnt display an error if the query result is empty cause i had no error with the previous variable although the query didnt work....

well, i dont want to talk about this any longer heeh


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users