I am developing a program in which I need to read a text file every time it is saved in a path
Gael Rodriguez's questions
How are you,
I have a table in which I want to count the values of each cell in a row to compare them with the values of the cells in the following rows. In the end, take the largest value.
This is an example of my table, in which the first row is 15 and the second 4, therefore the largest is 15.
Greetings.
Hi, I have a query which works fine.
SELECT PAPA.idPAPA AS PAPA, HIJO.idHIJO AS HIJO, NIETO.idNIETO AS NIETO,
BISNIETO.idBISNIETO AS BISNIETO
FROM PAPA
LEFT JOIN HIJO ON HIJO.PreH=PAPA.idPAPA
LEFT JOIN NIETO ON NIETO.PreN=HIJO.idHIJO
LEFT JOIN BISNIETO ON BISNIETO.PreB=NIETO.idNIETO
ORDER BY idPAPA,idHIJO,idNIETO,idBISNIETO ASC;
The following table returns me, when I already enter 2 different PARENTS:
Which is correct, however, I want to add a WHERE idPAPA="A", so that it only gives me the query for PAPA "A".
I have this query but it doesn't run.
SELECT idPAPA, idHIJO, idNIETO, idBISNIETO
FROM
(SELECT PAPA.idPAPA AS PAPA, HIJO.idHIJO AS HIJO,NIETO.idNIETO AS
NIETO,BISNIETO.idBISNIETO AS BISNIETO
FROM PAPA
LEFT JOIN HIJO ON HIJO.PreH=PAPA.idPAPA
LEFT JOIN NIETO ON NIETO.PreN=HIJO.idHIJO
LEFT JOIN BISNIETO ON BISNIETO.PreB=NIETO.idNIETO
WHERE idPAPA="A"
) ORDER BY idPAPA,idHIJO,idNIETO,idBISNIETO ASC
;
Thanks.
How about, I'm making a database with different tables which depend linearly. I show them next.
Within each table there may be several activities that depend on other activities. I just added the many-to-many relationship tables, however, I don't know what code to use to create another table that tells me if a father has several children and that more than one child can have the same father. The variables that matter to me are the id and the Pre (Precedents).
I have a question about the Headers part of a form that I have created in PHP: What mail goes in the headers?
PHP code:
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
And within my mail, the correct way to put the mail, what is it?
Is:
$resultado= @mail($to,$email_subject,$email_body,$headers);
Or this one:
$resultado= mail($to,$email_subject,$email_body,$headers);
I am new to these platforms, I already have the code in HTML and PHP, however when sending a message from the page that has already been uploaded to a server, the email that I enter in PHP does not arrive, I would like to know what part of the code makes me lack.
HTML code:
<form action="contact_me" method="post" name="sentMessage" id="contactForm" >
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input type="text" id="name" class="form-control" placeholder="Nombre" required="required">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="email" id="email" class="form-control" placeholder="Correo" required="required">
<p class="help-block text-danger"></p>
</div>
</div>
</div>
<div class="form-group">
<textarea name="message" id="message" class="form-control" rows="4" placeholder="Mensaje" required></textarea>
<p class="help-block text-danger"></p>
</div>
<div id="success"></div>
<button type="submit" class="btn btn-default">Enviar</button>
</form>
PHP code:
<?php
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['message']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!";
return false;
}
$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];
$to = '[email protected]'; /
$email_subject = "Website Contact Form: $name";
$email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nMessage:\n$message";
mail($to,$email_subject,$email_body,$headers);
return true;
?>
Thanks.