Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 05-05-2009
Member
 
Join Date: Nov 2008
Posts: 1,514
Problem sending mysql database

I have a little trouble with a script for sending mail and adding data in a database, sending mail that is properly but no record is created in the mysql table

PHP Code:
<? php 
  $name_radio  
$_POST ['name_radio']; 
  
$name $_POST ['name']; 
  
$first_name $_POST ['firstname']; 
  
$function $_POST ['function']; 
  
$category $_POST ['category']; 
  
$address $_POST ['address']; 
  
$PostalCode $_POST ['PostalCode']; 
  
$city $_POST ['city']; 
  
$country $_POST ['country']; 
  
$email $_POST ['email']; 
  
$code_license $_POST ['code_license']; 
  
$code_crypt $_POST ['code_crypt']; 
  
$quicontact "radiowinners@gmail.com"

  
$headers 'From: "RadioWinners" <registration@radiowinners.com>'"\n"
  
$headers .= 'Content-Type: text/html; charset = "utf-8"'"\n"
  
$headers .= 'Content-Transfer-Encoding: 8bit'

  
$message '<html> <head> 
  </head> <body> 
  <p> Hi, </p> 
  <p> You receive this email just because a person \ ' 
record Radio Winners. </p
  <
img <psrc="http://www.radyonne.com/images/mail/bas-sep.jpg" width="700" height="1"> </p
  
Name <p> <strongradio: </strong'. $name_radio.' </p
  <
p> <strongName: </strong'. $name.' </p
  <
p> <strongFirst Name: </strong'. $firstname.' </p
  <
p> <strong> Function: </strong'. $function.' </p
  <
p> <strongCategory: </strong'. $category.' </p
  <
p> <strongAddress: </strong'. $address.' </p
  <
p> <strongPostcode: </strong'. $PostalCode.' </p
  <
p> <strongCity: </strong'. $city.' </p
  <
p> <strongCountry: </strong'. $country.' </p
  <
p> <strongEmail: </strong'. $email.' </p
  </
p
  
LICENSE <p> <strongCode: </strong'. $code_license.' </p
  <
p> <strongencrypted code: </ strong'. $code_crypt.' </p
  <
img <psrc="http://www.radyonne.com/images/mail/bas-sep.jpg" width="700" height="1"> </p
  </
p
  </
body> </html'; 

  mail (''. $quicontact.'' '
Registration RADIO WINNERS', $message, $headers); 

  Mysql_connect ( "gffgfgfg", "fgfgfg", "fgfgf"); 
  mysql_select_db ( "fgfgfgf"); 

  mysql_query ( "INSERT INTO radiowinners VALUES ('', '". 
$name_radio. "', '". $name. "', '". $first_name. "', '". $function. "', '". $category. " ','". $address. " ','". $PostalCode. " ','". $city. " ','". $country. " ','". $email. " ' , ' ". $code_license."', ' ". $code_crypt."', '"time ()."') "); 
  ?>
Reply With Quote
  #2  
Old 05-05-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: Problem sending mysql database

Add
Code:
or die (mysql_error ());
after your MySQL functions, it maybe give a hint about the problem.
Reply With Quote
  #3  
Old 05-05-2009
XSI XSI is offline
Member
 
Join Date: May 2008
Posts: 271
Re: Problem sending mysql database

you will create a file:
_connection.php

PHP Code:
<? php 
  $host 
='*****'
  
$user ='****'
  
$pass =''
  
$dbase '******' ;
  
// Connect to server 
  
$connection mysql_connect ($host $user $pass) or die ("Connection Error"); 
  
mysql_select_db ($dbase$connection) or die ("Error connecting database"); 
  
?>
And in your pages you will just have to make (early):

PHP Code:
<? php 
  
// Connection comics 
   
include ( "_connection.php"); 
  
?>
That avoids for all your login codes written in clear in all your pages!
Reply With Quote
  #4  
Old 05-05-2009
Member
 
Join Date: Nov 2008
Posts: 1,514
Re: Problem sending mysql database

Thank you

I found my mistake! I got the error message:

Unknown column 'email' in 'field list'
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Problem sending mysql database"
Thread Thread Starter Forum Replies Last Post
Manipulating MySQL database using PHP blueprats Guides & Tutorials 1 30-04-2010 04:29 PM
Mysql Error : Can't connect to local mysql server through socket ' var lib mysql mysql.sock' 2 roshan45 Software Development 3 07-11-2009 09:36 PM
How to pop up Interactive map by sending data from MYSQL using PHP Neil'o Software Development 3 14-09-2009 11:47 PM
How to add mysql database to localhost? gazwsx Software Development 3 01-07-2009 07:07 PM
Restoring MySQL database Sean J Software Development 5 18-02-2009 01:46 PM


All times are GMT +5.5. The time now is 04:15 PM.