View Single Post
Old 10-17-2008, 11:32 PM   #27 (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
Help

i get this
Parse error: syntax error, unexpected T_ELSE in C:\wamp\www\t\index.php on line 39

and when i fix the bracket for the if thing it gives me same error just on line 63 :S


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

{

    

$videoid 'ML5T1Lm7oO8';
$query mysql_query("SELECT `id` FROM `upload` WHERE `id` = '{$videoid}' LIMIT 1") OR die(mysql_error());

if (
mysql_fetch_array($query))    {
                
                print 
"error";
                
                }

}

else

{
    

if (
preg_match('~^http://(?:[a-z]{2,3}\.)?youtube\.com/watch\?v=.+$~i'$url))     {
    
        
$sql "INSERT INTO `upload` (`link`) VALUES('$url')";
        
mysql_query($sql) or die(mysql_error());
        print 
"Link added!";
                
    
        
}


else
            {
        
                print 
"Link is invalid";
            
            }

}
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>";
    
}






include 
"watch.php";




?>
Why t_else error?

PS: thank you wildhoney i will look into that..

PS2: ID is primary in my db should it be the link ? or ?..
codefreek is offline  
Reply With Quote