Jump to content
#FlattenTheCurve ×

Archived

This topic is now archived and is closed to further replies.

Matt Ridge

Code posts correctly, but when updating it doesn't. Can someone help solve this?

Recommended Posts

I'm not quite sure what you want the workflow to be.  What I get is:

 

1. You want the <select> to be filled with names from the user table

2. You want whatever name the end user selects to be sent to the ncmr table

 

I'm unsure of the rest.  Can you describe it in terms of what the end user should do/see?

Share this post


Link to post
Share on other sites

I'm not quite sure what you want the workflow to be.  What I get is:

 

1. You want the <select> to be filled with names from the user table

2. You want whatever name the end user selects to be sent to the ncmr table

 

I'm unsure of the rest.  Can you describe it in terms of what the end user should do/see?

 

Basically 1 and 2 are correct.  What I want for the last part is that I want is when a name has been entered into the database from the original document being posted is to see in the edit field, to see said name selected in the pull-down menu already as it's default choice. So when the form is submitted again, the same name will be entered into the field, instead of --None-- since that is the first choice in said pull-down menu.

Share this post


Link to post
Share on other sites

Okay, so here's what you want to do:

 

Grab a hold of $_POST['name'], or whatever it is you call it, and run it through whatever you use for validation/sanitation except the escape.  Store it in a variable:

 

$name = myValidation($_POST['name']);

 

You don't need a function for this.  I'm using one for brevity, and because I don't know what you're actually doing for validation.  So, replace my function with whatever you're actually doing.

 

Now that you have it in a separate variable, you can use it in multiple ways, so run that new variable through the escape and insert as normal.

 

When it comes time to make your select options, simply do:

 

<select>
<?php while(/*something*/) { ?>
   <option value="$value" <?php if ($name && $name == $value) { echo "selected"; } ?> >
<?php } // end while ?>
</select>

 

Basically, you just need to check if the last name entered matches a name in the list.  If so, mark it as selected.

Share this post


Link to post
Share on other sites

Okay, so here's what you want to do:

 

Grab a hold of $_POST['name'], or whatever it is you call it, and run it through whatever you use for validation/sanitation except the escape.  Store it in a variable:

 

$name = myValidation($_POST['name']);

 

You don't need a function for this.  I'm using one for brevity, and because I don't know what you're actually doing for validation.  So, replace my function with whatever you're actually doing.

 

Now that you have it in a separate variable, you can use it in multiple ways, so run that new variable through the escape and insert as normal.

 

When it comes time to make your select options, simply do:

 

<select>
<?php while(/*something*/) { ?>
   <option value="$value" <?php if ($name && $name == $value) { echo "selected"; } ?> >
<?php } // end while ?>
</select>

 

Basically, you just need to check if the last name entered matches a name in the list.  If so, mark it as selected.

 

This code is exactly what I am attempting to do:

 

<?php
if ($row['fab1']=="--None--")
{
    echo'<div id="fab1">';
    $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); 
    $mysqli->select_db('user');
    $result = $mysqli->query("SELECT * FROM user"); 
    echo "<SELECT name='fab1'>\n";
    while($row = $result->fetch_assoc())
    {
        echo "<option value='{$row['user']}'>{$row['user']}</option>\n";
    }
    echo "</select>\n";
    echo '</div>';
}
else
{
    echo'<div id="fab1">';
    $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); 
    $mysqli->select_db('user');
    $result = $mysqli->query("SELECT * FROM user"); 
    echo "<SELECT name='fab1'>\n";
    while($row = $result->fetch_assoc())
    {
        echo "<option value='{$row['user']}'>{$row['user']}</option>\n";
    }
?>

 

Basically the second part is where you code you are talking about is going... if I am reading what you posted. Although I do have a question, why don't you want to escape string it? Won't that allow for injection?

Share this post


Link to post
Share on other sites

Reread what I wrote.  I do want you to escape it after you run it through your validation code and store it in a separate variable.  Escape it in place, like:

 

