126 Posted Topics
Re: I'm going to come right out with it. You've been here since 2011; asking and asking. Not solving a single thing yourself. One challenge in programming is problem solving. And when things are just given to you... you learn nothing. Let's analyse "Undefined variable". "Undefined" means that it hasn't been … | |
Re: @Masterblank That could be simplified a lot and improved. function getIp($ifNull = "") { # allow specification of null value if (!empty($_SERVER['HTTP_CLIENT_IP'])) { return $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { return $_SERVER['HTTP_X_FORWARDED_FOR']; } return $_SERVER['REMOTE_ADDR'] ? $_SERVER['REMOTE_ADDR'] : $ifNull; } getIp("127.0.0.1"); >> IP or 127.0.0.1 if it can't find it | |
Re: @diafol — How come you put in those closing PHP tags? Just curious. It's PHP only. ;D | |
I am trying to get the following ENUM to work, but it's not working. Any help is appreciated. class Colour(Enum): WHITE = (255,255,255) BLACK = (0,0,0) RED = (215,45,45) BLUE = (45,87,214) YELLOW = (230,223,48) GREEN = (45,194,64) Using it: `Colour.BLACK` Error: /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 "/Users/blooop/main.py" Traceback (most recent call last): File … | |
I'm a beginner to Python and I decided to make a permutation finder program. Have fun and don't question the name. :) | |
Re: Well, if you want to know a good way to do this... Use [ChartJS](http://chartjs.org/); get your data into the Javascript and you should be good to go. I use it almost every week. It's excellent with amazing documentation. *Downside: HTML5 only!* | |
Re: Here's an example: $hours = 1; $cookie = [ "name" => "myCookie", "value" => 123, "expire" => time()+(3600*$hours) // Set the cookie expiry to 1 hour (3600 seconds) * $hours ]; setcookie($cookie['name'], $cookie['value'], $cookie['expire']); // Check if it was created if (isset($_COOKIE[$cookie['name'])) { echo $cookie['name'] . " is set."; } … | |
Re: I highly recommend using an industry leader. This is so that you're not just using an SMTP "SMS" messenger. Try [Clickatell](https://www.clickatell.com/clickatell-products/online-products/sms-gateway-developers-central/). They look like they have a high reputation online. | |
Re: I believe `++$counter` is supposed to be `$counter++`. Also, in your OP you mentioned your password is 'passowrd'. In your code, it's 'password'. Change this: if( !( $database = mysql_connect( "localhost", "iw3htp", "password" ) ) ) ...to this: if( !( $database = mysql_connect( "localhost", "iw3htp", "passowrd" ) ) ) Also, … | |
Re: It's `number_format`, not `numberformat`. These errors are the *most basic errors in PHP*. You should be able to read these no problem. You could've found this on Google VERY easily. Stop coming here just to get stuff easy. A little reading never does harm. **Don't take this in a negative … | |
Re: Even if it's a millisecond, you should still be somewhat critical. Think about it. If your site got popular over night for some reason, those milliseconds would add up fairly quickly. Try to design something that will cause the least delay possible. <1ms is good. | |
Re: I'd say it's always a good benefit to learn the \*NIX filesystem, as you can program for it accordingly. But, it is not required. I'd say that if you're doing PHP, it's a great benefit, since most PHP installations are on Linux. It's really up to you. You can gain … | |
Re: If you're on any Linux OS, you'd usually get something like this: `sudo apt-get/yum update [package]`. Speak with your host if you're unsure. | |
Re: Lines 40-67 — you do not close your if's. Line 186: I don't see a problem. **Might be a good idea to share the error with us.** | |
Re: Why don't you try developing in the cloud? Where everything is setup for you already... https://c9.io/ It's great. And on Google's App Engine servers. | |
Re: Not sure if you prefer this, but here's the way I would've done it... $STM = $dbh->prepare('SELECT * FROM `tbl` WHERE `var`=:lsecure'); $STM->execute([ # new syntax for arrays, alternatively, use array() ":lsecure" => $var ]); $count = $STM->rowCount(); $results = $STM->fetchAll(PDO::FETCH_ASSOC); if($count > 0) { foreach($results as $row); $varname = … | |
Re: That means that they found the error and fixed it. | |
Re: @broj1 really hit this one on the head. Good job. :) | |
Re: If you make it in Java, I love you... because you've instantly supported Win/Mac/Linux. ![]() | |
Re: This code is extremely difficult to read, the indentation is horrid, the question isn't quite clear to me (maybe I need sleep?)... what I can say is that you should sanitise your $_GET stuff. You seem to be putting it straight into the query which would allow me to do … ![]() | |
Re: If you want us to write it all, I'm hirable. If not, show us your progress. | |
Re: Dani — might be a good idea to have `display_errors` on before `error_reporting`. Also, you'd do `ini_set('display_errors', 'On')` afaik. | |
Re: This won't really help, but you should give Laravel a shot... it's much nicer and a lot more advance. | |
| |
Hello, back again with some ideas. Is it possible that we could have the ability to center our signatures? I'd also like to see something like, image signatures... maybe just for people who have submitted a good amount of helpful answers. Put a limit, and don't allow text if they … ![]() | |
Re: This code is painful to look at. I'll give it a shot at helping. | |
Re: There are many tutorials that you can find within Google's web index (search engine, with a little more fancy terminology added). Here's an example: [zenverse.net tutorial](http://zenverse.net/seo-friendly-urls-with-htaccess/) Example of `.htaccess` code: Options +FollowSymLinks RewriteEngine On RewriteRule ^topic/([a-zA-Z0-9]+)/$ index.php?topic=$1 This would route yourdomain.com/`topic/{id}` to yourdomain.com/`index.php?topic={id}`. If you wanted lets say, profiles... you … | |
Re: You probably set the data type within the MySQL database to DATETIME or DATE, thus making MySQL accept `Y:m:d H:i:s` or default to its own method. If you were to change the *date* data type to VARCHAR(255) — it would work again as MySQL would have no default. Hope this … ![]() | |
Re: You might also try this: function db_query($sql, $params=array()) use ($pdo) { ![]() | |
Re: I'm going to be critical with @gabrielcastillo's example. Since the request will be from the client, you don't need to send the `user_id` parameter within the POST request. You can do this: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"> <script type="text/javascript"> jQuery(document).ready(function($){ $('#button').on('click', function(e){ e.preventDefault(); $.ajax({ url: 'path/to/script.php', type: 'POST', data: {liked: true, url_slug: $(location).attr('href')}, … | |
Re: Yeah, the problem has been outlined already... I think you forgot to write the query on lines 165-166. You then need to supply the query as a parameter within `mysql_num_rows()` on line 166 like this: `mysql_num_rows($query)`. | |
Re: Do this: `$productID = (empty($_GET['id']) ? 0 : $_GET['id']);` | |
Re: This probably isn't your issue, but I recommend reading up on *prepared statements*. | |
Re: In *HTML5*, you don't need `type=""`. Also, it's recommended to put your favicon in your base directory (`/`) as browsers automatically call at `/favicon.ico` — so that might save some headaches. Best of luck. | |
| |
Can you make it so that I have an option to not get bugged when a donor posts a topic? I don't want emails saying "Oh, I'm a donor, reply to my thread." — it's spam in my eyes (basically advertising). Not cool. | |
Re: Or echo '"{$email}"'; Or echo '"' . $email . "'; Or echo '"$email"'; Or even... echo '"' . htmlspecialchars($email) . '"'; Just sayin' | |
Hello! So, I see you need help... or maybe you just fancy a nice little read. Either way, this is here for a reason. When you post code on DaniWeb, it can be frustrating waiting for a reply (trust me, I've been there!) — so... here are some tips that … | |
Re: This battle is going to be very opinionated, PHP in my opinion is the easier option (and somewhat quicker with configuration). Also, PHP is easier to install (if I am correct) — but, ASP has it's good points, I am sure. I recommend you google your question and see the … ![]() | |
Re: It seems people forgot to mention that you need to make it *secure* — this is my #1 point for everything! | |
Could we use CMD+Return and CTRL+Return for submitting posts etc? ALT+S doesn't work (at least, on my Mac it doesn't). | |
Re: What @pritaeas said. Although, I will give you a tip though: don't **include** a file that your app depends on, **require** it. `require("connection.php");` Also, you need to *seriously* clean up your code. It's VERY hard to read. ![]() | |
![]() | |
Re: Although you may not be with this host, the instructions are the same: https://knowledgebase.servint.net/questions/692/How+do+I+log+into+my+VPS+as+root+via+SSH%3F | |
Re: $int = 1; foreach($json_info as $key => $value) { echo "ARRAY " . $int; foreach ($value as $k => $v) { print_r($k . ": " . $v); } $int = $int + 1; // I couldn't be bothered making it simpler for me. } That should do it. | |
Re: You could start by using Google to search. I was able to find a few examples. Go look there. :)ß | |
Re: Problem with line 39: You have this: `$tbl.='\n <td> $row[$col] </td>';` It should be this: `$tbl.='\n <td> " . $row[$col] . " </td>';` ![]() | |
Re: It is painful to see that you're putting quotations around plain variables... | |
Re: Why not just use an Auto Increment value?! > Feature is there > Doesn't take it | |
Re: ...it might also be: chown apache:apache -R /usr/share/phpMyAdmin If you want, add me on skype: samlew4, and I will help you out with your issues. |
The End.