premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
Well for one, you are trimming the whole statement, so it is just returning if the address trimmed properly. For 2, you can try trimming it properly: if (trim($rs->Fields("Address")) !="") Or you can try using empty instead: if (!empty($rs->Fields("Address"))) And see if that works. Let me know if either or does not work.
-
Extract specific information from a PHP Multidimensional Array
premiso replied to Tsalagi's topic in PHP Coding Help
Putting data in tables is still relevant, especially when you are say trying to display a full database table for manipulation. You just have to use the right tools for the job, if the data coming out is not tabular data, than way style it and make it look pretty with divs -
Someone already took the liberty to set this up for you: http://www.thedanglybits.com/2006/10/13/update-send-email-with-php-and-gmail-hosted-for-your-domain/ "phpGMailer"
-
Well it would actually be really easy with an ip table. You setup the id column as auto_increment, a userid column and an ip column. Make the id primary key then anytime you wanna see the ip's a user has used you just do a join query. It is actually how most databases are done and is required for a 3rd normalized form database structure. But whichever way works best for you.
-
How it was explained made little sense as I did not know you were working with IP's. Now the question comes into play, why are you adding multiple ips in one column? Why not create an iplog table and add them there, this would normalize the database and probably be preferred? To answer your question, however, here is the code: UPDATE users SET iplog = CONCAT(iplog, '$ip') WHERE id = '$id' AND iplog NOT LIKE '%$ip%' Should do the trick.
-
I do not think WAMP is setup to run off a thumb drive unless you do some major configuration as I believe it stores some registry entries etc. However that is what Xampp was made for. Take a look at that and see if you can get it to work for ya. EDIT: That is of course if Raj's simple solution did not fix your issue
-
Remove the trim as you are not closing the paran and I do not think it can be used like that, and it does not need to be trimmed if you are just checking for a character in that string. Try that and see if it helps.
-
[ot] Well mine is Pepper-Jack. [/ot] I would agree, this feature would be nice.
-
It is all just one big conspiracy theory. I mean look at the movie "The Matrix" when Morpheus says..."Is that air you're breathing". And viola Air no longer existed for Neo. There is no spoon!
-
[ot]I just wanted to try out this off-topic feature...nice[/ot] Thanks for the compliments
-
Well if you wanted to know how, wouldn't a better question have been, "How do you preform an update statement with concat if unique?" instead of, "Can you"? Note this sticky. Anyhow, in order to help you why not give us something to work with, as I do not fully understand what you want done, perhaps some sample code you have tried or some sample data of what you want to happen to it. That will help get your topic solved a lot quicker.
-
date("d/m/Y") That will test d/m/Y vs a unix timestamp, if you are just checking todays date use time instead.
-
The $finish should be before the if statement. As it stands right now, $finish will default to 0 and so so date will never really be less than it.
-
check if a stored time() is more than 2 hours ago
premiso replied to Vivid Lust's topic in PHP Coding Help
An alternative to strtotime $timeTwoHoursAgo = time()-60*60*2; // minus 60 seconds times 60 minutes times 2 = 2 hours ago) Either or works, the strotime is probably easier to read. -
$l = new $this->moduleList[$module](); That will work, basically using the { } wanted to look for a function, doing it like above looks for a class.
-
Nope, I do not think it is. If he wants someone to code it for him, offer to pay us to do it and post in the freelance section, if he would have at least started it and posted a specific question I am all for helping him, but this kind of post is ridiculous and I just wish I knew who his professor was so I could inform them, as if someone codes it for him, he does not deserve that grade because he slacked and it is considered cheating. I had to code my way through college and I earned my 4.0, and to have someone do this crap is a slap in the face to anyone who put effort into a class. As he obviously does not care about it, he should not get a decent grade just by posting on a forum and expecting pity for him not doing the work and not taking the time to learn the subject. If you give a man a fish he eats for one day, if you teach how to fish he can eat for life. P.S. If someone posted: I have a 10-page essay due tomorrow that is worth 20% of my grade it has to be written on the Civil War with specific quotes from books, at least 10 of them and done in MLA format, please do it for me, oh and by the way I have not even started to write this essay so start from scratch. Would you have a different outlook on this post? Either way it is cheating having someone write it for you and not help you with it.
-
Sure: for($x = 0; $x < count($_SESSION['permissions']); $x++) { switch ($_SESSION['permissions'][$x]) { default: case 1:// display the menu item print $menus[$x]."<br />"; break; case 0: // other code here } } I believe that is what you were getting after?
-
I do not think this is possible without an ActiveX control running on your site, such as Java or Flash, due to browser security.
-
I am sure a lot of people can do it, but will they? Chances are slim to none. You seem like you do not even have the foundation of the code started. Just look at it this way, if you came to me and said, "I am learning to change my brakes, here are the pads I will be back in 5 hours please have it done." Will I do it? Nope. Same scenario here, it is no skin off of my nose if you fail that course. Try it for yourself and when you get stuck post here, if you cannot do it than you deserve the grade you get for slacking, not reading your material and most importantly not talking to the professor after class and asking for help with what confused you during the lecture.
-
They can inject code, as far as it being something dangerous it depends on example.com. If their website does not have their get-data filtered. Sure they can inject code and now it looks like your site is trying to exploit the example.com, so they basically get a free probe using your site. I would still filter the GET data just for that reason above, and really it is not too much of an extra step to run strip_tags or use regex to replace certain items. But think about what type of data is going to be in that get getting passed through and filter it to only allow that type (IE if it should be all letters or numbers make sure it is).
-
Flushing the file read buffer as its being read
premiso replied to dpacmittal's topic in PHP Coding Help
Use fread with a while/for loop setting the 2nd parameter in fread to the number of bit you want read, and loop till it is the end of file. You will also use ob_Start before the loop with ob_flush / flush during the loop (note this will only work on some browsers). That is called output buffering. -
$res = mysql_query("SELECT LAST_INSERT_ID()"); $likes = mysql_fetch_row($res); $likes = $likes[0]; echo $likes; You have to fetch the data to display it as seen above.
-
Variable Scope is something you should read up on as well as functions. You would have to define $count inside the function and pass $badges as a reference (which means the variable will be returned as the parameter used during the function call). Try the below and see if that works, note the &$badges passes that argument as a reference and the $count=1 makes 1 the default value for count of the function, but allows you to pass that to the function so you can send anything in there for count you want. <?php function addto($string, &$badges, $count=1){ if($count==4){ $count=1; $badges.="<br>".$string; } else { $count++; $badges.=$string; } } $sql1="SELECT something FROM blahblah WHERE login='".$_SESSION['login']."'"; $results1 = mysql_query($sql1, $link); $arr1 = mysql_fetch_row($results1); $resultss1 = $arr1[0]; $badges = ""; if ($resultss1==1){ addto("Test!", $badges); } echo($badges); ?> Hopefully that makes sense.
-
I need to start using MySQLi and can MySQL lol. Well at least the SQL was correct Just wrong function (feels like a dork for not reading the manual thoroughly).
-
Perhaps there is an error? Unsure how your script works have you tried printing out the $this->myerror array and seeing if there was indeed an error and what that error was? Aside from that, the SQL looks fine as far as I can tell.