Jump to content

Recommended Posts

thank you it works, but I have little concern, I want to associate in the same file js validation and ajax function. instead of executing all the code, it runs a single

Share this post


Link to post
Share on other sites
On 5/16/2019 at 7:09 AM, dsonesuk said:

As only YOU! Have access to the code, I should think you did something wrong. 

 

Share this post


Link to post
Share on other sites

this is my query code 

 

$(document).ready(function(){
$('#submit').click(function(event){
 
event.preventDefault();
var name = $('#name').val();
var email = $('#email').val();
if(name == '' || email == '')
{
$('#error_message').html("Tous les champs sont obligatoire");
}
else
{
$('#error_message').html('');
$.ajax({
type:'POST',
url:'connexion.php',
data:{name:name, email:email},
success:function(data){
$("form").trigger("reset");
$('#success_message').fadeIn().html(data);
setTimeout(function(){
$('#success_message').fadeOut("Slow");
}, 2000);
 
}
 
});
}
 
});
});
,
 
$(function(){
 
$('#formu').validate({
rules:{
email:{
required:true,
email:true



 
}
 
}


 
});


 
});
 
</script>
 



 

Share this post


Link to post
Share on other sites

Check your browser's error console, you have random punctuation in there.  You should really make an effort also to keep your code formatted and indented without a bunch of extra lines so that it's easy to read.

Share this post


Link to post
Share on other sites

You can put as many functions coding within a file as like as long as they have access to all required resources to run and is correct so it does not break functionality of code following it.

Share this post


Link to post
Share on other sites

in my case the code above, there are two functions the first function does not run, but jquery validation that run in the second position what can i do to run all the two

Share this post


Link to post
Share on other sites

Did you fix the syntax error in your code above?  The reason it doesn't work is because you have a syntax error.  That's why you need to look at your browser's developer console to see the error message.

Share this post


Link to post
Share on other sites

It will help if you answer questions that we ask.  Are you looking at your browser's developer console?  Do you see the error message?

Share this post


Link to post
Share on other sites

You use a select query to get matching records and see if you get any.

Share this post


Link to post
Share on other sites

Hi guys, someone can help me for my database. I will only when registering the form that make the comparison to enter it, like username and email using ajax and php.

this is my code

 

<?php
if(isset($_POST['email'])){
$servername = "localhost";
$username = "root";
$password = "Robss123";
$dbname = "news";
 
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
$email = $_POST['email'];
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
 
$name = mysqli_real_escape_string($conn, $_POST['name']);
$email = mysqli_real_escape_string($conn, $_POST['email']);
 
$sql = "INSERT INTO guyst(name,email)
VALUES('$name', '$email')";
$sql ="SELECT *FROM guyst WHERE guyst_email='$email'";
$result = mysql_query($conn,$sql);
if($result->num_row >0)
{
   echo 'cet email est déjà utilisée';
}
 
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
 
}
$conn->close();
 
function test_input($data)
{
$data=trim($data);
$data=stripslashese($data);
$data=htmlspecialchars($data);
return $data;
}
 
?>

Share this post


Link to post
Share on other sites

You're mixing mysql and mysqli functions.  They don't work together.  You also immediately overwrite your insert query with a select query because you're using the same variable name.

Share this post


Link to post
Share on other sites

Hi sir, you can help me find this server to distribute the updates in my website. here is the link I found: updates-http.cdn-apple.com/2019SpringFCS/fullrestores/041-68314/CC3C4D6, in other site when I try to download it outside the iTunes

Share this post


Link to post
Share on other sites

If I use wget with that it gives me a 403 response, you want people to help you get around Apple's authentication?  If you want to distribute Apple's software, then contact Apple and tell them you want to distribute their software.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...