theywe 0 Report post Posted November 14, 2007 Error IF statement? Macam mana takda IF Else tapi ada error IF statement? Menarik ni.dah try letak if else.. hehehe yg nie originalnya.. tapi bila letak if else terus error!! dia detect error if statement Share this post Link to post Share on other sites
SHiDi 0 Report post Posted November 14, 2007 dah try letak if else.. hehehe yg nie originalnya.. tapi bila letak if else terus error!! dia detect error if statementBoleh bagi yang siap dengan IF statement tu? Share this post Link to post Share on other sites
theywe 0 Report post Posted November 14, 2007 if ( $_POST['ethnicity']=="Others" ){ ."ethnicity=". $database->Quote($_POST['other_ethnic']) } else { ."ethnicity=". $database->Quote($_POST['ethnicity']) } if ( $_POST['religion']=="Others" ){ ."religion=". $database->Quote($_POST['other_religion']) } else { ."religion=". $database->Quote($_POST['religion']) } Share this post Link to post Share on other sites
SHiDi 0 Report post Posted November 14, 2007 if ( $_POST['ethnicity']=="Others" ){ ."ethnicity=". $database->Quote($_POST['other_ethnic']) } else { ."ethnicity=". $database->Quote($_POST['ethnicity']) } if ( $_POST['religion']=="Others" ){ ."religion=". $database->Quote($_POST['other_religion']) } else { ."religion=". $database->Quote($_POST['religion']) } Bukan ke dalam statement kena ada semi-colon? if ( $_POST['ethnicity']=="Others" ){ ."ethnicity=". $database->Quote($_POST['other_ethnic']); } else { ."ethnicity=". $database->Quote($_POST['ethnicity']); } if ( $_POST['religion']=="Others" ){ ."religion=". $database->Quote($_POST['other_religion']); } else { ."religion=". $database->Quote($_POST['religion']); }Rasanya la kan Share this post Link to post Share on other sites
theywe 0 Report post Posted November 14, 2007 Parse error: syntax error, unexpected T_IF in C:\xampp\xampp\htdocs\Joomla\components\com_user\user.php Share this post Link to post Share on other sites
SHiDi 0 Report post Posted November 14, 2007 Parse error: syntax error, unexpected T_IF in C:\xampp\xampp\htdocs\Joomla\components\com_user\user.php cuba buang titik dekat depan tu. Tengok lak apa jadi. Confused gila ni Share this post Link to post Share on other sites
theywe 0 Report post Posted November 14, 2007 Parse error: syntax error, unexpected T_IF in C:\xampp\xampp\htdocs\Joomla\components\com_user\user.php still error yg sama.. buang titik ke apa ke, dia akan detect if.boleh tak letak if b4 query..then else just post other_ethnic Share this post Link to post Share on other sites
amin007 1 Report post Posted November 14, 2007 if ( $_POST['ethnicity']=="Others" ){ ."ethnicity=". $database->Quote($_POST['other_ethnic']) } else { ."ethnicity=". $database->Quote($_POST['ethnicity']) } if ( $_POST['religion']=="Others" ){ ."religion=". $database->Quote($_POST['other_religion']) } else { ."religion=". $database->Quote($_POST['religion']) } nak tanya, apa fungsi ."ethnicity=". $database->Quote($_POST['other_ethnic']) kalau buang titik pun jadi mcm ni "ethnicity=". $database->Quote($_POST['other_ethnic'])persoalannya ko nak outputkan data pakai echo atau printatau umpukkan dl variable $...lagi satu mcm pendapat shidibukan ker kena tambah semi-colon? Share this post Link to post Share on other sites
SHiDi 0 Report post Posted November 14, 2007 Parse error: syntax error, unexpected T_IF in C:\xampp\xampp\htdocs\Joomla\components\com_user\user.php still error yg sama.. buang titik ke apa ke, dia akan detect if.boleh tak letak if b4 query..then else just post other_ethnicUrgh!!!! Senang re-write je la coding tu boleh?Assuming yang normal select namanya adalah ethnic dan yang others adalah other_ethnic$ethnic = (!empty($_POST['other_ethnic'])) ? $_POST['other_ethnic'] : $_POST['ethnic']; $sql = "UPDATE ethnics SET ethnic = '".$ethnic."' WHERE id = '".$id."'"; mysql_query($sql) or die(mysql_error());Macam ni OK tak? Penat dah nak tengok dewi punya statement tu. Share this post Link to post Share on other sites
theywe 0 Report post Posted November 15, 2007 hehehe penat.. sorry la!! menyusahkanowh statement shidi tak boleh baca :takpe try n error lagi thxs Share this post Link to post Share on other sites
SHiDi 0 Report post Posted November 15, 2007 hehehe penat.. sorry la!! menyusahkanowh statement shidi tak boleh baca :takpe try n error lagi thxsNo worries.Tak boleh baca? Apa error dia? Share this post Link to post Share on other sites
theywe 0 Report post Posted November 15, 2007 Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\xampp\htdocs\Joomla\components\com_user\user.phpParse error: syntax error, unexpected ':' in C:\xampp\xampp\htdocs\Joomla\components\com_user\user.php Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\xampp\htdocs\Joomla\components\com_user\user.phpParse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\xampp\xampp\htdocs\Joomla\components\com_user\user.php ni kebarangkalian yg terjadi.. bila main2 ngan statement nieh.. Share this post Link to post Share on other sites
SHiDi 0 Report post Posted November 15, 2007 Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\xampp\htdocs\Joomla\components\com_user\user.phpParse error: syntax error, unexpected ':' in C:\xampp\xampp\htdocs\Joomla\components\com_user\user.php Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\xampp\htdocs\Joomla\components\com_user\user.phpParse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\xampp\xampp\htdocs\Joomla\components\com_user\user.php ni kebarangkalian yg terjadi.. bila main2 ngan statement nieh..Pergh banyak gila error nya. Dewi mod file mana eh? Share this post Link to post Share on other sites
theywe 0 Report post Posted November 15, 2007 mod file?user.php yang process semua update. Share this post Link to post Share on other sites
SHiDi 0 Report post Posted November 15, 2007 mod file?user.php yang process semua update.OK Cun. Mana code dia? Tengok sket. Share this post Link to post Share on other sites
kamshin 0 Report post Posted November 15, 2007 Ubah daripada:Kepada:$query = "UPDATE userprofile icNo = '" . $database->Quote($_POST['icNo'])."' dob = '" . $database->Quote($_POST['dob'])."' ethnicity = '" . $database->Quote($_POST['ethnicity'])."'";Tak faham apa fungsi Quote() tu. Tapi biasa kalau guna UPDATE mesti ada conditionsimple coding kan ad...buat ap susah2..hehe Share this post Link to post Share on other sites
theywe 0 Report post Posted November 15, 2007 shidi nie la codenya.. code tuk simpan data yg diupdate oleh user. masalah hanya pada ethnic n religion, sebab guna cara yg sama.function userSave( $option, $uid) { global $database, $my, $mosConfig_frontend_userparams; $user_id = intval( mosGetParam( $_POST, 'id', 0 )); // do some security checks if ($uid == 0 || $user_id == 0 || $user_id != $uid) { mosNotAuth(); return; } // simple spoof check security josSpoofCheck(); $row = new mosUser( $database ); $row->load( (int)$user_id ); $orig_password = $row->password; $orig_username = $row->username; if (!$row->bind( $_POST, 'gid usertype' )) { echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; exit(); } $row->name = trim($row->name); $row->email = trim($row->email); $row->username = trim($row->username); mosMakeHtmlSafe($row); if (isset($_POST['password']) && $_POST['password'] != '') { if (isset($_POST['verifyPass']) && ($_POST['verifyPass'] == $_POST['password'])) { $row->password = trim($row->password); $salt = mosMakePassword(16); $crypt = md5($row->password.$salt); $row->password = $crypt.':'.$salt; } else { echo "<script> alert(\"".addslashes( _PASS_MATCH )."\"); window.history.go(-1); </script>\n"; exit(); } } else { // Restore 'original password' $row->password = $orig_password; } if ($mosConfig_frontend_userparams == '1' || $mosConfig_frontend_userparams == 1 || $mosConfig_frontend_userparams == NULL) { // save params $params = mosGetParam( $_POST, 'params', '' ); if (is_array( $params )) { $txt = array(); foreach ( $params as $k=>$v) { $txt[] = "$k=$v"; } $row->params = implode( "\n", $txt ); } } if (!$row->check()) { echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; exit(); } if (!$row->store()) { echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; exit(); } // check if username has been changed if ( $orig_username != $row->username ) { // change username value in session table $query = "UPDATE #__session" . "\n SET username = " . $database->Quote($row->username) . "\n WHERE username = " . $database->Quote( $orig_username ) . "\n AND userid = " . (int) $my->id . "\n AND gid = " . (int) $my->gid . "\n AND guest = 0" ; $database->setQuery( $query ); $database->query(); } //-------------------------update profile------------------------------ $database2 = new database( "localhost", "root", "web", "pod", ""); $query = "UPDATE userprofile" . "\n SET fullname = " . $database->Quote($row->name) . "\n, email = " . $database->Quote($row->email) . "\n, password = " . $database->Quote($row->password) . "\n, icNo = " . $database->Quote($_POST['icNo']) . "\n, dob = " . $database->Quote($_POST['dob']) . "\n, gender = " . $database->Quote($_POST['gender']) //"\n, ethnicity = " $database->Quote(!empty($_POST['other_ethnic'])) ? ($_POST['other_ethnic'] : $_POST['ethnicity']) /*if ( $_POST['ethnicity']=="Others" ){ . "\n, ethnicity = " .$database->Quote($_POST['other_ethnic']); } else { . "\n, ethnicity = " . $database->Quote($_POST['ethnicity']); } if ( $_POST['religion']=="Others" ){ . "\n, religion = " . $database->Quote($_POST['other_religion']); } else { . "\n, religion = " . $database->Quote($_POST['religion']); }*/ . "\n, ethnicity = " . $database->Quote($_POST['ethnicity']) . "\n, religion = " . $database->Quote($_POST['religion']) . "\n, country = " . $database->Quote($_POST['country']) . "\n, state = " . $database->Quote($_POST['state']) . "\n, address = " . $database->Quote($_POST['address']) . "\n, city = " . $database->Quote($_POST['city']) . "\n, postcode = " . $database->Quote($_POST['postcode']) . "\n, interest = " . $database->Quote($_POST['interest']) . "\n WHERE userID = " . $database->Quote( $orig_username ); $database2->setQuery( $query ); $database2->query(); print ("query >> $query <br>"); //--------------------------------------------------------- //---------------------------------------------------------------------------- if (!$row->store(true)) { echo "<script> alert('".html_entity_decode($row->getError())."'); window.history.go(-1); </script>\n"; exit(); } Share this post Link to post Share on other sites
SHiDi 0 Report post Posted November 15, 2007 (edited) Ni full code ke? Copy semua dah ke? Kenapa function userSave() tu tak ditutup? Btw no wonder tak jadi. Salah letak la code yang bagi hari tu. Cuba ni lak. Bermula daripada Update Profile //-------------------------update profile------------------------------ $database2 = new database( "localhost", "root", "web", "pod", ""); $ethnicity = ($_POST['ethnicity'] == "Others") ? $_POST['other_ethnicity'] : $_POST['ethnicity']; $query = "UPDATE userprofile" . "\n SET fullname = " . $database->Quote($row->name) . "\n, email = " . $database->Quote($row->email) . "\n, password = " . $database->Quote($row->password) . "\n, icNo = " . $database->Quote($_POST['icNo']) . "\n, dob = " . $database->Quote($_POST['dob']) . "\n, gender = " . $database->Quote($_POST['gender']) . "\n, ethnicity = " . $database->Quote($ethnicity) . "\n, religion = " . $database->Quote($_POST['religion']) . "\n, country = " . $database->Quote($_POST['country']) . "\n, state = " . $database->Quote($_POST['state']) . "\n, address = " . $database->Quote($_POST['address']) . "\n, city = " . $database->Quote($_POST['city']) . "\n, postcode = " . $database->Quote($_POST['postcode']) . "\n, interest = " . $database->Quote($_POST['interest']) . "\n WHERE userID = " . $database->Quote( $orig_username ); $database2->setQuery( $query ); $database2->query(); print ("query >> $query <br>"); //---------------------------------------------------------Tak pasti la kan. Tapi boleh try. Ubah pada nama field yang betul yeah Tambahan: Sorry lambat balas. Kat office tak ada PHP Editor. Edited November 15, 2007 by SHiDi Share this post Link to post Share on other sites
theywe 0 Report post Posted November 16, 2007 terima kasih la bebanyak.. dah dicuba tapi still di echonya others.. Share this post Link to post Share on other sites
SHiDi 0 Report post Posted November 16, 2007 terima kasih la bebanyak.. dah dicuba tapi still di echonya others..echo others? Tak faham Share this post Link to post Share on other sites
theywe 0 Report post Posted November 16, 2007 echo others? Tak fahamtak maksud dewi.. tak keluar data yg user key in.. still kuar othersdatabase simpan others juga Share this post Link to post Share on other sites
SHiDi 0 Report post Posted November 16, 2007 tak maksud dewi.. tak keluar data yg user key in.. still kuar othersdatabase simpan others jugaDah ubah ke nama post tu kepada user punya input? Apa nama field untuk other ethnic? Dan apa nama field untuk lists of ethnic tu? Yang select tu Share this post Link to post Share on other sites
amin007 1 Report post Posted November 16, 2007 (edited) //-------------------------update profile------------------------------ $database2 = new database( "localhost", "root", "web", "pod", ""); $query = "UPDATE userprofile" . "\n SET fullname = " . $database->Quote($row->name) . "\n, email = " . $database->Quote($row->email) . "\n, password = " . $database->Quote($row->password) . "\n, icNo = " . $database->Quote($_POST['icNo']) . "\n, dob = " . $database->Quote($_POST['dob']) . "\n, gender = " . $database->Quote($_POST['gender']) //"\n, ethnicity = " $database->Quote(!empty($_POST['other_ethnic'])) ? ($_POST['other_ethnic'] : $_POST['ethnicity']) /*if ( $_POST['ethnicity']=="Others" ){ . "\n, ethnicity = " .$database->Quote($_POST['other_ethnic']); } else { . "\n, ethnicity = " . $database->Quote($_POST['ethnicity']); } if ( $_POST['religion']=="Others" ){ . "\n, religion = " . $database->Quote($_POST['other_religion']); } else { . "\n, religion = " . $database->Quote($_POST['religion']); }*/ . "\n, ethnicity = " . $database->Quote($_POST['ethnicity']) . "\n, religion = " . $database->Quote($_POST['religion']) . "\n, country = " . $database->Quote($_POST['country']) . "\n, state = " . $database->Quote($_POST['state']) . "\n, address = " . $database->Quote($_POST['address']) . "\n, city = " . $database->Quote($_POST['city']) . "\n, postcode = " . $database->Quote($_POST['postcode']) . "\n, interest = " . $database->Quote($_POST['interest']) . "\n WHERE userID = " . $database->Quote( $orig_username ); $database2->setQuery( $query ); $database2->query(); print ("query >> $query <br>"); //---------------------------------------------------------awak paparkan print ("query >> $query <br>");dia keluar apa yer?apa kata awak jangan masukkan dlm $database2->setQuery( $query ); $database2->query();letak komen ajelepas tu result $query copy dan paste kat sinip/s dewi ??? teringat pulak satu lagu hehehe Edited November 16, 2007 by amin007 Share this post Link to post Share on other sites
theywe 0 Report post Posted November 16, 2007 Dah ubah ke nama post tu kepada user punya input? Apa nama field untuk other ethnic? Dan apa nama field untuk lists of ethnic tu? Yang select tusemua betul.. takde ubah2 tetap sama jesusah gak hehehe Share this post Link to post Share on other sites
amin007 1 Report post Posted November 16, 2007 Tambahan: Sorry lambat balas. Kat office tak ada PHP Editor.apalah shidi. pakailah http://portableapps.com/1) http://portableapps.com/apps/development/notepadpp_portable2) http://portableapps.com/apps/development/nvu_portable Share this post Link to post Share on other sites