-
Posts
4,362 -
Joined
-
Last visited
-
Days Won
11
Everything posted by Zane
-
$string = preg_replace("@(.*)\]@", $1, "Hello Friends [Test] My name is John");
-
perhaps one of your field names are reserved words. Try surrounding them in backticks INSERT INTO payout (`member_id`, `binary`, `tds`, `service`, `total`, `dues`, `amount_paid`) VALUES ('1000000', '200', '10.6', '20.4', '170', '0', '170')
-
This is exactly why PHP.net created the mysql_error function... and you can either use die to show it or just echo it out. $execsql = mysql_query($sql) or die(mysql_error());
-
ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8; http://yoonkit.blogspot.com/2006/03/mysql-charset-from-latin1-to-utf8.html
-
it must be inside the code you use to update the table...or add to it. Show us the code for that.
-
This topic has been moved to PHPFreaks.com Questions, Comments, & Suggestions. http://www.phpfreaks.com/forums/index.php?topic=332508.0
-
@import is only convenient if you have multiple stylesheets. It's pretty much the equivalent to PHP's include function. Using link is pretty much the standard way to get external stylesheets, but using @import instead isn't really looked down upon (at least I think so). It may or may not save you a few milliseconds on load time. And the most obvious differences... - @import is a CSS function - is embedded in the of the HTML. Meaning it's probably cached.
-
Creating an auto incrementing id which only does it once per session?
Zane replied to PapaBurgundy's topic in PHP Coding Help
Having an auto-increment field only increment upon a condition completely takes the auto out of the incrementation. If it is possible then it's most likely a poor design. Your best bet is to add another field called session and keep the id field as a primary key that auto increments. Doing this will give you the ability to join to the users table and collect that users data along with the 'ordered' products. -
I'm not dissing the integrity of jshint or jslint, but that's not exactly the best practice of getting your error messages. Both sites are merely a community driven error message maker according to their standards (which are probably pretty informative; you should probably just read them and fix what it says). In other words, it's all biased opinions on the best way to correct an error, without actually being told an actual BROWSER error, which is the most important piece of information you need to get a solution. If you have Firefox, install Firebug so you can see the actual Javascript error. Most of the time that ability is built into the browser, but I've become so used to Firebug I forgot where it is. Well, there is another way. I believe you can type javascript: into the address bar in IE... but I'm not certain right now.. (too lazy to check)
-
What error? That's a lot of code to analyze without knowing the particular error.
-
The only way to learn is to try it out... you can indeed use IF statements to determine the image type and you can indeed use IF statements to validate an infinite number of other things. Your project can only get as diverse and functional as YOU make it. Though Joomla and Drupal and Wordpress are great ways to end the insanity of reinventing the wheel, a lot of benefit comes from customizing, controlling and manipulating your users' input yourself... from scratch. The moral of the idea... start small.. Do what you can already do, fix it... get it working perfectly.. delete it... remake it again.. get fed up with your whitespace and indenting, delete it all again... redo redo redo... until you know everything there is to know about what you're doing. Then you'll be able to adequately bring something to the table for us to answer.
-
While gizmola laid everything out perfectly (just like a winning superbowl gameplan) for you I have a feeling that it looks a bit more intimidating than your OP had in mind. If you re-read his first reply you'll get every bit of the answer you're looking for out of it. Btw, bashing gizmola's help is like bitch slappin' your momma when you pop out into the new world... or taking a big dump on Socrates' gravesite... or throwing a brand new custom computer through the maker's window in spite of a missing wireless card. I hate to iterate what you've already been told, but seeing as I have absolutely no clue where to begin on gizmo's last explanation (with the screenshot).. I figured you didn't either. So in spite of that, I'll throw in my two cents. Pretty much. That is absolutely what is going on. You request some input and you put it somewhere.. When you throw the word "wiki" around though, you're implying that you want rich-text with images and such. You could easily create a new html file for every user, but that would add up to a lot of files... it's really your decision. What you don't want is for people to be able to put in malicious code, so it all boils down to what you DON'T want them to do. You already know your goal which is to mimic a wiki system, but to mimic it you must know what not to allow and this is where this community's expertise comes in very handy. Just for an example. You don't want a user to be able to enter: - PHP code - Javascript - Redirection links - and pretty much anything that would take them away from the server... or better yet, destroy/vandalize it. If you think you need to allow Javascript, then you'll need to come up with a secure way to allow it and the same goes for PHP, HTML, links, etcetera.. and in doing this you will have created a framework... which is regrettably synonymous with Joomla nowadays. Hopefully I made some sense, otherwise I just wasted a lot of time.
-
You guessed correctly Mike. Prompt is strictly a JS function and to imitate it with PHP would be nothing more than a list of checkboxes down the page.
-
If I had to guess, it's because you're floating the img and not the A anchor tag that the image is in. You need to assign a class to that anchor tag and float that instead.
-
Here's some useful links http://www.denmarkfacts.com/unicode.html http://www.cs.tut.fi/~jkorpela/chars/sorted.html#NS_4551-1 http://www.faqs.org/rfcs/rfc1345.html http://quae.nl/rfc1345.html
-
Best language for automation of anything
Zane replied to devWhiz's topic in Other Programming Languages
a B.S in Computer Information Systems would not include all those languages I mentioned earlier. The most you'd get into would be application languages. By that I mean writing software for different platforms and browsers... NOT architectures (i.e i386 and amd64). PHP would definitely be on the list for CIS and if you're concentrating in Networking then you'll be playing with all the shiny new server OSs like: Windows Server 2008, Ubuntu 10.10 Server, etc... MySQL would be on the list as well. Not only would you dabble in mainly server-side scripting and SQL, but you would be making CAT5/6 cables, setting up a DHCP server, ... setting up a server in general... setting up User Access Control systems or manipulating already existing ones.... and of course the most fun part... Editing/Analyzing/Fixing/Manipulating/Extending other people's code. -
Best language for automation of anything
Zane replied to devWhiz's topic in Other Programming Languages
If you plan on majoring in Computer Science, you'll be dabbling in just about everything. Though PHP won't make it on their list, it is a great language to know, learn and love. Most successful CS Majors have a pretty adequate if not advanced knowledge of all that is computer programming. This includes: Java, C, C#, C++, BASIC, VisualBASIC and so on. If you go for the 400 level classes you'll end up learning Assembly language which is pretty much the heart of it all. You'd be learning UNIX and Windows programming and not to mention how to write your own kernel or Operating System, but that stuff's best left to the overachievers. Really, there isn't much you can do to prepare for Computer Science other than to get better at your math skills. The better at math you are, then IMO the better programmer you're destined to be. -
joining 3 tables and get - not a valid MySQL result resource
Zane replied to jeff5656's topic in MySQL Help
Your second join doesn't JOIN any tables, therefore it's useless. Also, you're selecting from two tables when your selections are distinctly for one...other than the asterisk. Your query should look something like this SELECT * FROM news_read nr INNER JOIN news n ON n.id = nr.news_id INNER JOIN users u ON u.id = nr.user_id ORDER by n.news_date DESC Then, assuming that works, you can trade that asterisk for the fields you DO want... like the actual news text and what not. SELECT nr.news_text, nr.news_date FROM news_read nr INNER JOIN news n ON n.id = nr.news_id INNER JOIN users u ON u.id = nr.user_id ORDER by n.news_date DESC -
then you probably need to break out of the loop foreach($newsfeed as $k => $news) { if ($lastItemtime == $news['time']) { echo " you bought purchased and created"; break; } else { echo $news['action']; } $lastItemtime = $news['time']; }
-
I don't understand why not, $lastItemtime is set to null before the loop even starts. So it's not failing. What about it isn't working?
-
update a temporary variable at the end of the loop... and declare it null beforehand. example $lastItemtime = null; foreach($newsfeed as $k => $news) { if ($lastItemtime == $news['time']) { echo " you bought purchased and created"; } else { echo $news['action']; } $lastItemtime = $news['time']; }
-
Can you describe a little more what you mean by "it's not working" Does something else happen? Does nothing happen? Is the page blank? Do you get a fatal error? Does the code self implode? What?
-
touch should create that directory for you.. I believe and you don't need to go all the way back to public_html, just enter a relative location.. if you're already in public_html, then you should only need "cheese/txt.txt" as your argument. and yes.. GuiltyGear is right So you would need touch("../cheese/text.txt"); if you wanted to create it in a directory other than the one you are in. The only problem I could foresee would be permission issues.
-
Which Markets On the Internet Are Flourishing Right Now?
Zane replied to chaseman's topic in Miscellaneous
p0rn is always booming.