AyKay47
Members-
Posts
3,281 -
Joined
-
Last visited
-
Days Won
1
Everything posted by AyKay47
-
this doesn't have to do with $new, as it will be overwritten even if it did exist. Have you read the error? It's telling you that it cannot locate the file specified in $old. Perhaps check for the proper path.
-
when a form is submitted, it sends a $_GET or $_POST request to the server. $_GET, $_POST, and $_REQUEST are superglobal arrays that contain the values sent to the server via a $_GET or $_POST method, ($_REQUEST holds both) as associative. So when your input values are sent to the server via your form being submitted (using $_GET or $_POST methods), $_REQUEST is populated with that data, and you retrieve it using the name of the input as the key name, ($_REQUEST['name of input']). Pay attention to this notice in the manual: using $_REQUEST is not recommended, it is recommended to use the proper method ($_GET or $_POST)
-
this will explain. http://php.net/manual/en/reserved.variables.request.php
-
typically, you "minimize" your code so that it uses less memory, and is thus quicker to respond. The aspect that you bring up might be a secondary reason for minimizing code, although if someone with skill in coding want to find something from your code, they could regardless if it was minimized or not.
-
1.)Depends on where you buy the domain, what kind of domain etc. check out http://www.godaddy.com 2.)Most likely, just google it. Im not a fan of godaddy, as most programmers will agree I believe. Their hosting is cheap for a reason, their VPS is poorly configured, customer service is not good either. There are several that I recommend, depending on your needs, these are not in any specific order. Shared Hosting: 1. hostgator 2. bluehost 3. dreamhost VPS 1. hostgator 2. sloarvps 3. 1&1 4. liquidweb Dedicated 1. 1&1 2. netrack 3. inmotion 4. rackspace
-
for reference on the syntax for inserting multiple rows, refer here We are going to iterate through the array and piece a string together that we are going to use in the query. Since I have no idea where $playerID is coming from, i am going to assume that it is static. if(count($addIDs_ary) > 0) { $str = ""; foreach($addIDs_ary as $val) { $str .= "({$val},{$playerID}),"; if(end($arr) == $val) { $str .= "({$val},{$playerID})"; } } echo $str; // (val,val), (val,val), (val,val) etc.. $query = "INSERT INTO hitlist (hit_id,player_id) values $str"; }
-
why would you expect multiple rows to be added? In your code, you are inserting an imploded string into the database once.
-
hello, i have never heard of "infamous gangsters", but I assume its a web based turn type of game. This will most likely require the following: html (xhtml) for display, CSS for styling, PHP or another server language such as ASP for security / server handling, javascript (jquery) for client side language real-time response, AJAX (jquery API) for client to server real-time response, SQL (one of the RDMS) for data storage. These are the basic necessities for a multi-function website. now to your questions: 1. yes it costs money, you will need to purchase a domain name and web server(s) to host the site. 2. depends on the person really, but you should make sure that you have a firm understanding of most, if not all aspects of PHP before attempting to program a web site. 3. can't get any better than the documentation by the group that created PHP.. http://us2.php.net/tut.php and http://www.php.net/manual/en/. There are also good resource books out there that focus on certain aspects of PHP.
-
Cannot activate error message involving radio selection of a button
AyKay47 replied to facarroll's topic in PHP Coding Help
For what it's worth, the exit() only happens if all fields are filled out. This might make it a little more obvious: <?php //... if(!$snames) { $errorMsg .= "--- You did not select a name for editing."; } else if(!$family) { $errorMsg .= "--- You did not enter a family name."; } else if(!$given) { $errorMsg .= "--- You did not enter a given name."; } else { exit(); } //... ?> thanks, i misread the code since it is poorly written. -
Cannot activate error message involving radio selection of a button
AyKay47 replied to facarroll's topic in PHP Coding Help
there are actually several problems with your script, I will list them, then provide you with a revised code. 1. the variable $firstGroup needs to be declared a value before it can be concatenated onto. I am assuming that is somewhere above the code provided, else it will output an error. 2. what is the point of adding 4 spaces before two line breaks? there are better ways to go about this, also, stick to either the html <br> or the xhtml <br />, depending on your doctype. 3. do not use $_SERVER['PHP_SELF'] for a forms action, ever, this value can be tampered with and leave your script open to xss injection, instead, set the forms action to an empty string "" 4. debugging should be added into your code, checking if queries have failed etc. before continuing with your script. Never assume that something is going to work. 5. you are exit()ing the script before the echo in your code, perhaps you are not quite sure what exit does, I recommend you read the manual on the subject. Exit is killing your script before the echo command is sent, so naturally nothing will output to the browser. 6. you should first check if the submit button has been clicked by using isset, as mentioned. <html> <table> <?php // Query member data from the database $firstGroup = ""; $query1 = mysql_query("SELECT userId FROM users WHERE managerId='".$recid."' AND userGroup='".$group2."' ORDER BY userId ASC"); if(!$query1) { echo "Error: " . $query1 . "<br />" . mysql_error(); exit; } if(mysql_num_rows($query1) > 1) { while($row1 = mysql_fetch_array($query1)) { $firstGroup .= '<td>' . $row1['userId'] . ' <input type="radio" name="snames" value="' . $row1['userId'] . '" /> ' . '</td><br /><br />'; } } else { $firstGroup = NULL; //do not display output when echoed } ?> <form method="post" action=""> <tr> <?php echo $firstGroup; ?> <td><input type="text" name="given" value="" /><p> <input type="text" name="family" value="" /><p> <input type="submit" value="submit" name="submit"></form></td> </tr> </table> </html // Process the form if it is submitted if (isset($_POST['submit'])) { $snames = $_POST['snames']; $family = preg_replace("/[^A-Za-z0-9]/", ".", $_POST['family']); $given = preg_replace("/[^A-Za-z0-9]/", ".", $_POST['given']); //next section deals with error messaging $errorMsg = ""; if(isset($_POST['snames'])) { $errorMsg = "ERROR: --- You did not select a name for editing."; } else if(empty($family)) { $errorMsg .= "ERROR: --- You did not enter a family name."; } else if(empty($given)) { $errorMsg .= "ERROR: --- You did not enter a given name."; } if(!empty($errorMsg)) { echo $errorMsg; } } -
you should familiarize yourself with the mysql reserved words so you do not run into this again.
-
http://dev.mysql.com/doc/refman/5.1/en/insert.html
-
Well, the exact method that you will want to use for this will be dependent on your database design and coding setup. However, the basics will consist of an ajax request being sent to the server (I recommend jquery's Ajax API) with the data from the check boxes when a user clicks on a check box which will edit the query in the receiving PHP page and return the results set however you want. Wouldn't it make more logical sense to have all of the check box unchecked which would display all results, then have the user narrow the results by checking a check box?
-
Wow I'm out of it today, that isn't JavaScript at all. My apologies. It's one of those days..
-
You are not concatenating the string and variables properly. if ($row['host'] == "") { echo $row['show_name'] . " with " . $row['host']; } else { echo $row['show_name']; }
-
JavaScript validation is mainly used to provide the user with a real time response as to whether or not data that is entered is considered valid. It should never be relied on as a means of filtering and/or sanitizing data to be sent to the server, as it can simply be disabled. I believe what psychos point is, is that your regex is so bland, that it will allow many rediculous names, and as I said before, SQL injection to be sent to the server, that there really is not much point to perform a regex and use resources for something that will not achieve your logic. A few JavaScript checks to check the correct length etc can be used and output to the user as they are typing, but spending too much time and resources on validating with JavaScript is not recommended.
-
ask phillip... my lips are sealed.
-
promise or threat? I can never tell the difference with you kids these days.... I wish I was still a kid... If Adam is planning on adding a "special bonus" to the deal, it will most certainly be a promise...
-
mysql has a nice little extension of the EXPLAIN statement call EXPLAIN EXTENDED, post the results of this test: EXPLAIN EXTENDED SELECT u.id,u.name,u.team_id,l.agent_id FROM users AS u LEFT JOIN leads AS l ON(u.id=l.agent_id) WHERE u.team_id IS NOT NULL AND u.is_active='1' ORDER BY u.name ASC
-
as thorpe stated, nothing is being done with the data retrieved from the request, echoing the data in footer.php does not mean that you will see it, a callback function is needed. What do you want to do with the data? I will post code that alerts the data, to give you an idea of how to go about ouputting the retrieved data. $.get("footer.php", { name: "John", time: "2pm" }, function(data) { alert("Data Retreved: " + data); });
-
I hear Adam will even through in a bonus, just for you...
-
if you really wanted to test and compare both queries, you could run each one using the EXPLAIN statement and compare the performance results.
-
I will sell you some green. How much do you want? do you sell it by the pound?
-
for?
-
What is the logic in your code for separating users that are logged in, users that are not logged in, and guests?