yeahz Posted October 28, 2008 Report Share Posted October 28, 2008 Kā pareizi uzrakstīt šo kodu, lai tas strādātu kā tam pienākas, es mēģināju šādi: $jau_aiznemts = mysql_query("SELECT email FROM users"); if($_POST['email'] != $jau_aiznemts) { $email_update = quote_smart(htmlspecialchars($_POST['email'])); mysql_query("UPDATE users SET email=$email_update WHERE id=$id"); $ok_email = "<h2 class='profils_labots'>Profils labots!</h2>"; } else { $aiznemts_email = "<h2 class='profils_labots_nav'>Šāds e-pasts jau ir aizņemts!</h2>"; } Link to comment Share on other sites More sharing options...
andrisp Posted October 28, 2008 Report Share Posted October 28, 2008 $sql = "SELECT COUNT(*) FROM users WHERE email = '".mysql_real_escape($_POST['email'])"'"; list($email_exists) = mysql_fetch_row(mysql_query($sql)); if ($email_exists) { } else { } Link to comment Share on other sites More sharing options...
yeahz Posted October 28, 2008 Author Report Share Posted October 28, 2008 (edited) Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\AppServ\www\profile_email.php on line 10 10 līnija $sql = "SELECT COUNT(*) FROM users WHERE email = '".mysql_real_escape($_POST['email'])"'"; Edited October 28, 2008 by zekils Link to comment Share on other sites More sharing options...
anonīms Posted October 28, 2008 Report Share Posted October 28, 2008 $sql = "SELECT COUNT(*) FROM users WHERE email = '".mysql_real_escape($_POST['email'])."'"; Link to comment Share on other sites More sharing options...
yeahz Posted October 28, 2008 Author Report Share Posted October 28, 2008 tagad vēlviens, bet vai tā tas maz var būt? Fatal error: Call to undefined function mysql_real_escape() in C:\AppServ\www\profile_email.php on line 10 Link to comment Share on other sites More sharing options...
anonīms Posted October 28, 2008 Report Share Posted October 28, 2008 (edited) Laikam ir $sql = "SELECT COUNT(*) FROM users WHERE email = '".mysql_real_escape_string($_POST['email'])."'"; Edited October 28, 2008 by anonīms Link to comment Share on other sites More sharing options...
mounkuls Posted October 28, 2008 Report Share Posted October 28, 2008 funkcija tāda nav standartā ja nav pašrakstīta. Un tikai. Link to comment Share on other sites More sharing options...
andrisp Posted October 28, 2008 Report Share Posted October 28, 2008 Nu taču typo tas bija. Link to comment Share on other sites More sharing options...
yeahz Posted October 28, 2008 Author Report Share Posted October 28, 2008 iet, paldies. Link to comment Share on other sites More sharing options...
Recommended Posts