$query = "UPDATE/INSERT/WHATEVER ... name = '" . mysqli_real_escape_string($dbc, $name) . "' ... ";

 

Why do it this way?  Because if you escape it immediately, $name will contain escape characters, so any comparisons to the inserted value when you're building the <select> may not work (remember, you need to check $name against every value returned from your SELECT query to determine which name was entered).  Escaping it in place makes a copy* of $name safe in the query, but the escape doesn't persist after that.  I hope this makes sense.

 

*The vast majority of PHP functions pass their parameters by value.  That means an automatically generated copy of the parameter is passed into the function.

Share this post


Link to post
Share on other sites

Reread what I wrote.  I do want you to escape it after you run it through your validation code and store it in a separate variable.  Escape it in place, like:

 

$query = "UPDATE/INSERT/WHATEVER ... name = '" . mysqli_real_escape_string($dbc, $name) . "' ... ";

 

Why do it this way?  Because if you escape it immediately, $name will contain escape characters, so any comparisons to the inserted value when you're building the <select> may not work (remember, you need to check $name against every value returned from your SELECT query to determine which name was entered).  Escaping it in place makes a copy* of $name safe in the query, but the escape doesn't persist after that.  I hope this makes sense.

 

*The vast majority of PHP functions pass their parameters by value.  That means an automatically generated copy of the parameter is passed into the function.

 

I wish I could say yes, in understanding... but not really. 

 

Between what you have posted above and the section of what I ma suppose to do, how am I to incorporate that into the script I am using.  That is the problem I am seeing. Also escaping after the query... I've never seen that before as far as I can tell.  So sorry if I sound dense but what you are attempting to explain is a little over my head right now.

Share this post


Link to post
Share on other sites

Okay, let's see if I can explain it better...

 

Right now, you have a whole section that looks like:

 

$someVar = mysqli_real_escape_string($dbc, trim($_POST['someVar']));
$someVar2 = mysqli_real_escape_string($dbc, trim($_POST['someVar2']));
$someVar3 = mysqli_real_escape_string($dbc, trim($_POST['someVar3']));
.
.
.

 

What's happening here is that you're passing copies of $_POST values to the escape function, and then storing the results in variables.  Those variables now contain escaped characters, meaning something like:

 

$someVar == $_POST['someVar']

 

May not be true.

 

All I'm saying is, instead of immediately escaping and storing $_POST['name'] in a variable, wait until you need to use it in the INSERT/UPDATE query, and to do it within the query itself so the variable doesn't retain the escaped characters.

 

There's no after query escaping happening here.  Not sure where you got that impression.

 

In other words:

 

$name = myValidate($_POST['name']); // myValidate represents whatever validation - if any - you do.  Written as a function here for brevity, but could be any kind of statement(s)

.
.
.

// insert/update query

$query = "UPDATE/INSERT/WHATEVER ... name = '" . mysqli_real_escape_string($dbc, $name) . "' ... "; // note how the escape is happening INSIDE the query, before it's executed

.
.
.

// after the select query, to build the <select> HTML form input
?>

<select>
<?php while(/*something*/) { ?>
   <option value="$value" <?php if ($name && $name == $value) { echo "selected"; } ?> >
<?php } // end while ?>
</select>

Share this post


Link to post
Share on other sites

Okay, let's see if I can explain it better...

 

Right now, you have a whole section that looks like:

 

$someVar = mysqli_real_escape_string($dbc, trim($_POST['someVar']));
$someVar2 = mysqli_real_escape_string($dbc, trim($_POST['someVar2']));
$someVar3 = mysqli_real_escape_string($dbc, trim($_POST['someVar3']));
.
.
.

 

What's happening here is that you're passing copies of $_POST values to the escape function, and then storing the results in variables.  Those variables now contain escaped characters, meaning something like:

 

$someVar == $_POST['someVar']

 

May not be true.

 

All I'm saying is, instead of immediately escaping and storing $_POST['name'] in a variable, wait until you need to use it in the INSERT/UPDATE query, and to do it within the query itself so the variable doesn't retain the escaped characters.

 

There's no after query escaping happening here.  Not sure where you got that impression.

 

In other words:

 

$name = myValidate($_POST['name']); // myValidate represents whatever validation - if any - you do.  Written as a function here for brevity, but could be any kind of statement(s)

.
.
.

// insert/update query

$query = "UPDATE/INSERT/WHATEVER ... name = '" . mysqli_real_escape_string($dbc, $name) . "' ... "; // note how the escape is happening INSIDE the query, before it's executed

.
.
.

// after the select query, to build the <select> HTML form input
?>

<select>
<?php while(/*something*/) { ?>
   <option value="$value" <?php if ($name && $name == $value) { echo "selected"; } ?> >
<?php } // end while ?>
</select>

 

I guess I was getting confused on the code that was escaping inside the query.  So in this case it would be:

 

$query = "UPDATE testbed SET fab1 = '" . mysqli_real_escape_string($dbc, $name) . "'$fab1";

 

Or do I have this wrong?

Share this post


Link to post
Share on other sites

I haven't looked at your actual queries.  What is your CURRENT query that uses the posted name?

Share this post


Link to post
Share on other sites

I haven't looked at your actual queries.  What is your CURRENT query that uses the posted name?

 


$query = "UPDATE testbed SET ab = '$ab', date = '$date', part = '$part', rev = '$rev' , partdesc = '$partdesc' , ncmrqty = '$ncmrqty' , comp = '$comp' , ncmrid = '$ncmrid' , rma = '$rma' , jno = '$jno' , fdt = '$fdt' , cof = '$cof' , fab1 = '$fab1' , fab2 = '$fab2' , fab3 = '$fab3' , non = '$non' , dis = '$dis' , comm = '$comm' , caad = '$caad' , po = '$po' , pod = '$pod' , dri = '$dri'  WHERE id = '$id'";

 

 

Share this post


Link to post
Share on other sites

Okay, which column is the posted name?  fab1?

 

$fab1 for now, the rest I'll be able to figure out on my own.

Share this post


Link to post
Share on other sites

Okay, so:

 

$fab1 = myValidate($_POST['fab1']); // again, replace with whatever validation - if any - that you do
.
.
.


$query = "UPDATE testbed SET ab = '$ab', date = '$date', part = '$part', rev = '$rev' , partdesc = '$partdesc' , ncmrqty = '$ncmrqty' , comp = '$comp' , ncmrid = '$ncmrid' , rma = '$rma' , jno = '$jno' , fdt = '$fdt' , cof = '$cof' , fab1 = '" . mysqli_real_escape_string($dbc, $fab1) . "' , fab2 = '$fab2' , fab3 = '$fab3' , non = '$non' , dis = '$dis' , comm = '$comm' , caad = '$caad' , po = '$po' , pod = '$pod' , dri = '$dri'  WHERE id = '$id'";

Share this post


Link to post
Share on other sites

Okay, so:

 

$fab1 = myValidate($_POST['fab1']); // again, replace with whatever validation - if any - that you do
.
.
.


$query = "UPDATE testbed SET ab = '$ab', date = '$date', part = '$part', rev = '$rev' , partdesc = '$partdesc' , ncmrqty = '$ncmrqty' , comp = '$comp' , ncmrid = '$ncmrid' , rma = '$rma' , jno = '$jno' , fdt = '$fdt' , cof = '$cof' , fab1 = '" . mysqli_real_escape_string($dbc, $fab1) . "' , fab2 = '$fab2' , fab3 = '$fab3' , non = '$non' , dis = '$dis' , comm = '$comm' , caad = '$caad' , po = '$po' , pod = '$pod' , dri = '$dri'  WHERE id = '$id'";

 

And then from there instead of using the script I have, use yours, it looks a little more elegant anyway.

Share this post


Link to post
Share on other sites

The <select> builder?  Sure.

 

Just be sure to fill in all the blanks.  For example, don't just blindly throw myValidate() into your code.  My examples were largely pseudo-code, intending to show the overall thought process.  You'll need to understand what I was trying to tell you and figure out how to put it into what you already have.  Simple cut/paste of everything won't work.

 

The query above can likely be used as-is (be sure to test it and debug it if it doesn't work right initially), but the <select> builder needs its while-loop condition added, $name replaced with $fab1, etc.

Share this post


Link to post
Share on other sites

Okay, so here's what you want to do:

 

Grab a hold of $_POST['name'], or whatever it is you call it, and run it through whatever you use for validation/sanitation except the escape.  Store it in a variable:

 

$name = myValidation($_POST['name']);

 

You don't need a function for this.  I'm using one for brevity, and because I don't know what you're actually doing for validation.  So, replace my function with whatever you're actually doing.

 

Now that you have it in a separate variable, you can use it in multiple ways, so run that new variable through the escape and insert as normal.

 

When it comes time to make your select options, simply do:

 

<select>
<?php while(/*something*/) { ?>
   <option value="$value" <?php if ($name && $name == $value) { echo "selected"; } ?> >
<?php } // end while ?>
</select>

 

Basically, you just need to check if the last name entered matches a name in the list.  If so, mark it as selected.

 

Ok, I've finality gotten time to sit down and take a look at this deeply, and I just about figured out till I realized you utilized PHP inside HTML, which throws my entire script for a loop...

 

I'll work on making it so that it's XHTML and PHP separate later, for now I got to deal with the monster I was given now...

 

<?php

if ($row['fab1']=="--None--")
{
    echo'<div id="fab1">';
    $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); 
    $mysqli->select_db('user');
    $result = $mysqli->query("SELECT * FROM user"); 
    echo "<SELECT name='fab1'>\n";
    while($row = $result->fetch_assoc())
    {
        echo "<option value='{$row['user']}'>{$row['user']}</option>\n";
	}
    echo "</select>\n";
    echo '</div>';
}
else
{
    echo'<div id="fab1">';
    $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); 
    $mysqli->select_db('user');
    $result = $mysqli->query("SELECT * FROM user"); 
    echo "<SELECT name='fab1'>\n";
    while($row = $result->fetch_assoc())
    {
        echo "<option value='{$row['user']}'>{$row['user']}</option>\n";
    }
    echo "</select>\n";
    echo '</div>';
}
?>

 

The way I have it now, is well complex, I like your way of doing it, if I can get the code above down to half the size, I'd like it even more so.

 

Basically I was thinking of this:

 

<?php
if ($row['fab1']=='$fab1')
{
    echo'<div id="fab1">';
    $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); 
    $mysqli->select_db('user');
    $result = $mysqli->query("SELECT * FROM user"); 
    echo "<SELECT name='fab1'>\n";
    while($row = $result->fetch_assoc())
    {
        echo "<option value='{$row['user']}'></option>\n";
	if ($name && $name == $value) { echo '$fab1'; }
	}
    echo "</select>\n";
    echo '</div>';
?>

 

The problem is I know this won't work... can you help?

Share this post


Link to post
Share on other sites

Is that code above being executed within a loop? Because you are referencing a $row[] array value before you do the query (which you then redefine $row). If so, you need to move the query outside the loop and save the results to an array and then use the array within a loop. Database queries are one of the more "costly" processes with respect to server resources and overhead. Running queries in loops will have significant impact performance. Plus, you are creating a div with a hard coded ID, so if it is run in a loop you are creating multiple divs with the same ID - which is not valid. Also, don't use '*' in your SELECT queries if you don't need all the data. Again, it is a waste of resources

 

Anyway, to the code you have. You are doing a check to see if the selected value is "--None--", but the code is not generating a "--None--" value. If the code is only creating options with other values I'm not sure how "--None--" would ever be valid. I think this should do what you need. I've separated the logic from the output so you can separate those sections accordingly in your files.

<?php

$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); 
$mysqli->select_db('user');
$result = $mysqli->query("SELECT user FROM user"); 

$fabOptions = "<option value='--None--'>--None--</option>\n";
while($row = $result->fetch_assoc())
{
    $selected = ($name && $name == $row['user']) ? " selected='selected'" : '';
    $fabOptions .= "<option value='{$row['user']}'{$selected}>{$row['user']}</option>\n";
}

?>

<div id="fab1">
    <select name='fab1'>
    <?php echo $fabOptions; ?>
    </select>
</div>

 

However, if that code IS meant to be run in an external loop, then other changes would be warranted.

Share this post


Link to post
Share on other sites

Is that code above being executed within a loop? Because you are referencing a $row[] array value before you do the query (which you then redefine $row). If so, you need to move the query outside the loop and save the results to an array and then use the array within a loop. Database queries are one of the more "costly" processes with respect to server resources and overhead. Running queries in loops will have significant impact performance. Plus, you are creating a div with a hard coded ID, so if it is run in a loop you are creating multiple divs with the same ID - which is not valid. Also, don't use '*' in your SELECT queries if you don't need all the data. Again, it is a waste of resources

 

Anyway, to the code you have. You are doing a check to see if the selected value is "--None--", but the code is not generating a "--None--" value. If the code is only creating options with other values I'm not sure how "--None--" would ever be valid. I think this should do what you need. I've separated the logic from the output so you can separate those sections accordingly in your files.

<?php

$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); 
$mysqli->select_db('user');
$result = $mysqli->query("SELECT user FROM user"); 

$fabOptions = "<option value='--None--'>--None--</option>\n";
while($row = $result->fetch_assoc())
{
    $selected = ($name && $name == $row['user']) ? " selected='selected'" : '';
    $fabOptions .= "<option value='{$row['user']}'{$selected}>{$row['user']}</option>\n";
}

?>

<div id="fab1">
    <select name='fab1'>
    <?php echo $fabOptions; ?>
    </select>
</div>

 

However, if that code IS meant to be run in an external loop, then other changes would be warranted.

 

Ok, you just ran circles around me...

 

What needs to be done, and what I've decided to do is instead of seeing if --None-- is required, just to view what is inside the table's field via the drop down menu.

 

This means if my name "Matt Ridge" is selected and in the field in the database table that is the name that will show up in the drop down menu when this form is run:

 

http://kaboomlabs.com/testbed/edit.php?id=1

 

The reason is so that when the person edits decides that my name doesn't belong there, they can choose the correct name, press submit and the correct name will be put in it's place. Then when they run the script again, said name will be in the place where mine once was. 

 

Does this make any sense?

 

 

Share this post


Link to post
Share on other sites
Ok, you just ran circles around me...

Aside from the DB connection lines, I provided just 4 lines of code that performs any actions. Did you even look at those lines and try to analyze what they are doing? This is not difficult stuff and we are trying to be patient. But, rather than try the code provided or even ask a question about the code provided you just restate what you are trying to achieve. So basically, I took time out of my day to help you and you completely ignored it. The code I provided will create a select list and auto-select the value that matches the value of $name. That is what you just said you wanted.

 

If you don't want "--None--" in the select list then simple change

$fabOptions = "<option value='--None--'>--None--</option>\n";

 

To this

$fabOptions = '';

 

Here is the same logic with some comments added.

<?php

//For this to work properly, the variable $name
//will contain the previously selected 'user' value

//Connect to DB and run query to get list of 'user' values
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); 
$mysqli->select_db('user');
$result = $mysqli->query("SELECT user FROM user"); 

