1,038 Posted Topics

Member Avatar for shasha821110

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 …

Member Avatar for almostbob
0
121
Member Avatar for sureronald

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]

Member Avatar for ShawnCplus
0
87
Member Avatar for ade92uk

[code=php] // assuming the string is called "someString" $words = explode(" ", $someString); $index = rand(0, count($words)-1); $choice = $words[$index]; [/code]

Member Avatar for ShawnCplus
0
236
Member Avatar for ubaldc

Just making sure, they are actually [icode]$_GET[/icode], [icode]$_POST[/icode] and [icode]$_REQUEST[/icode]

Member Avatar for ubaldc
0
246
Member Avatar for mr.khurrams
Member Avatar for ShawnCplus
0
78
Member Avatar for mlempaa
Member Avatar for chadlong41

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.

Member Avatar for death_oclock
0
112
Member Avatar for rickster11

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.

Member Avatar for ShawnCplus
0
185
Member Avatar for jakx12

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]

Member Avatar for ShawnCplus
0
112
Member Avatar for jakx12

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 …

Member Avatar for diafol
0
99
Member Avatar for rajiva

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.

Member Avatar for ruby50
0
89
Member Avatar for ShawnCplus

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?

Member Avatar for Salem
0
91
Member Avatar for gpittingale

Your query might be failing. Use [code=php] $result = mysql_query($sql_query,$conn) or die('Invalid query: ' . mysql_error()); [/code]

Member Avatar for gpittingale
0
176
Member Avatar for nicolemcgrgr50

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 :)

Member Avatar for Dani
0
83
Member Avatar for smartness

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.

Member Avatar for diafol
0
146
Member Avatar for emclinux

All of those [icode]str_replace[/icode]'s are unnecessary. There is a built in PHP function. [code=php]$formatted_text = nl2br($text);[/code]

Member Avatar for emclinux
0
178
Member Avatar for Book38

It's not encoded. Obfuscation != Encryption. Please provide all of the PHP, not just 2 lines of it.

Member Avatar for ShawnCplus
0
117
Member Avatar for VIeditorlover

Actually your "pure html" example looks almost identical to ColdFusion from Adobe or, similarly, Genshi in Python.

Member Avatar for Fest3er
0
121
Member Avatar for aodpreacher

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.

Member Avatar for aodpreacher
0
90
Member Avatar for jtmcgee

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.

Member Avatar for jtmcgee
0
165
Member Avatar for Sheridan

Why are you a refugee from Apache? If anything it would be a refugee from IIS.

Member Avatar for lightningrod66
0
112
Member Avatar for rajesh.bl

[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 } …

Member Avatar for rajesh.bl
0
200
Member Avatar for theimben

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]; } …

Member Avatar for theimben
0
124
Member Avatar for spokie

Depends on what type of testing. In most cases testing should be done during development, not at the end.

Member Avatar for sikka_varun
0
73
Member Avatar for nszumowski

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.

Member Avatar for nszumowski
0
102
Member Avatar for franko75

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 …

Member Avatar for somedude3488
0
114
Member Avatar for maxbox

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.

Member Avatar for sikka_varun
0
88
Member Avatar for bigbob

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 …

Member Avatar for digital-ether
0
138
Member Avatar for bthaxor

[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 = …

Member Avatar for bthaxor
0
176
Member Avatar for kibosh

You need the ; for the htmlentity to be parsed so it's. [code=php] echo "&deg;"; [/code]

Member Avatar for Aamit
0
2K
Member Avatar for Kavitha Butchi

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]

Member Avatar for Kavitha Butchi
0
2K
Member Avatar for veledrom

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; } …

Member Avatar for veledrom
0
71
Member Avatar for kibosh

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]

Member Avatar for kibosh
0
124
Member Avatar for Kavitha Butchi

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.

Member Avatar for Kavitha Butchi
0
209
Member Avatar for parhs

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.

Member Avatar for pkpandit
0
129
Member Avatar for squidthekiller

*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.

Member Avatar for peter_budo
0
57
Member Avatar for mvnr_83

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.

Member Avatar for ShawnCplus
0
68
Member Avatar for paddy_c

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.

Member Avatar for PomonaGrange
0
130
Member Avatar for snowsurfer32

Yeah... mailto doesn't work that way. Take a quick search on google or Daniweb(there are plenty of them) on email scripts.

Member Avatar for PomonaGrange
0
112
Member Avatar for moerpheus

[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)

Member Avatar for moerpheus
0
266
Member Avatar for phpdude89

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 …

Member Avatar for phpdude89
0
87
Member Avatar for PomonaGrange
Member Avatar for PomonaGrange
0
210
Member Avatar for hopalongcassidy

[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?

Member Avatar for digital-ether
0
801
Member Avatar for blaaze
Member Avatar for blaaze
0
107
Member Avatar for Venom Rush

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)

Member Avatar for Venom Rush
0
90
Member Avatar for maddogsprofiles

Might want to head over to the Javascript section to have that one answered.

Member Avatar for ShawnCplus
0
79
Member Avatar for tuse

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.

Member Avatar for tuse
0
91
Member Avatar for frezz

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.

Member Avatar for essential
0
120
Member Avatar for Shanti C

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

Member Avatar for Shanti C
0
96
Member Avatar for veledrom

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.

Member Avatar for ShawnCplus
0
47

The End.