1,038 Posted Topics
Re: Use [icode]<pre></pre>[/icode] or [icode]<code></code>[/icode] tags around it like: [code=html] <pre> #include <iostream> int main(int argc, char** argv) { std::cout << "Hello World!\n"; return 0; } </pre>[/code] Note the [icode]<[/icode]. Make sure you encode any HTML entities (<, >, &, etc.) so they don't get mixed in with the markup | |
Re: It does save newlines, but my guess is that on output you're not using nl2br. The browser ignores newlines when rendering text unless it is in a <pre>, <code> or tag with white-space:pre applied. So yeah, use nl2br or get a rich-text editor | |
![]() | |
Re: A) Don't use ereg anything. B) [url]http://php.net/filter_input[/url] | |
Re: [icode]../images/[/icode] The .. means up one directory, so [icode]../images/[/icode] really says [icode]htdocs/mysite/images/[/icode]. It would probably be better to use the absolute path but you haven't posted one so I don't know you're directory structure :) | |
Re: You can get it done with just CSS [code=css] #some_id { position: fixed; }[/code] | |
Re: The server it is working on probably has notices turned off. You should have an [icode]if (isset($_POST['username']))[/icode] block around that anyway. | |
Re: [QUOTE=chrishea;999849]How about: [CODE] <?PHP while($row=(mysql_fetch_array(result)) { echo " <td>$row['photo']</td><td>$row['info']</td> "; if ($row=(mysql_fetch_array(result)) { echo " <td>$row['photo']</td><td>$row['info']</td> "; } echo "</tr>"; } ?> [/CODE] I find it messy to go in and out of PHP so I modified it to make it all PHP.[/QUOTE] Just no. For two reasons: Reason 1) … | |
Re: You would setup a server-side script (using PHP or ASP or whatever your language is) that uses cURL or whatever your language uses to make and output the response. Then your AJAX call just points to your script. [code]RemoteServer ------------------- somefile.php MyServer ----------------- myapifile.php `- Make request to RemoteServer.com/somefile.php `- … | |
![]() | Re: The example you described isn't AJAX, that's just standard Javascript validation. AJAX would be, for example, as the user types display a list of possible selections underneath the box. [url]http://w3schools.com/ajax/ajax_intro.asp[/url] ![]() |
Re: A) Use [icode] <script type="text/javascript>[/icode], not [icode]<Script language="JavaScript">[/icode], it's old and the language attribute is deprecated B) Your code doesn't actually do anything since it's never called (or at least, it'll always fail as soon as the page loads C) [code=html] <head> <script type="text/javascript"> var validateUsername = function () { … | |
Re: [QUOTE=armyguydave69;996456]They do look good; however, I need one that's going to offer unlimited space and bandwidth. I have found two I do like, is there anyway to do a test (maybe through ping) or something to check out the reliability of the server and make sure they have good load … ![]() | |
Re: [quote]Show all steps and derivations to receive full credit.[/quote] Sounds like you better get going. You could start by showing us some of what you've tried already or by explaining bits you don't understand. After all, this is your first post so maybe you missed the GIGANTIC text at the … | |
Re: Show us your current code, we don't know you database schema or what to change if you don't | |
Re: Just do it inside the constructor, that's what it is there for. | |
Re: Or you could just do [code=php] <script type="text/javascript"> var somejsarray = <?php echo json_encode($somephparray) ?>; </script>[/code] | |
Re: None that I know of. That's a very strange question for a programming language. It's not like using PHP kills babies or something. The only thing that could even be remotely construed as an ethically related issue is the decision between open/closed source which I'll let you search for on … | |
Re: Please elaborate on "does not work", does it give errors or just not print anything? | |
Re: _ is usually associated with gettext with deals with text localization. | |
Re: It's syntactically correct and there's really no harm in it except for the fact that its a complete waste since the reason you have a function returning a value is because you want to use it. If you don't want to return a value then a function returns void. [code=c] … | |
Re: Try actually putting something in your catch statement. And if you're not getting anything there then take the old-fashioned approach and just put asserts/couts along your code to see where it dies [CODE=c++]catch (sql::SQLException &e) { }[/CODE] | |
Re: [code=php]$row=mysql_fetch_array($result); $vValue = $row['vValue'];[/code] You're fetching one row before your while loop so its essentially doing nothing with the first row | |
Re: Because private is a keyword in PHP. Also, when using a variable inside brackets is also requires the $. | |
Re: A) Don't bump like that, its annoying. B) Try Element.prototype. If that doesn't work I have no idea since both Object.proto... and Element.proto... worked for me. | |
Re: Explode on spaces and use ORs for the extra terms. [url]http://php.net/explode[/url] | |
Re: [icode]var_dump($filename);[/icode] inside the foreach loop and post the output | |
Re: You create your list as [icode]list <char>[/icode] but your function prototype never defines a template type, you just have [icode]list[/icode]. So you could either make the function templated or you can always assume [icode]<char>[/icode] [code=c++] template <typename T> void sort(list<T> ch) { ch.sort(); } sort<char>(ch); // or void sort (list … | |
Re: [url]http://www.imagemagick.org/Magick++/tutorial/Magick++_tutorial.pdf[/url] | |
Re: You might want to try compiling and working your way through the errors. These two lines will definitely cause issues. [code=c++]// call function calcAverage int calcAverage(int score1, int score2, int score3); // call function printStars void printStars(int avg, int id);[/code] | |
Re: Show your current query and we can walk you through what to fix. | |
Re: [QUOTE=jen140;987024]Good day. I want to create a small app that would take out the content from a rss feed and posteriorly from the url . I know that would be easily done in perl with regular expressions, but in php it seams a bit more difficult. So i want to … | |
Re: well a quick first guess would be did you have the computer on a carpeted floor when you had the case open, you might have ran into a little ESD on the memory when you had it open you be remarkably surprised at how little it takes to ruin memory. … | |
Re: Hmm, have you seen sprintf or does this serve a different purpose? This could be great if the function took, say, a callback function that could be used to validate fields that were passed to it. | |
Re: I would suggest that you think of a way to make it a bit more secure than simply posting any email you get to the web but if that's what you want to do IMAP is probably the way to go. [url]http://php.net/imap[/url] | |
Re: PHP Directory functions, the examples are in there: [url]http://php.net/dir[/url] | |
Re: Where you have [icode]mysql_query($sql_updt) or die(mysql_error());[/icode] put [icode]echo $sql_updt;[/icode] and paste the the output here | |
Re: [QUOTE=ctrl4ltdeleteme;815118]ugh, php can be so hacky sometimes. Though I guess you could just put that in a wrapper function or something.[/QUOTE] Setting a cookie to the past has nothing to do with PHP being hacky, it forces the browser (which is what's being hacky) to delete the cookie which is … | |
Re: [url]http://php.net/preg_match[/url] | |
Re: Here's a hint: You want to use both. The PHP shouldn't be a "backup" since you can't trust client-side validation. Client-side validation is nice to give users some feedback but it can also be malicious. | |
Re: You would use the function just like you would inside another function. With the example code afunction isn't defined (there is no prototype.) You could do something like this [code=c++] void afunction(); // function prototype class example { public: example(); ~example(); void doSomthing() { afunction(); } }; void afunction() { … | |
Re: [code=php] <?php // create short variable names $searchtype=$_POST['searchtype']; $searchterm=trim($_POST['searchterm']); if (!$searchtype || !$searchterm) { echo 'You have not entered search details.'; exit; } if (!get_magic_quotes_gpc()){ $searchtype = addslashes($searchtype); $searchterm = addslashes($searchterm); } $db = new mysqli('localhost', 'username', 'password', 'database'); if (mysqli_connect_errno()) { echo 'Error: Could not connect to database. Please … | |
Re: You won't be able to change the style of alert() windows since the browser decides what they look like. You could, however, create your own modal dialogs using lightboxes. Google around for lightbox or thickbox. [url]http://jquery.com/demo/thickbox/[/url] | |
Re: Tomcat is traditionally used for Java, not for PHP. WAMP was made to be a turnkey PHP server | |
Re: [QUOTE=rashid47010;981877][code=php] $TeacherInterrupts = true; $counter = 1; while ($counter < 11) { print(" counter = " + $counter + "<BR>"); if ($TeacherInterrupts = = true) break; $counter++; } [/code] Dear concern I want to know the "+$counter+" meaning and I am also getting the parse error on line #4 please … | |
Re: Then just get the absolute positions of both then subtract the item you want's position from the item that it's relative from. [code] Box1 : x 100, y 200 Box2 : x 234, y 123 Box2 Relative Box1: x 134, y -77[/code] | |
Re: You'd need something along the lines of this [code=javascript] function changeClass(elem, className1,className2) { elem.className = (elem.className == className1)?className2:className1; } [/code] Then the anchor would look like this [code=html]<a href='#' class='class1' onclick='changeClass(this,"class1","class2");'>Hello World</a>[/code] | |
Re: Congrats for making slashdot! |
The End.