davidannis
-
Posts
627 -
Joined
-
Last visited
-
Days Won
2
Posts posted by davidannis
-
-
No, you need to do a bit more work on your own, try writing it, and if you run into problems we'll be glad to help.
-
The reason I used true for that condition is because if that is true, it changes it to that value.
all other conditions, false, set to the current dates value.
I believe you are are correct about not converting it to a number and I am trying to match a string. I will test when I get home.
The true checks not just that it is in the array but also that it is the same type (string, numeric, boolean) which is what I meant by "Try using in_array without the true to see if it is the type that is causing it to fail." The default is to not require that type match. No matter what you set that third parameter to the return value of the in_array() will be a boolean that is true if the value is in the array (and type is the same if you put ", true" at the end) or false if the value is not in the array.
-
Also,
$years[$aSearch]
won't work as you expect since in_array just returns true or false, not the position in the array. http://php.net/manual/en/function.in-array.php
-
$aSearch = in_array($curYear, $years, true)
did you mean to assign the value here?
Try using in_array without the true to see if it is the type that is causing it to fail.
-
Or you can try the freelancer section of the forums if you want to hire somebody to create a commercial product. I'd recommend against that market because it already has strong competition.
-
-
Are you asking how to execute multiple queries using only one php command? See the documentation for mysql here: http://php.net/manual/en/mysqli.multi-query.php
-
<input type="text" name="domain"><br> <input type="checkbox" value=".com" name="tld[]">.com<br> <input type="checkbox" value=".net" name="tld[]">.net<br> <input type="checkbox" value=".org" name="tld[]">.org<br>
foreach($_POST['tld'] as $value){ echo $_POST['domain'].$value."<br>\n"; }
will give you what you are looking for, output to the screen I believe. Of course, you need the rest of the HTML and the php, only provided the relevant pieces here.
-
Let's start with the basic idea. You need to name your variables in the html as an array
<input type="text" name="nrp[]">
then you loop through the array that you get and write the records:
foreach($_POST['nrp'], as $value){ WRITE YOUR RECORD HERE }
-
I'll give you this much http://php.net/manual/en/function.substr.php and you can nest functions like this:
$myvar=strtoupper(substr(GUESS WHAT GOES HERE));
-
Try something and if you have trouble we'll help. We won't do it for you though. Start with the manual.
-
Does it print an error message?
Does it print "Message successfully sent!"?
Is php error reporting on? (If not, put this at the top of your php file:)
error_reporting(E_ALL); ini_set("display_errors", 1);
-
Use LIKE in your query.
WHERE date_mod LIKE '$date%';
-
If your database name has a space in it you need backticks around it.
-
Please when you do
var_dump($sql);
as suggested, show us what you get.
I am wondering if you are putting the correct value into the form that creates $_POST. Try using backticks in the form
so $_POST['selform'] will contain
`databasename`.`head`
-
I make my share of programming design blunders, as many of you know from helping me debug a few, so I am hesitant to point fingers, but I just had an experience so horrible, with so many errors on a website owned by Snapfish (which should have some programming resources) that I had to write it up.
-
You need to sanitize $table (as previously discussed):
$table = mysqli_real_escape_string($con,$_POST['selform']);
The error is telling you that the query is failing. Perhaps $table doesn't have the value you expect. Try this:
$sql = 'SELECT * FROM '.$table ; echo $sql.'<br>'; $result = mysqli_query($con,$sql);
-
An example might look like this:
$lastpage=3; for ($counter = 1; $counter <= $lastpage; $counter++){ echo "We're on page $counter <br>"; } echo "done";
which would output
We're on page 1 We're on page 2 We're on page 3 done
-
The more sophisticated examples, particularly those at stackoverflow, come closer but all of them seem to be critiqued by someone to the effect that they won't work in this or that particular situation.
I'm not sure what situation they won't work in, but if you can't read the test cookie you wrote then you won't be able to read the preference cookie that you wrote. The browser doesn't know that the cookie is a test. I would just have the page after they set the preference cookie try to read the preference cookie and if it is not found tell them that you couldn't store their preferences for the next time and suggest that they may need to enable cookies.
-
Why is the action on the form:
form action="login_submit.php"
different from the name of the name of the script that you supplied? login.php
-
There are a lot of good introductions to programming on the web. Read one and start trying. If you run into specific problems we'll be happy to help.
-
need quotes around src=blah so it is src="blah"
<img src=../'.$row['ppic'].'
should be
<img src="../'.$row['ppic'].'"
-
You get a bunch of data from PayPal via IPN. It comes as $_POST. First step is to sanitize that data and send it back to them via curl and they will verify that they sent it. (They provide sample code that does that). In their sample code the curl response is stored in $res. First you look for VERIFIED at the start of $res. If $res is not VERIFIED -- log the transaction and investigate. If the data you got is what they sent you can compare the various values to what you were expecting to get. I would look at payment_status to make sure it shows completed and mc_gross (how much the total transaction was for) mc_currency. I use a pass through variable invoice that I pass a unique value to them and they pass it back to match the transaction in my database. They warn you to do your DB updates after the curl verification because it times out pretty quickly if they send data and are not asked for a confirm. A complete list of all the data that they may send you is at https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/
-
I don't think so. HTTP is stateless and you need to store the order someplace. The only other solution I can think of is to use an old pseudo random number generator that does not automatically seed and creates the same sequence if given the same seed and then have the teacher distribute the seed to the students. Hardly seems worth it to me, easier just to store the sequence. Also, storing it allows the teacher to have a copy of the questions in the correct order when reviewing it with students, etc. even if she reused the test.
Simple Year Checking with Arrray
in PHP Coding Help
Posted
as pointed out previously by ginerjm you should put the Y in quotes.