//Create variable to hold the options HTML code
//Set this to empty string if you don't want "--None--"
$fabOptions = "<option value='--None--'>--None--</option>\n";
//Iterate through DB results of 'user' values
while($row = $result->fetch_assoc())
{
    //Set the variable $selected to the HTML code to select the option
    //if the current DB value matches $name, else set to an empty string
    $selected = ($name && $name == $row['user']) ? " selected='selected'" : '';
    //Create the HTML code for the option using the current 'user' value from the
    //DB results as the value and label for the option. Use the $selected variable
    //to set the selected status of this option
    $fabOptions .= "<option value='{$row['user']}'{$selected}>{$row['user']}</option>\n";
}

//The lines below will output the select list and all the options generated above
?>

<div id="fab1">
    <select name='fab1'>
    <?php echo $fabOptions; ?>
    </select>
</div>

 

I should not have to provide that level of detail for every code snippet I provide. I only did it so I would not feel that I wasted my time in my first response today. This will be my last post to provide any assistance to you as I only volunteer my time here for the enjoyment of helping others who appreciate my help. Maybe you do appreciate the help, but I'm just not feeling it. Good luck to you.

Share this post


Link to post
Share on other sites

Ok, you just ran circles around me...

Aside from the DB connection lines, I provided just 4 lines of code that performs any actions. Did you even look at those lines and try to analyze what they are doing? This is not difficult stuff and we are trying to be patient. But, rather than try the code provided or even ask a question about the code provided you just restate what you are trying to achieve. So basically, I took time out of my day to help you and you completely ignored it. The code I provided will create a select list and auto-select the value that matches the value of $name. That is what you just said you wanted.

 

If you don't want "--None--" in the select list then simple change

$fabOptions = "<option value='--None--'>--None--</option>\n";

 

To this

$fabOptions = '';

 

Here is the same logic with some comments added.

<?php

//For this to work properly, the variable $name
//will contain the previously selected 'user' value

//Connect to DB and run query to get list of 'user' values
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); 
$mysqli->select_db('user');
$result = $mysqli->query("SELECT user FROM user"); 

//Create variable to hold the options HTML code
//Set this to empty string if you don't want "--None--"
$fabOptions = "<option value='--None--'>--None--</option>\n";
//Iterate through DB results of 'user' values
while($row = $result->fetch_assoc())
{
    //Set the variable $selected to the HTML code to select the option
    //if the current DB value matches $name, else set to an empty string
    $selected = ($name && $name == $row['user']) ? " selected='selected'" : '';
    //Create the HTML code for the option using the current 'user' value from the
    //DB results as the value and label for the option. Use the $selected variable
    //to set the selected status of this option
    $fabOptions .= "<option value='{$row['user']}'{$selected}>{$row['user']}</option>\n";
}

//The lines below will output the select list and all the options generated above
?>

<div id="fab1">
    <select name='fab1'>
    <?php echo $fabOptions; ?>
    </select>
</div>

 

I should not have to provide that level of detail for every code snippet I provide. I only did it so I would not feel that I wasted my time in my first response today. This will be my last post to provide any assistance to you as I only volunteer my time here for the enjoyment of helping others who appreciate my help. Maybe you do appreciate the help, but I'm just not feeling it. Good luck to you.

 

Actually I do appreciate the help, the fact you don't feel so is something you need to work on your own about. The reason I said you ran circles around me is because I read what you posted and didn't understand how it worked. I am learning as I go, I normally write my code myself, but when it comes to pull down menus I got code from other people's help, and have adapted it to what you have seen in front of you prior to your posts.

 

You wrote the code in such a way that it didn't make any sense to me, because you went from what I had to a very small code... you may of described it in terms you understood, but obviously I didn't. I'm sorry you feel that I am wasting your time, but sometimes people have questions that you may find foolish, but to them is not.

 

I believe that there is no such thing as a stupid question, perhaps you may not, so I am sorry, but next time you see one of my posts please ignore it then, because obviously you feel your help can be utilized better than responding to me when I thought I actually had a valid issue.

 

This was one of the reasons I decided to go and learn programming people... because the people here that are gurus and other types think that people like me, people who actually are here to learn that may have a stupid question or two in other people's eye actually give attitude and look down upon people like me. 

 

I only came back here because of my employer requested something beyond my knowledge.

 

At this point in time I expect to either be banned, or censured... honestly I'm not worried, because right now I don't think I'll be asking anything here any more, the attitude of people here have turned me off. I'll use stackechange instead, it may be not as fast in response time, but honestly I don't care any more. I don't need the attitude.

 

Yes you people don't get paid, well guess what I don't get paid to post either. I only get a paycheck when I have a finished product.  So, thank you for teaching me that people here  that are admins, gurus, or others don't like what they perceive as stupid questions. Because honestly, there is no such thing as a stupid question.  Just harmful answers.

Share this post


Link to post
Share on other sites

Actually I do appreciate the help, the fact you don't feel so is something you need to work on your own about.

There have been numerous people in your threads that have said similar things about you. Yet, you think there is something I need to work on. Perhaps you need to take a look in the mirror and realize what the common denominator is (you). I don't appear to have the same issue with the vast majority of users on these forums, but you have the same issue with many others.

Share this post


Link to post
Share on other sites

Matt, like I said before, we are not here to teach people how to program in PHP from the ground up.  We're not here to explain every single line of code we present as a solution.  We are not tutors.  The message forum format just doesn't work well for that, and, frankly, we don't have the time for it.  We do what we can in this format, but no one gets dedicated one-on-one instruction here.

 

Also note that Psycho's code is almost identical to what I gave you.  The differences between the two are minute, with the exception of the ternary operator - ? : - which is just a shorthand version of if/else.

 

Also note that a place like Stack Overflow discourages discussion.  It's format just doesn't allow for "Yeah, but...."

 

Also note that, again, the reason why people repeat things to you ad nauseam is because there are only so many ways to explain and re-explain something.  Especially when it's something basic.

 

---

 

Maybe you're just not cut out for this?  There's nothing wrong with that.  I'll never be an artist because I don't think in those terms.  Maybe programming just isn't for you.

Share this post


Link to post
Share on other sites
Actually I do appreciate the help, the fact you don't feel so is something you need to work on your own about. The reason I said you ran circles around me is because I read what you posted and didn't understand how it worked. I am learning as I go, I normally write my code myself, but when it comes to pull down menus I got code from other people's help, and have adapted it to what you have seen in front of you prior to your posts.

 

You wrote the code in such a way that it didn't make any sense to me, because you went from what I had to a very small code... you may of described it in terms you understood, but obviously I didn't. I'm sorry you feel that I am wasting your time, but sometimes people have questions that you may find foolish, but to them is not.

 

I believe that there is no such thing as a stupid question, perhaps you may not, so I am sorry, but next time you see one of my posts please ignore it then, because obviously you feel your help can be utilized better than responding to me when I thought I actually had a valid issue.

 

This was one of the reasons I decided to go and learn programming people... because the people here that are gurus and other types think that people like me, people who actually are here to learn that may have a stupid question or two in other people's eye actually give attitude and look down upon people like me. 

 

I only came back here because of my employer requested something beyond my knowledge.

 

At this point in time I expect to either be banned, or censured... honestly I'm not worried, because right now I don't think I'll be asking anything here any more, the attitude of people here have turned me off. I'll use stackechange instead, it may be not as fast in response time, but honestly I don't care any more. I don't need the attitude.

 

Yes you people don't get paid, well guess what I don't get paid to post either. I only get a paycheck when I have a finished product.  So, thank you for teaching me that people here  that are admins, gurus, or others don't like what they perceive as stupid questions. Because honestly, there is no such thing as a stupid question.  Just harmful answers.

 

Nobody is looking down upon "people like you". People have taken a lot of time on several of your threads to try to help you understand. If, at that point you still do not understand basic concepts then you really need to step up your own learning process. A good book or two is the first thing I would recommend.

Share this post


Link to post
Share on other sites

At this point in time I expect to either be banned, or censured...

 

Are you requesting to be banned? We can certainly oblige if that's the case.

Share this post


Link to post
Share on other sites

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