SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    In a house in the USA
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Passing DB field to $variable

    Hello, I am working on an order form script and I am making it work with a database instead of being "hard coded". I am trying to use a db field as a variable to email. I have the following code hard coded into the script now:
    PHP Code:
    $mstText "Name:  $name";
    mail($to$subject$msgText"To: $to <$to>\n" "From: $to <$to>\n"); 
    I was told that the following code would do that but it doesn't work:

    PHP Code:
    $q mysql_query("SELECT mess FROM order_message WHERE id=1");
    list(
    $msgText) = mysql_fetch_array($q);
    mail($to$subject$msgText"To: $to <$to>\n" "From: $to <$to>\n"); 
    Any Suggestions?
    Daniel
    http://www.wlscripting.com - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers

  2. #2
    SitePoint Member Wankster's Avatar
    Join Date
    May 2003
    Location
    Poland
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •