Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $con=mysqli_connect("localhost","root","","dir");
- // Check connection
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- $query = mysqli_query("SELECT * FROM links WHERE url='$_POST[url]'");
- if(mysql_num_rows($query) != 0)
- {
- echo "Link post already exists";
- exit();
- }
- else
- {
- $sql="INSERT INTO link (url, title, desc, keyw, htags)
- VALUES
- ('$_POST[url]','$_POST[title]','$_POST[desc]','$_POST[keyw]','$_POST[htags]')";
- }
- if (!mysqli_query($con,$sql))
- {
- die('Error: ' . mysqli_error($con));
- }
- echo '<h1>Successfully Created New Link! Your New Link Is:</h1>';
- echo '<a href="list.php" target="_blank">CLICK HERE TO VIEW LIST</a>';
- mysqli_close($con);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement