Cabomba Posted April 6, 2003 Share Posted April 6, 2003 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"> <tr> <td width="100">first name</td> <td> <input type="text" name="prenom" value="<? echo $prenom ?>" class="border"></td> </tr> 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 :*( Quote Link to comment https://forums.phpfreaks.com/topic/308-no-error-but-empty-variables/ Share on other sites More sharing options...
Cabomba Posted April 6, 2003 Author Share Posted April 6, 2003 :/ 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 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 l8rz Quote Link to comment https://forums.phpfreaks.com/topic/308-no-error-but-empty-variables/#findComment-986 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.