Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
What do you mean by:
-
I have to ask why you would even have those queries like that anyways... Why are you grabbing isReading/isPhysical if you already know what they are in the WHERE clause?
-
Just do a separate mysql_fetch_assoc above your loop... // grab a row $row = mysql_fetch_assoc($qry); // do whatever with row, simple example below $ret .= '<tr><td>'.$row['title'].'</td></tr>'; while($row = mysql_fetch_assoc())
-
I know a lot of the bigger sites use Comet If you want to just use AJAX, your only real option is to keep polling.
-
IPv4 addresses are unsigned 32-bit integers, so you should store them as unsigned ints, not as chars. Note: if you use the ip2long function it will return a signed int, not unsigned.
-
How to save form data and then re-populate on "submit"
Philip replied to mbrittb00's topic in PHP Coding Help
echo $_SERVER['PHP_SELF']; // note uppercase That should almost always work (unless you're running like before 4.3 - even so you really need to update your software ) Also, a blank action in a form defaults to the page it is on. -
haha good job. but if for some reason wordwrap is taken out of the core on your system, premiso's function should work hehe Oh and congrats on 5k posts
-
Why not just use the last parameter of wordwrap? It'll cut long words if you pass true to its value echo wordwrap("cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccchghggggggggggggggggf",10, "<br />\n", true);
-
setting a password that will expire after one use
Philip replied to elviapw's topic in PHP Coding Help
Read the comments in the code... first one was your code, second is mine with updates. <?php // Grabs your request var $human = $_REQUEST["human"]; // Check to see if it is correct if (($human == "elvia" ) || ($human == "roger" ) || ($human == "dano1" )) { // Do a mysqli login $dbh = mysqli_connect("--"); //search for name in database // select the username $sql = ("SELECT * FROM artnet WHERE username = '.$human.' "); // run the query $query = mysqli_query($dbh, $sql); // if the query was successful (note: this does NOT check to see if the data returned was what you wanted) if ($query) { // echo a hello echo"YOU GET IN"; // insert into DB $sql2 = ("INSERT into artnet (username) VALUES ('$human')"); //or, YOU ALREADY GOT IN ONCE } else { // echo a deny echo"NAMES ALREADY HERE"; } } else { // Did not put the correct human. echo"DENIED"; } ?> <?php $human = $_GET['human']; // or $_POST if(in_array($human, array('elvia','roger','dano1'))) { // connect to mysqli $dbh = mysqli_connect('--'); // select the username // note the limit 1 will only allow 1 row to be returned (since thats all you need... will make it faster with large DBs) $sql = "SELECT * FROM artnet WHERE username = '".$human."' LIMIT 1"; // run the query: $query = mysqli_query($dbh, $sql); // you should run some error reporting here, but I won't put that in for you. // if we had a result if(mysqli_num_rows($query) > 0) { // that means the name was already in the DB echo "Name already here!"; } else { // name was not in the DB yet echo 'You get access!'; // Add to DB $query = "INSERT INTO artnet (username) VALUES ('".$human."')"; mysqli_query($dbh, $sql); } } else { // not in the allowed array, show error echo 'Invalid human'; } ?> -
Bah, maybe not. I'm seeing things in the Show new replies to your posts screen. Ignore me.
-
I see this has been installed, yes?
-
Contracts with limited revisions is a lifesaver.
-
Related: http://googleblog.blogspot.com/2009/12/now-you-see-it-now-you-dont.html (even though it's kind of old news..) I don't mind it... but it kinda bugs me that it doesn't fade back out. I think if anything it should be 50% opacity & fade up to full & back to 50%
-
problematic post / preview display
Philip replied to nrg_alpha's topic in PHPFreaks.com Website Feedback
<div class="story"> XXX A BUNCH OF PLAIN TEXT XXX <> Doing it to me too. WYSIWYG is off for me. Also running 3.0.195.33 Didn't we have this problem (with other text ofc) before? (can't find the specific link atm) -
Howdy - also from Texas Took a look at your site, some pretty nice clients you got there!
-
Reading over this, you'd need these tables... unless you can have multiple divisions per team, or multiple teams per player: Divisions Teams Players
-
If I understand it correctly, you're wanting to basically combine your UPDATE/SELECT queries...
-
What do you think of the new look of these forums?
Philip replied to smerny's topic in PHPFreaks.com Website Feedback
What about having a JS thing, where it shows like "A total of 10 people have been active in this thread" and then click to show who. -
Ignore this. The bg of the topic solved in the forums looked more white than green on my secondary monitor.
-
I've just started getting into Stored Procedures/Functions, and love 'em. Great for keeping the db structure hidden
-
Welcome to phpfreaks, edmund. So long as you don't take a stick and poke the mods or admins in their cages, I'm sure you won't regret joining the forums. As you should notice he said mods or admins, but people like nrg_alpha who is just a recommended means you can poke as much as you feel like. I poke back.
-
What do you think of the new look of these forums?
Philip replied to smerny's topic in PHPFreaks.com Website Feedback
Its going to take some getting used to. Change is good, but at first typically people hate it. -
I'd die for those temps on my card... even when they are underclocked.