Jump to content

aztec

Members
  • Posts

    100
  • Joined

  • Last visited

    Never

Posts posted by aztec

  1. Hello

     

    Part of my database management modules includes an option to delete an entire row from the database, this works without any problems.

     

    However I would like to include an option that after the DELETE is clicked a YES or No button would be displayed before the actual delete in the MYSQL database took place, to allow second thoughts.

     

    i.e. click YES to delete or click NO to cancel the delete operation.

     

    I have been searching both the forum and the Web with no success.

     

    Any help or guidances much appreciated.

     

    Kind Regards

  2. Hello

     

    I am having a problem getting multiple fields posted from a form using PHP into a MYSQL database.

     

    The following code will only allow me to input the first field, ie first_name into the database.

     

    I do not get any errors and after I click submit the form regenerates but without informing me that a new person as been added.

     

    Any help would be appreciated.

     

    Kind Regards

     

     

     

    
    <?php if (isset($_POST['first_name'])):
      $dbcnx = @mysql_connect('xxxxxx', 'yyyyyy', 'zzzzzz');
      if (!$dbcnx) {
        exit('<p>Unable to connect to the ' .
            'database server at this time.</p>');
      }
    
      if (!@mysql_select_db('xxxxxx')) {
        exit('<p>Unable to locate the xxxxxx ' .
            'database at this time.</p>');
      }
    
    $first_name = $_POST['first_name'];  
      $second_name = $_POST['second_name'];
      $surname = $_POST['surname'];
    
      
    
    $sql = "INSERT INTO QQQQQQ SET  		
          	first_name='$first_name',
          	second_name='$second_name',
          	surname = '$surname'”;
    
    <?php else: // Allow the user to enter a new person ?>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
    <table> 
       
       <tr>  <!--<label>First Name:<input type="varchar" name="first_name" /></label><br />-->
         <td colspan="2" class="lablecell"><label>First Name</label></td> 
         <td colspan="2" class="fieldcell"> <input type="varchar" name="first_name" /></td> 
       </tr> 
       <tr>  
         <td colspan="2" class="lablecell"><label>Second Name</label></td> 
         <td colspan="2" class="fieldcell"> <input type="varchar" second_name="second_name" /></td> 
       </tr> 
       <tr>  
    <td colspan="2" class="lablecell"><label>Surname</label></td> 
         <td colspan="2" class="fieldcell"> <input type="varchar" surname="surname" /></td> 
       </tr> 
       <tr>  
         <td colspan="2"><input type="submit" name="Submit" value="Submit"  /></td> 
       </tr> 
    </table> 
    </form>
         	<?php endif; ?>		
    
    

  3. Hello

     

    I am having a problem getting multiple fields posted from a form using PHP into a MYSQL database.

     

    The following code will only allow me to input the first field, ie first_name.

     

     

    <?php if (isset($_POST['first_name'])):
      $dbcnx = @mysql_connect('xxxxxx', 'yyyyyy', 'zzzzzz');
      if (!$dbcnx) {
        exit('<p>Unable to connect to the ' .
            'database server at this time.</p>');
      }
    
      if (!@mysql_select_db('xxxxxx')) {
        exit('<p>Unable to locate the xxxxxx ' .
            'database at this time.</p>');
      }
    
      $first_name = $_POST['first_name'];  
      $second_name = $_POST['second_name'];
      $surname = $_POST['surname'];
    
    
    
    
    $sql = "INSERT INTO QQQQQQ SET  		
          	first_name='$first_name',
          	second_name='$second_name',
          	surname = '$surname'”;
    
    <?php else: // Allow the user to enter a new person ?>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
    <table> 
       
       <tr>  <!--<label>First Name:<input type="varchar" name="first_name" /></label><br />-->
         <td colspan="2" class="lablecell"><label>First Name</label></td> 
         <td colspan="2" class="fieldcell"> <input type="varchar" name="first_name" /></td> 
       </tr> 
       <tr>  
         <td colspan="2" class="lablecell"><label>Second Name</label></td> 
         <td colspan="2" class="fieldcell"> <input type="varchar" second_name="second_name" /></td> 
       </tr> 
       <tr>  
         <td colspan="2" class="lablecell"><label>Surname</label></td> 
         <td colspan="2" class="fieldcell"> <input type="varchar" surname="surname" /></td> 
       </tr> 
       <tr>
    <tr>  
         <td colspan="2"><input type="submit" name="Submit" value="Submit"  /></td> 
       </tr> 
    </table> 
    </form>
         	<?php endif; ?>		
    
    
  4. Hello

     

    Is it possible using PHP to input the same data from a form into two databases when  the submit button is clicked.

     

    I have a need to load information onto my web MYSQL database and at the same time load the information from the same form into my "localhost" MYSQL database.

     

    Both are identical databases i.e. both are v 5. same database name same table names. At the moment I dump from my local database and transfer the dump to the web database.

     

    I have used the same script to load into the local database and by changing the password etc. into the web datebase.

     

    I am using a combination of HTML; PHP, MYSQL and CSS on the input form.

     

    Kind Regards

  5. Hello

     

    I used a program called SQLyog which will allow you to inport a CVS file. Sorry I cannot be more specific but it was some time ago. I know it worked with an Excel sheet I needed to get into mysql, you can download it for free at some sites.

     

    I also remember that when I searched there were other programs that will do what you require.

     

    Regards

  6. Hello

     

    Thanks REVAZ

     

    You obviously don't think that there is a security problem then.

     

    Regarding using a header to take them away, this is new territory for me so two questions,

     

    a) do I need to use htaccess for this

    b) would you point me in the right direction

     

    Regards

  7. Hello

     

    Part of my login system is that when a user wishes to login they are directed to a "protected" page that checks to see if they are logged in and if not launches a login page, the login is based on setting a session and works satisfactory.

     

    My concern is that although the page is a combination of PHP, CSS and HTML the visitor, should they wish can look at the source code and see the remaining HTML and the calling page hfef.

     

    Whilst the calling page is "protected" by showing the calling page it would give someone intent on penetrating the members area a page reference to work on at their leiasure.

     

    My question is can this be hidden in the source code.

     

    <a href ="membersonly.php"> Login Page</a> 
    

     

    Kind Regards

  8. Hello

     

    I used a program called SQLyog which will allow you to inport a CVS file. Sorry I cannot be more specific but it was some time ago. I know it worked with an Excel sheet I needed to get into mysql, you can download it for free at some sites.

     

    I also remember that when I searched there were other programs that will do what you require.

     

    Regards

  9. Hello

     

    Is it possible using PHP to redirect a user after login='true to a protected page and login='false' to a public page without them having to click a link.

     

    I would like to implement this automatic option into my login script.

     

    I would also like to thank Fyorl and Revraz for the help and advice they gave that enabled me to wright this script.

     

    Regards

  10. Hello

     

    I used a program called SQLyog which will allow you to inport a CVS file. Sorry I cannot be more specific but it was some time ago. I know it worked with an Excel sheet I needed to get into mysql, you can download it for free at some sites.

     

    I also remember that when I searched there were other programs that will do what you require.

     

    Regards

  11. Hello

     

    Thanks for your quick response.

     

    I have Xampp set up and working correctly on my local test computer and I have created a test site all of which is working and getting and displaying informatioon from a database.

     

    What I need now is to go one step further and lean how to protect a site.

     

    Regards

  12. Hello

     

    For the past week I have looked at many tutorials with references to password protection of parts of websites using PHP and MYSQL.

     

    There are indeed many tutorials but all that I have read fall short of being able to explain clearly what is required to implement such protection.

     

    There are many cut and paste examples but having cut and pasted the user as gained no real knowledge. Surely learning PHP is not just about reading the manual, but seeing examples of code and having the code explained and experimenting with it, making mistakes and correcting them in a non critical environment.

     

    Does anyone know of a good tutorial that will explain the workings of such a system.

     

    Regards

  13. eRott

     

    Thanks for all the work you put into the reply.  When I looked at your code I learn't that it is necessary when using style sheets to declare a class. ie .output

     

    <style>
    .output {
    text-align: center;
    border: 2px;
    border-style: dashed;
    }
    </style>
    

     

    and then to call it to get the data into the div. <div class="output">

     

    ?>
    
    <b>EXAMPLE #1:</b><br />
    <div class="output">
    <?php
    
    

     

    I know there must be other ways to achieve the same results but for now I can use your examples to get my information placed correctly.

     

    Once again thanks.

     

    Kind Regards

  14. Hello

     

    Thanks eRott and for the advice from redbullmarky.

     

    The first solution did not work at all, it just output a page with the borders produced by a stylesheet.

    The second option output the data but inside a second page with borders.

     

    It appears that the div is being called twice, is it possible to advise me if this is the case

     

    Kind Regards

  15. Hello

     

    Through your forums I have been leaning how to use PHP CSS and MYSQL.

     

    At this time I can use PHP to make contact with my Database and output using PHP.

     

    <?php
      
    // Request the text of all the information
    $result = @mysql_query('SELECT id,name,sname FROM gen20');
    if (!$result) {
      exit('<p>Error performing query: ' . mysql_error() . '</p>');
    }
    $sp="  ";
    // Display the text of each item in a paragraph
    while ($row = mysql_fetch_array($result)) {
       echo  $row['id'] . $sp . $row['name'] . $sp . $row['sname'] . '<br/>';
    }
    
    ?>
    

     

    This will place the date across the page in rows.

     

    What I would like to do is place the data into the div id "middle".

     

    ?>
    <p> </p>
    <p> </p>
    	<div id="container">
    
    	<div id="left"></div> 
    	<div id="middle"></div>
      	<div align="center"></div> 
    
    <br/>
    </div>
    
    <blockquote>
    
    <?php
    

     

    I realise this must be something simple to those people who know how to do it, but I have spent many hours trying to figure it out and must have read most of the recent posts, but to no avail.

    Please help if you can or point me to a tutorial that addresses this topic.

     

    Kind Regards

×
×
  • 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.