Jump to content

fugix

Members
  • Posts

    1,483
  • Joined

  • Last visited

Posts posted by fugix

  1. okay we are going to add some simple code to check and make sure that the file is writable...try

    $myFile = $_POST['sitename'];
    $fh = fopen($myFile, 'w') or die("can't open file");
    if(is_writable($myfile))  {
    
       echo "this file is writable \n";
    } else  {
    
      echo "this file is not writable \n";
    }
    $stringData = "test\n";
    fwrite($fh, $stringData);
    $stringData = "test\n";
    fwrite($fh, $stringData);
    fclose($fh);

  2. I know that the following lines of code can be used to prevent errors from being displayed:

     

    <?php
    error_reporting(0);
    ini_set('display_errors', 0);
    ?>

     

     

    Is there a reason to use one over the other? Is it better to use both?

     

    honestly, that is a good question, one that i would like the answer to as well. It seems to me that both results would be the same, just two different ways of executing it. error_reporting(0) sets the level that you specify for the runtime of the script. While ini_set('displlay_errors', 0) will set the configuration option until the script is finished executing.

  3. the first part of this code is not necessary..can shorten it to this

    $myFile = $_POST['sitename'];
    $fh = fopen($myFile, 'w') or die("can't open file");
    $stringData = "test\n";
    fwrite($fh, $stringData);
    $stringData = "test\n";
    fwrite($fh, $stringData);
    fclose($fh);

    also, can you show the form that you use to do this please and any php that pertains

  4. i have some other forms in  a dropdown menu with different form names

     

    those get passed on and entered into mysql by php, but the date one doesnt get updated, just 00-00-0000

     

    should i post the whole html and php?

    yes if you wouldn't mind, so i can see how you are going about this

  5. thanks for quick response fugix,

     

    however im having troubles still, not sure if i have everything entered correctly though.

     

    i have a form which is being posted by php to mysql

     

    here is my html:

     

    <form name="DATE1" method="post">

    <div><select name="day" id="Date1" class="regularfont"><option value="" selected="selected"></option>

    <option value="1">01</option>

    <option value="2">02</option>

    </select> <select name="month" id="Date2" class="regularfont"><option value="" selected="selected"></option>

    <option value="1">January</option>

    <option value="2">February</option>

    </select> <select name="year" id="Date3" class="regularfont"><option value="" selected="selected"></option>

    <option value="2014">2014</option>

    <option value="2013">2013</option>

     

     

    on submit it passed on to php

     

    <?php

    $Date1 = $_POST['day'] . "-" . $_POST['month'] . "-" . $_POST['year'];

    ?>

     

     

     

    what am i doing wrong ?

    well, what is happening when the form is sent?

  6. firstly change you select names to "Day" "Month" "Year" accordingly, then you could simply combine the 3 to form a legitimate date to insert into your db. like so

     

    $date = $_POST['day'] . "-" . $_POST['Month'] . "-" . $_POST['Year'];

  7. I believe that it is because you are placing backticks around the variable that you want to insert, instead of this

    $insertq = "INSERT INTO `customer_details`
    
    (`full_name`)
    VALUES
    (`$name`)";

    try this

    $insertq = "INSERT INTO `customer_details`
    
    (`full_name`)
    VALUES
    ($name)";

  8. firstly, get into the habit of placing your attributes in double quotations, example

    these lines

    <form method=post name=adauga_etapa>
    <table cellspacing=1 cellpadding=2 border=1 align=center>

    should be

    <form method="post" name="adauga_etapa">
    <table cellspacing="1" cellpadding="2" border="1" align="center">

    this will help you to avoid errors in the future...

    also, can you show me an example of what this line

    echo $_POST['gazde']." - ".$_POST['oaspeti'];

    is echoing when the form is submitted with 2 word strings.

     

  9. okay i noticed two errors in your code..both having to deal with the mysql_error() function.

     

    1. this line

    $insert = mysql_query($insertq) or die (mysql_error);

    should be

    $insert = mysql_query($insertq) or die (mysql_error());

    you forgot the parenthesis around your mysql_error() function...which it why it was only printing the string "mysql_error"

     

    2. in your connection page you are missing a parenthesis for the mysql_error() function inside of your trigger_error() function..

    $superconnect = mysql_pconnect($hostname_superconnect, $username_superconnect, $password_superconnect) or trigger_error(mysql_error(),

    should be

    $superconnect = mysql_pconnect($hostname_superconnect, $username_superconnect, $password_superconnect) or trigger_error(mysql_error()),

    we will start there...once you change the above, show me what you get

  10. there are a couple of errors that I notice when looking at your code..

     

    1. you are receving the notice for the undefined index because you $_POST['email'] has not been processed. This is probably because you have not submitted the form yet. To get rid of this error simply change this

    if(!$email || !$enteredpassword)

    to

    if(!isset($email) || !$enteredpassword)

    the isset() function will check if the index has been set, if it hasn't, it will not give you that notice.

     

    2. you are receiving the mysl_fetch_array() and mysql_num_rows errors because your mysql_query is incorrect. by writing this

    $getuser=mysql_query("SELECT * FROM users WHERE $email='email'");

    you are setting the column_name to your variable which is not what you want to do...try this instead

    $getuser=mysql_query("SELECT * FROM users WHERE email='$email'");

    this is assuming that your column_name is email..if you have any more problems let us know

  11. You are missing a double-quote on the end of your DELETE query statement.

     

    You should be using a programming editor with color highlighting (that's how I pinpointed where the problem was - the colors stopped changing because everything after the missing quote was treated as part of that string.)

    good catch, missed it....ihbdan if you have further errors let us know

  12. do you receive any errors if your add debugging...eg

    $instrList=mysql_query("select distinct classOfferings.instructorId, instructors.fName, instructors.lName from instructorId AS co INNER JOIN instructors AS i ON instructorId WHERE co.instructorId = i.instructorId order by lName asc") or die(mysql_error());

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