Jump to content

panth

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by panth

  1. I personally like working with echo rather with <? ?> each time i want to enter HTML code in your first script not in delete_notice.php

     

    as for the delete_notice.php script for debuging i\'d always rather use mysql_error() instead of text in \'or die( )\' part

    this will give you a main idea why you have problems

    if you still can\'t solve it

    come to here and paste what the problems are...

     

    original code :

     

    
    $id = $_POST[\'id\']; 
    
    
    
    $link = mysql_connect("localhost", $dbuser, $dbpass) or die ("Database Error: Couldn\'t Connect!"); 
    
    
    
    mysql_select_db($dbname, $link) or die ("Couldn\'t open $dbname!"); 
    
    
    
    $query = "DELETE FROM notices WHERE \'id\' = \'$id\' "; 
    
    
    
    mysql_query($query, $link) or die ("Couldn\'t delete data!"); 
    
    
    
    
    
    mysql_close($link); 
    
    
    
    include "header.php"; 
    
    print \'<center>\'; 
    
    print \'<br>\'; 
    
    print \'Notice(s) succesfully deleted\'; 
    
    print \'<br>\'; 
    
    print \'<a href="noticeadmin.php">Return to Notices Administration</a>\'; 
    
    print \'<center>\'; 
    
    

     

     

    change into

     

    
    $id = $_POST[\'id\']; 
    
    
    
    $link = mysql_connect("localhost", $dbuser, $dbpass) or die (mysql_error()); 
    
    
    
    mysql_select_db($dbname, $link) or die (mysql_error()); 
    
    
    
    $query = "DELETE FROM notices WHERE \'id\' = \'$id\' "; 
    
    
    
    mysql_query($query, $link) or die (mysql_error()); 
    
    
    
    mysql_close($link); 
    
    
    
    include "header.php"; 
    
    print \'<center>\'; 
    
    print \'<br>\'; 
    
    print \'Notice(s) succesfully deleted\'; 
    
    print \'<br>\'; 
    
    print \'<a href="noticeadmin.php">Return to Notices Administration</a>\'; 
    
    print \'<center>\'; 
    
    

  2. Let\'s say I want to add a IRC channel into a database

    the irc chan is #we\'re-lost

    what do i need to do to have the \' not f****** my database

     

    (INSERT INTO somewhere VALUES (irc) \'We\'re-lost\')

     

    What do I need to make it work?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.