View Single Post
Old 10-18-2008, 04:51 PM   #34 (permalink)
codefreek
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Bug Thank you in advance!

I tried that,
sketchMedia what you posted and made the link spot in db unique but when i try to submit something it only prints out echo 'Your link was added to the database';
but noting happens :/


This is how it looks now ?

any ideas,
and thank you everyone for the help!
i learn so much from you, and i will never forget the
kindness that i get from talkphp, specially, wildhoney
and sketchMedia, and tony! great people!
and of course my friend tanax! :D


PHP Code:
<?php
error_reporting
(E_ALL E_NOTICE);
include 
"config.php";
 
if(isset(
$_POST['submit']))    {
 
   
$url $_POST['url'];
 
if(
strlen($url)<1) {
        
        print 
"You did not enter a URL.";
        
        }
    
    else
    
        {
        
                
if(
preg_match('~^http://(?:[a-z]{2,3}\.)?youtube\.com/\?v=([\w-]+)~i'$url))    {
    
 
$sql "INSERT IGNORE INTO `upload` (`link`) VALUES('$url')";

mysql_query($sql) or die(mysql_error());

if(!
mysql_affected_rows())    {
    

    echo 
'Link already exists';
}
}
else
    {
    echo 
'Your link was added to the database';
    }  
  }
}


else
{
    print 
"<form action='index.php' method='post'>";
    print 
"URL(include http://):<br>";
    print 
"<input type='text' name='url' size='20'><br>";
    print 
"<input type='submit' name='submit' value='submit'></form>";


?>
Thank you in advance!


btw, willdhoney i bought ZendStudio ;)
but is there anyways to make the debug function to check for
common newbie mistakes ;)
codefreek is offline  
Reply With Quote