-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
http://www.phpfreaks.com/tutorial/basic-pagination
-
My first guess is that you have your delete condition after your info dump so it's getting deleted on first click but your info dump isn't being updated until next page request. Test it out by instead of clicking the delete a 2nd time, click your refresh button, or go look in your phpmyadmin or w/e after the first click.
-
how to force user to insert the cd to run the application
.josh replied to hassank1's topic in Miscellaneous
Can we say virtual cd emulator? LOL good luck in your endeavor. If you're trying to keep people from pirating your software, I suggest you look into other means, such as requiring online registration, or possibly even splitting your program up into a client/server app. But...I have seen crackers get around even that, by making their own server program that caught outgoing packets from the program and pretended to be the real server. -
Well I think what people meant by "install" was learning what all settings there are, what they do, how to change them, etc...
-
if you're wanting to just straight replace the array with something completely new, without preserving anything, simply assign your new array to the old array. Example: <?php $x = array (1,2,3); $y = array (4,5,6); print_r($x); // old array echo "<br/>"; $x = $y; // assign new array print_r($x); // new array ?>
-
floor() rounds down. ceil() rounds up. round() rounds to nearest int. <?php for ($x = 1.1; $x < 2; $x += .1) { echo "[$x] floor " . floor($x) . " | ceil " . ceil($x) . " | round " . round($x) . "<br />"; } ?> output:
-
In my experience, buying the more expensive thing provides more incentive and motivation to try to learn, so that I won't have wasted my money/time, etc..
-
You don't technically need to pass a session var for it to work. It's a precautionary measure to make sure your var is authentic. <?php session_start(); // connect to db here $result = mysql_query("SELECT * FROM PeopleTbl INNER JOIN ResidentTbl ON (PeopleTbl.NameID = ResidentTbl.Name_ID) WHERE SUBSTRING(NameLast,1,1) = '$var'") or die(mysql_error()); while ($row = mysql_fetch_array($result) ) { echo "<a href = 'target.php?HouseID={$row['HouseID']}'>{$row['NameLastt']} {$row['NameFirst']}</a> {$row['HouseCombined']} <br />"; $_SESSION['HouseID'] = $row['HouseID']; } target.php <?php session_start(); if($_SESSION['HouseID'] == $_GET['HouseID']) { // link var was successfully passed, and it matches the session var, so do something here } else { // something didn't match up. url var don't exist or it don't match // the session var (like, someone tried to alter it directly) // send them back to previous screen, log it, tell them to frakk off, whatever } ?>
-
<?php $result = mysql_query("SELECT * FROM PeopleTbl INNER JOIN ResidentTbl ON (PeopleTbl.NameID = ResidentTbl.Name_ID) WHERE SUBSTRING(NameLast,1,1) = '$var'") or die(mysql_error()); ?> I'm thinking you may need to put some single quotes around $var like I did there, but the die should give you a clue if that's not it.
-
I have a form where I have 3 optional fields to fill out that builds a query string, and the end result could look like any one of the following, depending on whether any/all fields were filled out: Returns everything.... a) .. like '%%' // everything b) .. like '$x%%' // starting with $x c) .. like '$x%$y%' // starting with $x, containing $y d) .. like '$x%$y%$z' // starting with $x, containing $y, ending with $z e) .. like '%$y%$z' // containing $y, ending with $z f) .. like '%%$z' // ending with $z g) .. like '%$y%' // containing $y h) .. like '$x%$z' // starting with $x, ending with $z Now the results seem to always come back the way I expect them to. But I'm just curious about patterns a,b and f. They seem to work...but why? I thought I would have to use extra conditions to make the string only a) not include a like clause at all (so as to return everything) b) show .. like '$x%' f) show .. like '%z' but apparently having double %'s seems to work. So...why? The manual says So I'm interpreting that as 0 + 0 still equals 0 in the end, no harm no foul. Is my interpretation correct?
-
because i can just disable javascript in my browser?
-
damn maybe it's time to renew my contact prescription :/
-
You posted the same code block.
-
okay, echo out $restaurant_equipment does it have what it should have?
-
do you have <?php .. ?> tags inside your included file? Because you already have them wrapped around the include.
-
[SOLVED] whats the best way to transfer variables between pages?
.josh replied to rmmo's topic in PHP Coding Help
It makes it harder, but not impossible. Okay well then how about packet sniffing? -
You said that including it breaks the format. That's not a problem with the include, that's a problem with your html. You shouldn't be splitting up your html like that anyways. It's messy and confusing and begs for errors just like this to happen. Did putting the > on the </table not work?
-
[SOLVED] whats the best way to transfer variables between pages?
.josh replied to rmmo's topic in PHP Coding Help
I disagree. If a session is hijacked, I'd rather only a single abstracted id be available to the hacker than all the info on a silver platter be just handed to them. -
The problem is if they are at a public computer. Jane User finishes his business, logs out, walks away. Next random Joe gets on the computer, presses the back button a few times, and blam, he sees sees Jane's logged in info. The whole concept of logging in/out is not to protect the user from himself. It's to protect the user from other people. And also to protect the server from people, but that's not really applicable to this scenario.
-
You know if you indented your script like a good programmer, you would be able to more easily tell where things are broken. I immediately see that surrounding line 306 is a table opening and closing tags. There are no tr and td tags inside it, and your closing table tag is missing the > at the end. If that doesn't fix it, then to be honest, I'm not going to rake through 750 lines of un-indented code to make sure all your tags are lined up, nor do I really know anybody else that would, either. Indent your code. Get an editor that highlights tags. It will make your life a million times easier.
-
What you need is 2 tables with a 1 to many relationship. http://www.phpfreaks.com/tutorial/data-joins-unions
-
[SOLVED] URL Get: Pass a variable name to another variable in a URL?
.josh replied to foochuck's topic in PHP Coding Help
umm...do you mean to say that you forgot the </a> ? There's no possible way that that would cause your variable to be passed literally. The only three ways it could be passed literally is a) you had single quotes around it b) it was not wrapped in <?php ... ?> tags as an echo. c) your server doesn't recognize and therefor isn't parsing it (which we ruled out) Those are the ONLY three ways. I'm just trying to make this very clear for you, because I don't want you walking away thinking that php code breaks like that when not closing an html tag. It could make what's echoed out look funny markup-wise, but it cannot in any way determine literal vs. figurative interpretation. -
Okay then well either a) it's not really doing that, because he clearly says that when he clicks the back button, it goes to the screen with the info, or b) perhaps he is multi-clicking the back button.
-
fwrite()