2,113 Posted Topics
Re: Hello, have you tried with a left join? If *table 1* is `reference` then try this example for MySQL: SELECT `r`.`no`, `r`.`referenceno`, `r`.`date`, `m`.`controlno` FROM `reference` AS `r` LEFT JOIN `marine` AS `m` ON `m`.`referenceno` = `r`.`referenceno` AND `r`.`marine` = 'y' ORDER BY `r`.`no`; Live example here: http://sqlfiddle.com/#!9/b2fca/1 Knowing the … | |
Re: Hi, have you tried `http_build_query()`? * http://php.net/manual/en/function.http-build-query.php | |
Re: Change this: `implode(", ", $new)` to single quotes: `implode(', ', $new)` bye! | |
Re: Hi, you can try with the `BETWEEN ... AND` construct in the `WHERE` clause: * http://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html#operator_between Example with `date_column`: "SELECT `MatchTitle`, COUNT(`MatchTitle`) AS `mostPlayed` FROM `matches` WHERE `date_column` BETWEEN "2016-05-24 23:59:00" AND "2016-05-25 00:00:00" GROUP BY `MatchTitle` ORDER BY `mostPlayed` DESC LIMIT 1" This will give **1 minute** range. Just … | |
Re: Use `intval()` as suggested or `$id = (int) $_GET['id'];`, see: * http://php.net/manual/en/language.types.type-juggling.php Or in case of validation use `filter_input()`: $id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT); Bye! | |
Re: **Little note:** consider that the `query()` method will return an iterable object from the **Result class**: * http://php.net/manual/en/class.mysqli-result.php So, if you want to get the next row you have to move the internal pointer, through a loop or through `data_seek()`, which should be used if, for example, you want to … | |
Re: Have you tried PHPWhois? [url]http://sourceforge.net/projects/phpwhois/[/url] | |
Re: **@Elva_1** hi, please open you own thread. ![]() | |
Re: Hi, how you are trying to add the feature: by adding code to the component source? When you say: > I cant access the component in the admin you mean that the changes to the component code don't apply? Or that you cannot upload & install the component through the[ … | |
Re: Hi, you could list the items in the head and body elements and then, if you catch the `style` child, you remove it. This seems to works fine for me: <?php /** * Remove tag from DOM. * * @see http://php.net/manual/en/domnode.removechild.php * Read the comments about the loops * @param … | |
Re: > I am unable to send a mail. Please help me to fix the issue. Hi, unable in which sense? The script fails the connection with the SMTP or something else? Do you have PHP error logs or SMTP error logs? Replace lines below and including `47` with: if(!$mail->Send()) { … | |
Re: **@Vinod** you can do: SELECT * FROM `table_name` WHERE `column_name` = ''; This will return only the empty strings, NULL values will be ignored by the statement. An example: http://sqlfiddle.com/#!9/0aa0bb/1 | |
Re: Hi, can you paste just the relevant code? People here can answer also from mobile and cannot setup a database and run your scripts. Also, if the download link becomes unavailable, the thread becomes useless for the readers. | |
Re: Have you tried with DateTime? <?php $one = '09:30 am'; $two = '11:00 AM'; $time1 = new Datetime($one); $time2 = new Datetime($two); $diff = $time1->diff($time2); print_r($diff); Which outputs a DateInterval object like this: DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 1 [i] => … | |
Re: Independently for each user? | |
Re: Hi, you're missing the closing parenthesis in the `VALUES()` statement and the commas to separate the data: $count = $dbh->exec("INSERT INTO animals(animal_type, animal_name) VALUES ('kiwi' 'roy'"); Should be: $count = $dbh->exec("INSERT INTO animals(animal_type, animal_name) VALUES ('kiwi', 'roy')"); | |
Re: Hi, I'm not sure I've understood: line 26 of check.php is line 1 of the other code block? | |
Re: Are you using `event.preventDefault()`? Docs: https://api.jquery.com/event.preventdefault/ | |
Re: Yes, it can be done by getting the `head` element, then by creating an element `link`, appending the attributes to the created element, and finally appending the new element to the head section. An example: <?php $file = './index.html'; $doc = new DomDocument(); $doc->loadHTMLFile($file); $head = $doc->getElementsByTagName('head')->item(0); $link = $doc->createElement('link'); … | |
Re: Hi, you can `explode()` by comma and `trim()`, try: $tags = 'cats, funny, hair cut, funny hair cut'; $result = array_map('trim', explode(',', $tags)); | |
Re: If the update is limited to a single row, as in your example query, you could add `rec_id = LAST_INSERT_ID(rec_id)` to register the value to the function and then select it, for example: UPDATE tier_".$tier_num." SET payer_ID = '".$payer."', sub_ID = '".$payer_sub."', create_date = '".$created."', status = 'I', rec_id = … | |
Re: Hi, you can use the Form helper, like in the documentation example: * https://codeigniter.com/user_guide/helpers/form_helper.html?highlight=form#form_dropdown Otherwise you can use custom code. Have you tried to write some code? Show it to us, so we can suggest you how to fix it, bye. | |
Re: Yes, you can, just select and use the `+` operator: select `column_a`, `column_b`, `column_a` + `column_b` as `column_c` from `table_name`; Live example: http://sqlfiddle.com/#!9/935da4/1 | |
Re: Sure is `$key` and not `$primaryKey`? protected $primaryKey = 'user_id'; Model source: * https://github.com/laravel/framework/blob/06182c2b498cfc1bbb82e5d49bad0c92d256a337/src/Illuminate/Database/Eloquent/Model.php#L56 | |
Re: Hi, after `if($rows==1){` fetch the row and check the column value that defines the role, use an IF statement to define the session and redirect, something like: if($rows==1) { mysql_data_seek($result, 0); $row = mysql_fetch_assoc($result); # admin if($row['role'] == 1) { $_SESSION['role'] = 1; header("Location: /admin/"); exit; } # user $_SESSION['role'] … | |
Re: Hi, you can use the `addCustomHeader()` method, for example: <form method="POST"> <input type="text" name="companyName"> </form> on PHP side you do: $companyName = sprintf("CompanyName: %s", $_POST['companyName']); $mail->addCustomHeader($companyName); Check the syntax at: * http://phpmailer.worxware.com/?pg=methods And remember always to sanitize the input. | |
Re: Hi, it seems related to the permissions of OS user that is running the MySQL server, it seems this user cannot delete the directory that stores the database. Try to restore the permissions and, to remove the database, check the PHPMyAdmin data directory to manually remove this specific directory. | |
![]() | Re: Hi, do you know about [cascading](https://www.w3.org/Style/CSS/learning.en.html) [style](http://www.westciv.com/style_master/academy/css_tutorial/) [sheets?](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started) |
Re: Hola Luis, gracias pero la próxima vez, por favor, en Inglés. | |
Re: Hi, I think you're confused by [my previous post](https://www.daniweb.com/programming/web-development/threads/504130/attendance-form-help-2#post2202708). The input type `time` is not boolean, so to see the value you must set it in the `value` attribute, so instead of: <td><input type="time" name="timeIn" id="timeIn" <?php echo $row['timeIn'] > 0 ? ' time':''; ?>></td> Do: <input type="time" name="timeIn" id="timeIn" … | |
Re: Hi > And also, the checkbox says it's all ticked even the values are different (lines 61 - 63 of index.php) what do you mean?`checked` is a boolean attribute, which means: > A number of attributes are boolean attributes. The presence of a boolean attribute on an element represents the … | |
![]() | Re: Hi, try to submit the `WHERE` condition as a string: $where = "new_col = 0xD9E6762DD1C8EAF6D61B3C6192FC408D4D6D5F1176D0C29169BC24E71C3F274AD27FCD5811B313D681F7E55EC02D73D499C95455B6B5BB503ACF574FBA8FFE85"; $this->db->get_where("user_stats_backup", $where); ![]() |
Re: It would be a lot easier by using an autoload script, namespaces and some classes or some helper files. For some ideas, read: http://stackoverflow.com/questions/4737199/autoloader-for-functions | |
Re: Hi, which library are you using? In the UI I only see `dialog()` not `modal()`. Build an example page with full requirements, so that we can test, or share the libraries you're using. A part that you could check the values sent to the form through `console.log(jQuery('#sizes').val());` in browser side … | |
Re: You question is not clear, files are copied in the usb? How big are these 10 files? | |
Re: Hi, the `foreach` construct only accept these syntaxes: foreach (array_expression as $value) And: foreach (array_expression as $key => $value) it seems you're trying to extract two keys, it won't work. The `array_combine()` function does accepts only two arguments, you're submitting three arguments (arrays) so it will fail. If these are … | |
Re: Hi, have you tried to set the headers like in command line? | |
Re: It's up to you. I use arrays, like: <?php return [ 'paths' => [ 'images' => '/path/to/images/directory/', 'styles' => '/path/to/styles/directory/', # ... ], # ... ]; And/or dotenv: https://github.com/vlucas/phpdotenv | |
Re: **@DuuBinJaX** hi, please open your own thread, share your code and explain your issue. | |
Re: With **MySQL** you can use `FIND_IN_SET()`: SELECT * FROM `example` WHERE FIND_IN_SET(192, `paricipantsId`); **Docs:** http://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_find-in-set Or, if you need something more complex and you switch to **MariaDB**, then you can use some new features for **dynamic columns**: * https://mariadb.com/kb/en/mariadb/dynamic-columns/ However, instead of storing this information in CSV style, consider to … | |
Re: Concerning the color: it can be different due to the monitor calibration, you should calibrate in both systems to get the same results. | |
Re: Hi Davy, could you please use the code tag when you share code on this forum? | |
Re: Hi, you mean you want to send an email in HTML format rather than plain-text? Check **example 4** in the documentation of the `mail()` function: * http://php.net/manual/en/function.mail.php However, I suggest you to look into libraries like PHPMailer or SwiftMailer. | |
Re: Hi, I don't think PHP 8 exists at all at this point. Where did you read about it? | |
Re: What's the error number? Do: `echo $conn->errno;` | |
Re: Hi, the *above* code will download the file to the web server executing the script, not to the home directory of the client browser. In practice: if the path `/home/jiby/Downloads/image.jpg` does not exists in the web server root, then the script will fail. | |
Re: Hi, follow the documentation and read also the comments on the same page: * http://php.net/manual/en/features.file-upload.multiple.php | |
Re: In addition: check also about **composer**, it's a dependency manager for PHP, most frameworks support it and it allows to easily share and include libraries into a project: * https://getcomposer.org/ However you don't really need to use a framework to take advantage of composer, you can use flat PHP. A … | |
Re: Hi, can you show what generates the error and the error code and message? | |
Re: Hi, it happens because the `header('Location: url');` will be overwritten by the last loop value, which is what will be executed. You cannot start multiple redirections. Also, what is this line supposed to do? $key . " : " . $value . ""; Print? |
The End.