2,113 Posted Topics
Re: > Is there anyway to replace the order by information with prepared statement attributes? Unfortunately this cannot be done with current drivers. You can use a whitelist approach, instead of rewriting the query you do: if(in_array($value, array('asc', 'desc')) $query = "SELECT * FROM `items` ORDER BY `date` $value"; Besides: `date` … | |
Re: Hi, you can check the **D3.js** project: * http://d3js.org/ * https://github.com/mbostock/d3/wiki/Tutorials And the **Charts.js** project: * http://www.chartjs.org/ ![]() | |
Re: Try `sudo su` then enter your password, as requested, it should log you as root. Also read this: https://help.ubuntu.com/community/RootSudo | |
Re: Hi, you can do this in the select query, something like: SELECT * FROM `user` WHERE `username` = ? AND `expires_at` < NOW() The expression `expires_at < NOW()` will verify the date stamp with the current date. This requires that the column is datetime type, otherwise you have to cast. … | |
Re: By changing line 50 with: return array_map('trim', $z); you avoid new lines in the **ParseVariables()** generated array and let the regular expression match the pattern. A problem I see is an undefined index at line 60, which is: $toReplaceTemplate[$index] = str_replace($contentFrom, $replaceDict[$indexToGo], $toReplaceTemplate[$index]); And in particular is caused by `$replaceDict[$indexToGo]`. … | |
Re: Hi, what is the error message? Have you tried by contacting their support service? From what I've seen you have to perform a curl request and get a response in JSON format: * https://www.swipehq.com/support/support_detail.php?cat=Developers&title=Example+Code But from the documentation I cannot see what would happen in case of error and what … | |
Re: Check also: http://regexr.com/ | |
Re: Hi, the insert query is missing the `VALUES` closing parenthesis: ... ADDDATE(NOW(), INTERVAL 1 MONTH)) When in doubt add `mysqli_error()`: * http://php.net/manual/en/mysqli.error.php Bye! | |
Re: Hi Ed, so in local it logs out successfully and, instead, it does not work in production? No error codes? Have you changed the information to reflect the production URL in your application? In practice you have to change the URL in *My Apps > APP Name > Settings > … | |
Re: --- EDIT --- never mind, jkon's questions are more pertinent to solve this. | |
Re: Hi, what you got from: > See systemctl status nginx.service and journalctl -xe for details | |
Re: No, not through `copy()`, that will change only the extension. You can try PHPOffice/PHPPresentation: * https://github.com/PHPOffice/PHPPresentation For example: $filename = '/path/to/file.pptx'; $new_name = '/destination/path/file.odp'; $phpPPTX = \PhpOffice\PhpPresentation\IOFactory::load($filename); $odpWriter = \PhpOffice\PhpPresentation\IOFactory::createWriter($phpPPTX, 'ODPresentation'); $odpWriter->save($new_name); | |
Re: I think skilled programmers usually don't have problems with basic / general language issues and, when having some difficulties, they would search for help in appropriate places, like: bug lists, mailing lists, specific niche forums & blogs or support teams. In my activity I hardly ask for help, as I'm … | |
Re: Use `var_dump($val);` instead of `echo $val;` to see what is returned. If the form ends like this (with a `</form>`) and there aren't other input fields, then it should work fine. Also you could do `echo "<pre>". print_r($_POST, true) . "</pre>";` to see what is sent to the $_POST array. | |
Re: Do you need that row in the following loop? If not then do: $uid = mysqli_fetch_row($query, MYSQLI_ASSOC); echo $uid[0]['a_uid']; while($row = mysqli_fetch_assoc($query)) # and so on The loop will start from the second row in the result set. If you need that row in the loop then do: $results = … | |
| |
Re: Sure is not `$connection->query($sql)` with `->` instead of `-`? It seems you're calling a method, or an anonymous function, I think the former. In the latter case, then in PHP you cannot use the dash in the variable name, unless you use brakets, for example: ${'connection-query'} = function() { return … | |
Re: Look at the array through `var_dump()`, it may add some information about that index. | |
Re: Hi, the undefined offset is probably given by: $rawData[$i + $backdate] Check if the index key exists: $key = $i + $backdate; if(array_key_exists($key, $rawData)) $pTimeseries[$i][1] = $rawData[$key][0]; | |
![]() | Re: > I'm going for NZ. > France Argentina or Ireland in final Almost my same choices but, as said by HG, South Africa has good choices too, I would add it in replace of Argentina. Here support is splitted between Ireland and France, but I'm not sure about France preparation, … ![]() |
Re: Hi, the `set_rules()` method requires three arguments: * field name * label * rules See documentation at: * https://codeigniter.com/user_guide/libraries/form_validation.html#CI_Form_validation::set_rules So your rules would look like: $this->form_validation->set_rules('email', 'email', 'required|valid_email'); $this->form_validation->set_rules('password', 'password','required'); | |
Re: Hi, from what I've understood you have only to set the path of the libraries, follow the instructions in this tutorial and it should work fine: * http://www.sfml-dev.org/tutorials/2.3/start-linux.php | |
Re: About the function issue: the form will send strings, so `filter_input()` will return strings or: * **FALSE** when condition fails * **NULL** when variable name is not set, i.e. when submitting a form with wrong/missing field name so the `is_int()` check will always return boolean **FALSE**. You can convert the … | |
Re: If linking a stylesheet then you have to define the correct path, not just the file name, unless this is in the same path of the requesting page. In practice change: $("link").attr("href", "blue.css"); To something like: $("link").attr("href", "/css/blue.css"); **But** it's worth to follow previous suggestions and apply a class or … | |
Re: Hi, use **prepared statements**, start from here: * http://php.net/manual/en/mysqli.prepare.php * http://php.net/manual/en/mysqli.quickstart.prepared-statements.php Look at the first example in the first link, I'm not converting the code directly for you, because it's more important that you understand how it works and how the methods/functions are used. | |
Re: Hi, sure there is no `%` in front of `20`? Can you show us more details of the script in which you create the date? Have you tried the above in a separated script: a simple `<?php echo date('d-m-Y'); ?>` file, in this case do you get the same results? ![]() | |
Re: And how would you know which result sets belongs to what? If you're expecting a row for each table, then you could add empty columns: select id, name, lastname from users where id = 1 union all select user_id, email, '' as dummy_3 from addresses where user_id = 1; But … | |
Re: Hi! Bit border line, but I suggest you to learn also how to build raw HTTP requests and parse responses to understand: how to deal with RESTful APIs, how to build them, how mails are sent, how (chunked) uploads are performed and in general how [socket programming](http://php.net/manual/en/intro.sockets.php) and web servers … | |
Re: Hi! Check the documentation: * http://ellislab.com/codeigniter/user-guide/general/managing_apps.html In particular: >**Note:** Each of your applications will need its own index.php file which calls the desired application. The index.php file can be named anything you want. So, in the main **index.php** file change the application path, i.e. change this: $application_folder = 'application'; To: … ![]() | |
Re: Hi, by using four spaces or one tab, the system will set the paragraph into a block code. For more information check the syntax helper: * https://www.daniweb.com/community/syntax#code | |
Re: Something like this will fit? <?php $tests = file("php://stdin", FILE_IGNORE_NEW_LINES); foreach($tests as $test) { for($i = 0; $i <= $test; $i++) { $size = 9283412; $isEven = (($test % 2) != 0 ? true : false); if($test == 0) { $size = 1; break; } elseif($isEven) $size *= 2; else … | |
Re: In addition: so what you're searching for is a client to query remote services? Have you considered Guzzle? * https://github.com/guzzle/guzzle * http://docs.guzzlephp.org/en/latest/index.html You can integrate it into CI3 by using composer: composer require guzzlehttp/guzzle:~6.0 And modifying the `composer_autoload` variable in `application/config/config.php` into: $config['composer_autoload'] = FCPATH . 'vendor/autoload.php'; Then in your … | |
![]() | Re: I would choose **Laravel**, I actually switched my new projects to that in April. I was going to start a new one and I was thinking to go back to Ruby on Rails, but then I decided to try Laravel and I like it, very much. I've been using CodeIgniter … ![]() |
Re: Hi, I'm not sure I've understood what are you trying to do. The `http-equiv` meta: > it is a pragma directive, i.e. information normally given by the web server about how the web page should be served. *Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta* So, it defines the rendering of the page, not the header … | |
Re: Hi, have you tried this? > The SDK is contained in the lib/ folder in the zip file so copy lib/ into your project and name it dropbox-sdk/ and include it in your app: require_once "dropbox-sdk/Dropbox/autoload.php"; Source: https://www.dropbox.com/developers-v1/core/sdks/php | |
Re: So, all you want is to prevent hotlinks? Why don't you use **.htaccess**? It works without involving Javascript: if the request referer is your domain, then the server will give access to the protected files, otherwise it will deny. You can try this: RewriteEngine on RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC] RewriteRule … | |
Re: Hi, it happens because of the [variable scope](http://php.net/manual/en/language.variables.scope.php), `$conn` is defined outside the function, so or you pass it as parameter, or you set it as global, or you use an anonymous function. Example: $getUsers = function() use($conn) { $getAllUsers = mysqli_query($conn,"SELECT * FROM login"); if($getAllUsers === FALSE) return FALSE; … | |
Re: Model name is `BooksModel` (plural), in that method controller you're calling `BookModel`, (singular). Bye ;) | |
Re: Hi, it happens because `fwrite()` is outside the loop and will write the last vallue assigned at `$line`. Use `fputcsv()`: * http://php.net/manual/en/function.fputcsv.php Look at the first example, it does what you need. | |
Re: Hi, it happens because both tables will return the same column name `tableA_id`, since you're fetching as assoc, it will create an array in which the first index will be rewritten by the second column value. You see how it works by playing this: <?php $stmt = $conn->prepare("select * from … | |
Re: Hi, can you format code properly? At the moment it's very hard to read. Regarding the user picture, have you tried the `/{user-id}/picture` endpoint? * https://developers.facebook.com/docs/graph-api/reference/user/picture/ * https://developers.facebook.com/docs/graph-api/reference/profile-picture-source/ | |
Re: Hi, I don't understand what it should do your script, tested with a ciphered string and prints only `====`. If you are searching for character frequency, then look at `count_chars()`: * http://php.net/manual/en/function.count-chars.php For example: <?php $message = 'pda sknhz eo behhaz sepd oaynapo wjz iuopaneao fqop swepejc pk xa zeoykranaz'; … | |
Re: Cache: probably the new thread was appended to the index cache and was not updated after user's edit. | |
Re: Hi, you are enclosing the query into single quotes: $a = 'apples'; $b = 'oranges'; So in order to append another variable you have to use the dot operator: $c = 'list '. $b . ' and ' .$a; Basically is this. You have done that when defining the table … | |
Re: Sometimes it happens that the corrupted file will return the server side error instead of the contents, so you end to download a text file with the wrong extension: jpg, pdf, doc... Try to open the corrupted file with your editor, if it gives problems then change the extension to … | |
Re: > What's the difference between other website and my website? That's all what I need to know. That's the knowledge they are suggesting you to learn. It's not just keywords. You can start from Google suggestions: * https://support.google.com/webmasters/answer/35291?hl=en ![]() | |
Re: Can you show users table? I don't understand which values will assume `uid`, to me it should be an integer, but looking at your code it seems it would be a string, like `user 1`, otherwise those conditional statements are wrong: if($user["user_1"] == $_SESSION["uid"]) | |
Re: Or **fileinfo**: $mime = (new finfo(FILEINFO_MIME_TYPE))->file('/path/to/file.ext'); Docs: http://php.net/manual/en/function.finfo-open.php | |
Re: Hi, few questions: * the data is correctly inserted in the database? * if, in view, you do `var_dump($datame);` what you get? * have you tried to remove the error control operators `@` in your `getdata()` method? In this stage it's more important to get debug information rather than hiding. |
The End.