0

Alrighty! My goal here is to add the specified information into a MySQL database, but then also include a script that goes back and checks to make sure that the entrie given does not already exist. If you have any corrections, or any ideas on how to do this, I'd really appreciate it. I posted something simliar in the PHP section, but figured it might be more appropriate to put my code in the snippets.

// Checks if the domain and ip is in the list 

$quer = mysql_query('SELECT * FROM domains WHERE name="$domain"', $con) or die('No domain in the database'); 
$quer2 = mysql_query('SELECT * FROM vhostips WHERE ip="$ip"', $con) or die('No IP in the database'); 
$vhost2 = "$vhost" . "." . "$domain"; 
$query = "SELECT * FROM vhosts"; 
$result = mysql_query($query) or die(mysql_error()); 
$crap = mysql_fetch_array($result); 

print('$crap["vhost"][0]'); 
// Eventually we'll have to see if the IP is attached to the server 
if ($quer && $quer2) { 
$insert = mysql_query("INSERT INTO 
vhosts 
(id, vhost, ip) 
VALUES 
('$id', '$vhost2', '$ip')"); 
if (!$insert) { 
die('Error in MySQL query: ' . mysql_error()); 
} else { 
$blah = "blah"; 
} 
} 
// Print the success page 

if ($blah) { 
print('V-Host ' . $vhost2 . ' added.  IP: ' . $ip . "."); 
} 

?> 
2
Contributors
1
Reply
4
Views
13 Years
Discussion Span
Last Post by Ginetta
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.