Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry Adnet service : out.php proble :(

    Hello,
    This is my first post in this splendid community, I hope I respect every rule.
    PHP Code:
    <?php 
    include("connections/adnet.php"); 
    $id $_GET['id']; 

    if (empty(
    $id)) { 
    echo (
    'Do not try to steel my scripts !!'); 
    } else { 
    $checkid mysql_query("SELECT * FROM website WHERE id='$id'"); 
    $numid mysql_num_rows($checkid); 
    if (
    $numid 1) { 
    die(
    'This id does not exist !!'); 
    } else { 
    $array mysql_fetch_array($checkid); 
    $out $array['out']; 
    $newout $out++;
    $update mysql_query("UPDATE `website` SET `out`='$newout' WHERE `id`='$id'") or die(' There has been an error processing your website'.mysql_error());  
    if (!
    $update) { 
    die(
    'There has been an error, try again'); 
    } else { 
    header("Location: $array[URL]"); 



    ?>
    I don't get an error, but basically, out, which is currently 0, doesn't go to 1 !!
    Please help me, there is no error, it goes correctly yo thr URL, but doesnt add anything

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think from that code, $out is being assigned to $newout and THEN incremented afterwards. Try:

    PHP Code:
    $out $array['out']; 
    $out++;
    $newout $out
    Also I'm not sure the header redirect will work with the array[url]? Try either surrounding the $array with curly braces or closing the quotes, ie:

    PHP Code:
    header("Location: {$array[URL]}");

    or

    header("Location: " $array[URL]); 
    Last edited by delinear; 06-06-2005 at 11:22 AM.

  • #3
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by delinear
    I think from that code, $out is being assigned to $newout and THEN incremented afterwards. Try:

    PHP Code:
    $out $array['out']; 
    $out++;
    $newout $out
    Also I'm not sure the header redirect will work with the array[url]? Try either surrounding the $array with curly braces or closing the quotes, ie:

    PHP Code:
    header("Location: {$array[URL]}");

    or

    header("Location: " $array[URL]); 
    Yay !!
    It works !!
    Thanks a lot !!
    The header thing works okay, no problem, now I have a new problem :
    PHP Code:
    <?php
    session_start
    ();
    include(
    "connections/adnet.php");

    //variables
    $creator $_SESSION['username'];
    $name $_POST['name'];
    $url $_POST['URL'];
    $null "0";
    $nothing "0";

    if (
    $_SESSION['username']) {
        if (empty(
    $name)) {
            die(
    'You have not put in a website name, try again');
        }
        if (empty(
    $url)) {
            die(
    'You have not put in a website URL, try again');
        }
        
    $query mysql_query("SELECT * FROM website WHERE URL='$url'");
                    
    $numquery mysql_num_rows($query);
        if (
    $numquery != 0) {
            die(
    'The website name or URL you have tried to put in already exist');
        } else {
            
    $insert mysql_query("INSERT INTO website (URL, creator, in, out, website)
                    VALUES('$url', '$creator', '$null', '$nothing', '$name'"
    ) or die('There has been an error processing your submition'.mysql_error());

                echo 
    "Your website has been successfully\n added, add this code to your site :<br />\n";
                
    $site mysql_query("SELECT * FROM website WHERE URL='$url'");
                
    $array mysql_fetch_array($site);
                
    ?>
                &lt;a href="out.php?id=<?php echo $array[id?>" target="_blank"&gt;<br />
                &lt;img src="images/affiliates/flashindustriesbanner4.png" alt="Flashindustries" &gt;<br />
                            &lt;/a&gt;
                            <?php
        
    }
    } else {
        die(
    'You are not logged in !');
    }
    ?>
    It shows the following :
    Quote Originally Posted by MYSQL
    There has been an error processing your submitionYou have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'in, out, website) VALUES('test', 'markman', '0'
    Please help me, I am really lost with MySQl and I have to finish this by Wednesday

  • #4
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It looks like you're just missing a closing bracket inside the sql query, try the following I think it should fix the problem:

    PHP Code:
    $insert mysql_query("INSERT INTO website (URL, creator, in, out, website) VALUES('$url', '$creator', '$null', '$nothing', '$name')") or die('There has been an error processing your submition'.mysql_error()); 

  • #5
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry, gives me the same stupid error as before
    ________________EDIT_____________
    New script :
    PHP Code:
    <?php
    session_start
    ();
    include(
    "connections/adnet.php");

    //variables
    $creator $_SESSION['username'];
    $name $_POST['name'];
    $url $_POST['URL'];
    $null "0";
    $nothing "0";

    if (
    $_SESSION['username']) {
        if (empty(
    $name)) {
            die(
    'You have not put in a website name, try again');
        }
        if (empty(
    $url)) {
            die(
    'You have not put in a website URL, try again');
        }
        
    $query mysql_query("SELECT * FROM website WHERE URL='$url'");
                    
    $numquery mysql_num_rows($query);
        if (
    $numquery != 0) {
            die(
    'The website name or URL you have tried to put in already exist');
        } else {
    $insert mysql_query("INSERT INTO website (URL, creator, in, out, website) VALUES('$url', '$creator', '$null', '$nothing', '$name')") or die('There has been an error processing your submition'.mysql_error());

                echo 
    "Your website has been successfully\n added, add this code to your site :<br />\n";
                
    $site mysql_query("SELECT * FROM website WHERE URL='$url'");
                
    $array mysql_fetch_array($site);
                
    ?>
                &gt;a href="out.php?id=<?php echo $array[id?>" target="_blank"&lt;<br />
                &gt;img src="images/affiliates/flashindustriesbanner4.png" alt="Flashindustries" &lt;<br />
                            &gt;/a&lt;
                            <?php
        
    }
    } else {
        die(
    'You are not logged in !');
    }
    ?>
    Last edited by markman; 06-06-2005 at 12:44 PM.

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    INSERT INTO website (URL, creator, in, out, website) VALUES('$url', '$creator', '$null', '$nothing', '$name')
    The name of one of your table's fields conflicts with a reserved keyword in MySQL, namely 'in'. IN() is used to test whether a value belongs to a set of other values. If you have named your field like that, you need to put backticks around the field name in your query to not confuse the SQL parser:

    Code:
    INSERT INTO website (URL, creator, `in`, out, website) VALUES('$url', '$creator', '$null', '$nothing', '$name')
    De gustibus non est disputandum.

  • #7
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    thanks !!

    Thanks mordred, you guys are truly amazing people !

  • #8
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    thanks !!

    Thanks mordred, you guys are truly amazing people !


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •