1,038 Posted Topics
Re: I use gVim/vim with a bunch of custom plugins along with VCS which gives me SVN control, taglist which gives me CTRL+Click navigation for classes/functions/etc. It has a pretty steep learning curve but once you get used to it and actually know how to use it there is no equal … | |
Re: Do not use ereg or eregi functions, they are being deprecated in PHP5.3. Use preg_replace instead. And if your users' input is resulting in a MySQL error you have MUCH more to worry about than commas. Read up on [url=php.net/mysql_real_escape_string]mysql_real_escape_string[/url] | |
Re: [code=php] // assuming the string is called "someString" $words = explode(" ", $someString); $index = rand(0, count($words)-1); $choice = $words[$index]; [/code] | |
Re: Just making sure, they are actually [icode]$_GET[/icode], [icode]$_POST[/icode] and [icode]$_REQUEST[/icode] | |
Re: 1. Use code tags 2. [icode]<?php [b]echo[/b] imageResize... ?>[/icode] | |
Re: Since it is stateless you can't persist objects across requests without storing to a file in some way be it a database, cookie(session) or some other flatfile. Not to mention maintainability is one very unimportant reason to pick OOP. | |
Re: It's also not doubling in the variable, you're just outputing the variable twice. You have a [icode]cout[/icode] inside the if, and a [icode]cout[/icode] before the return. | |
Re: I think someone fixed a very similar problem for you before. You cannot surround variables with single quotes, ie., '. You either have to use no quotes at all or use double (") quotes. Read through a few sections of this [url]http://www.w3schools.com/PHP/[/url] | |
Re: This is your fifth post here, use code tags. It is shouted at you at the very instant you try to post a comment. In the background of the text box, in the required reading to post on the forums and in the rules of the forums. When you don't … ![]() | |
Re: Well Ruby on Rails is a completely separate framework from PHP. It's pretty much one or the other when you work with it as far as I know. | |
No matter what Daniweb does to "hint" to place code tags around code no one pays attention. Could there be some sort of feature which checks a post for certain code keywords and alerts the user in some way to place code tags around code? | |
Re: Your query might be failing. Use [code=php] $result = mysql_query($sql_query,$conn) or die('Invalid query: ' . mysql_error()); [/code] | |
Re: There is no way to detect a user leaving your site without javascript. You can't do it serverside since in they leave they won't be interacting with your server :) | |
Re: that's pretty much it. It's usually better to use absolute paths ie., [icode]/srv/www/public_html/includes/fetch.php[/icode] but on shared hosting that might not be an option so [icode]../file.php[/icode] works just as well. ![]() | |
Re: All of those [icode]str_replace[/icode]'s are unnecessary. There is a built in PHP function. [code=php]$formatted_text = nl2br($text);[/code] | |
Re: It's not encoded. Obfuscation != Encryption. Please provide all of the PHP, not just 2 lines of it. | |
Re: Actually your "pure html" example looks almost identical to ColdFusion from Adobe or, similarly, Genshi in Python. | |
Re: If you already know python and want to learn a web language you might want to consider Django, a web framework in Python. Would be easier than learning a new language. | |
Re: Why are you doing a string replace after you create the string instead of actually modifying the original string, its wasted CPU cycles, even if it is minimal. | |
Re: Why are you a refugee from Apache? If anything it would be a refugee from IIS. | |
Re: [icode]===[/icode] is not a syntax error. It checks to make sure they are the same value and the same type. [code=php] $number = 1; $string = "1"; if($number === $string) { echo "They match!"; // This won't happen } else { echo "They don't match!"; // This will happen } … | |
Re: Firstly, you have two functions that do exactly the same thing. Secondly, you're passing an array to a function [icode]file_get_contents[/icode] that accepts a string. [code=php] <?php $req_url = array('http://www.first.com', 'http://www.second.com', 'http://www.third.com'); function get_inner_string($a,$b,$c) // Gets a string between 2 strings { $y = explode($b,$a); $x = explode($c,$y[1]); return $x[0]; } … | |
Re: Depends on what type of testing. In most cases testing should be done during development, not at the end. | |
Re: you can't link to the page to submit a form. The [icode]<a href="../elist.php"><button>Submit</button></a>[/icode] should be [code=html]<input type="submit" value="Submit" />[/code] Side note: There is absolutely no reason to use javascript to submit that form. | |
Re: It is a pretty good start at OOP however I would suggest to you that as a general rule of thumb with OOP methods are named in CamelCase format ie., [code=php] class someClass { private $some_property; public function someMethod() {} }[/code] So properties(fields in Java) are written in underscore format … | |
Re: What is the warning? Also, using error suppression is usually bad practice unless absolutely necessary. You should create cases if the variables don't exist so you can easily handle it either way. | |
Re: Well you can't really do array_unique on mysql_fetch_array since it actually acts as an iterator for the MYSQL Resource that is returned by mysql query. The [B]correct[/B] way to fix it would be to fix your database to have unique keys so you don't have duplicates. The [B]hacky[/B] way to … | |
![]() | Re: [icode](([url]http://)?([/url][\w\-/\.]+)+\s)[/icode] is a much simpler regular expression and does the same thing. Match 1 is your link so you can pretty much just replace your regex with that and replace \\0 with \\1. However it can't really be fixed by a one-liner. [code=php] $link = preg_replace('#((http://)?([\w\-/\.]+)+\s)#', '\1', $r->text); $link = … ![]() |
Re: You need the ; for the htmlentity to be parsed so it's. [code=php] echo "°"; [/code] | |
Re: Well it could be because the "BACKGROUND" attribute hasn't been used in about 10 years. [code=php] <style type="text/css"> background-image:url('<?php echo $xyzimage ?>'); </style> [/code] | |
Re: It's called a switch statement. [code=php] switch($value) { case 1: do something; break; case 2: do something; break; default: do something if the others aren't true; break; } [/code] Though there is also the much more hacky way of [code=php] if(in_array($value, array(1, 2, 3, 4, 5)) { do something; } … | |
Re: mysql_query returns an object, not a string. you have to use mysql_fetch_array or mysql_fetch_assoc to turn the resulting resource set into an array. [url]http://us.php.net/mysql_fetch_assoc[/url] | |
Re: Aside from what they've said about validation just remove the quotes around the variable. Variables inside '' aren't parsed out so you won't get anything but that string. Either use "" or none at all when only echoing a variable. | |
Re: If you're thinking large scale you might want to start thinking about an ORM to handle your object model and connections. Doctrine, Propel and Creole are 3 of the bigger ORMs in PHP. | |
Re: *cough* You definitely just bumped a 3+ year old thread along with ignoring code tags. Aside from that A) What is the error, saying "I have an error" is the equivalent of a Check Engine light. | |
Re: PHP has no built-in functionality for threading. You can fake it by using shell calls to fork php processes but that is a far cry from multithreading. | |
Re: In PHP if it says there is an unexpected T_<something> on a line the error is usually in the lines ABOVE that line, not ON the line so. | |
Re: Yeah... mailto doesn't work that way. Take a quick search on google or Daniweb(there are plenty of them) on email scripts. | |
Re: [QUOTE=Erni;742101] My experience tells me that php is used mostly for [B]small[/B] and [B]medium[/B] size projects, huge projects are written on other environment.[/QUOTE] 3 "words": Facebook, Yahoo, and a little one called Wikipedia (MediaWiki) | |
Re: Well for starters you wont be able to have a cohesive, trusting set of developers by hiding your code from them. It will make the code less compatible than it could be. Modularity is good to a point, then all it does is serve to obfuscate code, frustrate developers and … | |
Re: Built-in function for php [url]http://php.net/wordwrap[/url] | |
Re: [QUOTE=hopalongcassidy;737402]Of course not. If I knew how to pass info from one process to another, I would not have asked the question![/QUOTE] The reason to post code was to clarify your question. It was incredibly vague. In what context are you passing information between processes? | |
Re: So you want a copy of [url=http://www.webtomail.co.cc/]WebToMail[/url]? | |
Re: What you could do is modify the onsubmit property of the form to send an AJAX request to validate the CAPTCHA, if that validates then return true(submit the form), or return false(cancels the submit) | |
Re: Might want to head over to the Javascript section to have that one answered. | |
Re: Actually that code does nothing. It should be [code=php]<?php echo $_POST['txt'] ?>[/code] Anyway, the reason that it would have been in there is if there was validation happening on that page then the forms would be repopulated so a user would not have to re-type. | |
Re: Firstly, you don't need [icode]window.confirm[/icode], [icode]confirm[/icode] works just fine. Secondly, you're missing the ending [icode])[/icode] on the first if-check. | |
Re: If you are on a shared provider and don't have access to the server's php.ini file you can use the [url]http://us2.php.net/iniset[/url] function to manipulate settings at runtime | |
Re: The filename does not specify a path to save the file, only the name of the file to be downloaded. You can't force a user to save a file in a particular place. |
The End.