Posts: 175
Location: Wiltshire, England
|
Okay, I think I have my head around it now
Right, first up change if($contactname != "") back to just that. What this is saying is if the contact name sent through to the script from the form is not empty, continue with the process - putting your email address in there will actually cause the script not to run properly.
Secondly, what is your database table called? I believe the reason the fetch_array part isn't working is because the script is querying a table that doesn't exist.
PHP Code:
//CHANGE THIS
$query = "SELECT email FROM contacts WHERE (property_id = '$property')";
//TO THIS
$query = "SELECT email FROM yourtablename WHERE (property_id = '$property')";
//AND THEN CHANGE THIS
$result= mysql_db_query($dbname, $query, $link);
//TO THIS
$result= mysql_db_query($dbname, $query, $link) OR die("<font color=red>Result Error : </font>" .mysql_error());
In the first change, contacts becomes whatever you have called the table in which your data is stored. The fact that your table now contains more columns is not relevant to this script so long as the email column is called email, which it seems to be.
The second change puts in some error reporting functionality that will describe the error as opposed to just giving you warning that it isn't working.
Any more problems, post back or message/e-mail me your code and database structure and I will see what I can do
Regards
Ian.
|