•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 374,572 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,817 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
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 . "."); } ?>
Comments (Newest First)
Ginetta | Newbie Poster | Feb 20th, 2008
•
•
•
•
express $con variable (in your sql query)
I don't see it anywhere.
I don't see it anywhere.
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)