Jump to content

customize script


mattm1712

Recommended Posts

i have been given this code which is wrong because it doent match my databases

but i have never seen this join function before

 

<?php

 

$result4 = mysql_query("SELECT * FROM comments JOIN users on comments.submittedby=users.name WHERE comments.id=$t");

    while($row = mysql_fetch_assoc($result4));

  {

    $to      = $row['email'];

$subject = 'the subject';

$message = 'hello';

$headers = 'From: webmaster@example.com' . "\r\n" .

    'Reply-To: webmaster@example.com' . "\r\n" .

    'X-Mailer: PHP/' . phpversion();

 

mail($to, $subject, $message, $headers);

  }

?>

 

 

 

in my database i have 2 tables one called 'users' which has titles.    name email and pass  then i have another one called comments  with titles  id comments submittedby and title. 

 

i have the varible t$ which will be equal to the id in the comments table, from this i want to selct the submittedby name in the commens table, this wi be the same as the name in the users table, then i want to echo out the email adress.

 

can anyone help?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.