2,113 Posted Topics
Re: Hi! In addition to Dave's suggestion, having a div between rows is not really correct: <table> <tr> <td> <div class="img"> <tr> <td><img src="..." /> </div> <tr> <td> </table> Do: <table> <tr> <td> <tr> <td><div class="img"><img src="..." /></div> <tr> <td> </table> Or simply: <table> <tr> <td> <tr> <td><img class="img" src="..." /> … | |
Re: It happens because you're missing the quote for the previous values, this: ('60', 'Ng'wagindu), should be: ('60', 'Ng'wagindu'), | |
Re: **@phoenix** There are some errors here: echo work $sql ="UPDATE tea SET name = ' 8req' WHERE id = '3 ' "or die ("cant update" . mysql_error()); The echo statement needs quotes if you're trying to return a string, if that is a constant it's ok, but you have to … | |
Re: Hi, the function `array_diff()` will return empty: 1. if the first array is smaller then the second; 2. and if the elements in the first array range are the same of the second. For example: $a = [1,2]; $b = [1,2,3]; print_r(array_diff($a, $b); Will return empty, instead: $a = [1,2]; … | |
Re: Hi, the function `null2unknown()` is not a PHP function, it's a **user defined function** so there must be a file, included by payment_gateway.php or by a main file, which defines the above function. The GET variables, instead are usually set by form fields: <form method="get"> <input type="text" name="vpc_Amount"> ... </form> … | |
Re: Hi! The problem is caused by the quotes, you need to escape them correctly, try: $pm_ui = '<button id="pmBtn" onclick="postPm(''.$u.'',''.$log_username.'','pmsubject','pmtext')">Send</button>'; In your case you're including PHP variables and your using single quotes, so you have to escape those to create the javascript arguments, and make the variables print their values. … | |
Re: Hi there, @Dave consider that points generated in March and April 2015 (in the range of 45 days if I'm not mistaken) are only estimated points and need to be reviewed by the team, those months are marked by an asterisk. I think there is a thread in which Dani … | |
Re: Don't rely on the value returned by the $_FILES array because is set by the client, which can be altered or simply different from what expected. For example some executives will return `application/x-dosexec`. Use the **finfo** library: $finfo = new finfo(FILEINFO_MIME_TYPE); $type = $finfo->file($file); if(in_array($type, array('mime', 'blacklist'))) { # ... … | |
Re: Hi! Change also the value of `post_max_size`, this should be equal or larger than `upload_max_filesize`. Docs: http://php.net/manual/en/ini.core.php#ini.post-max-size | |
Re: Hi, the code seems fine to me. But you can try this function which extends a bit the check: function get_ip_address() { $array = array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ); foreach($array as $key) if(array_key_exists($key, $_SERVER) === true) foreach(explode(',', $_SERVER[$key]) as $ip) if(filter_var($ip, FILTER_VALIDATE_IP) !== false) return $ip; … | |
Re: Hi, `getimagesize()` is a function to evaluate the pixels of an image, the type and the attibutes (a stringed version of height and width), it returns an array. For example: Array ( [0] => 20 [1] => 10 [2] => 2 [3] => width="20" height="10" [bits] => 8 [channels] => … | |
Re: Hi, it seems fine to me, but you can use directly the object created by the `diff()` method, without formatting the output, as [in my previous example](https://www.daniweb.com/web-development/php/threads/493999/how-to-get-differenc-in-hours-and-minutes-#post2160993): $minutes = 0; $minutes += $diff->h * 60; $minutes += $diff->i; echo round($minutes / 4); Which outputs `23`, with floor `22`. If you … | |
Re: Hi, if you're using a prepared statement to insert the data, then submit the zipcode as a string, not as integer, this should solve the issue for you. The table column must be char or varchar, as you're already doing. | |
Re: Hi, use the DateTime library, in particular look at the `diff()` method. For example: <?php $one = '09:30AM'; $two = '06:30PM'; $dtime_1 = new Datetime($one); $dtime_2 = new Datetime($two); $diff = $dtime_1->diff($dtime_2); echo $diff->format('%H:%I'); Will print `09:00`. More info here: * http://php.net/manual/en/datetime.diff.php * http://php.net/manual/en/dateinterval.format.php | |
Re: To paste code I usually place the cursor in a new line and then I press TAB once, for example: /** * Sign Out * @return void */ public function getOut() { Auth::logout(); return Redirect::route('sign_in'); } Usually, it does not require any other adjustment because, in my editor, I always … | |
Re: > I just tried Ctrl+tab and it jumped to the next browser tab. Same here on Chrome. In Ubuntu `Alt Tab` is used to switch the windows in the same workspace. Maybe `Shift Tab`? It seems free, at least in Ubuntu. | |
Re: Hi all, James you can send an email to Gmail SMTP, you don't need sendmail to do this because you're going to connect directly to the SMTP server. Check this example: * https://www.daniweb.com/web-development/php/threads/483301/cannot-send-email-from-server/2#post2117095 Which makes uses of **PHPMailer** library: * https://github.com/Synchro/PHPMailer * http://phpmailer.worxware.com/ You can do it without: you need … | |
Re: Hi, create a container for #box5, then you can use two methods. #Method 1# Move the text outside the opaque element and move it over, something like this: <div id="box"> <div id="box5"></div> <div id="box5-p"> This text is normat text over opacity background </div> </div> Styles: #box { position: relative; width:250px; … | |
Re: Hi, from the error message it seems the page includes PHP, if affirmative then check that the variables are correctly closed, for example here is missing the semicolon: <?php $a = 'hello' ?> <!DOCTYPE html> ... And will generate the same parse error, pointing the end of the file even … | |
Re: In addition, there is a small typo with quotes: $_POST['accommodation"] Use single quotes or double quotes, not both together: $_POST['accommodation'] # or $_POST["accommodation"] Bye! | |
Re: In addition: `$values['books']` is an array where the index key is the `book_id`, for example: [books] => Array ( [38] => Array ( [book_id] => 38 [title] => Alexander of Macedon, 356-323 B.C. : a historical biography. [author_lf] => Green, Peter [author_fl] => Peter Green [author_code] => greenpeter [ISBN] => … | |
Re: Thanks for sharing! I tested your class and I like it, consider to add a passphrase to allow different results, it could be helpful. You may want to check Hashids, it's very similar to your concept: http://hashids.org/ ![]() | |
Re: Hi, are you accessing the website through the IP? I ask this because the function that checks the path is this: // Since 2.0: security reason function check_direct_including($incln) { global $PHP_SELF; $Uri = '//'.dirname( $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); if (strpos(getoption('http_script_dir'), $Uri) !== false && strpos($PHP_SELF, $incln) !== false) die(proc_tpl('help/manual/wrong_include', array('category' … | |
Re: Hi, you need at least MySQL 5.1.5 to import XML, otherwise you have to check if a UDF (user defined function) was developed to support old versions. In the documentation you can find a comment (bottom of the page) that suggests a workaround, sincerly I wouldn't use it. If possible … | |
![]() | |
Re: Hi, it could be the mime-type or the column table size, be sure to not truncate the input. If using a `blob` column type then this can support up to 65536 bytes. To save more data use `mediumblob` which supports up to 16MB or `longblob` which supports up to 4GB. … | |
Re: If you write: onClick="parent.location='cadd_latihan/'" your link is relative to the page in which this is clicked, so if you open it in `/home/` the client asks for `/home/cadd_latihan/`, if you click it in `/contact/` the client asks for `/contact/cadd_latihan/`. To fix it, add a leading slash to the url and … | |
Re: Hi, you actually get the result, just loop it: $result = $pdo->query("SELECT * FROM posts"); foreach ($result as $key => $value) echo $value['title']; echo 'Total: '. $result->rowCount(); It's not visible through `print_r()` because the statement is an iterable object, if you want the full array use `fetchAll()`: print_r($result->fetchAll()); As second … | |
Re: Hi, use `trim()` to remove the pending comma: echo trim('a,b,c,', ','); The same can be done at query level: select trim(TRAILING ',' FROM 'a,b,c,'); Docs: * http://php.net/trim * http://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_trim | |
Re: > the form gets posted it will only return the first variable that i place in the paranthesis like It happens because the `message()` method takes only one argument. In order to work correctly you should write something like this: $this->email->from('contact@domain.tld', 'From WebSite'); $this->email->reply_to($email, $name); $this->email->to('me@domain.tld'); $this->email->subject('Message from contact form'); … | |
Re: Hi, few questions: 1. which operative system? 2. can you use PHP or another scripting language? 3. you have the IP list, nameOFfile.txt is an arbitrary value or defined in the list? | |
Re: You can remove `/usr/bin`. When not sure about the path of a command you can use `env`, e.g.: /usr/bin/env php script.php --attribute hello --import ../world.txt but not in case of `cd`, you don't need it. In any case I'm not sure the above script will work, because the `--file` attribute … | |
Re: **@k_manimuthu** Hi, the `FROM` statement is not allowed in the update query, this is reason you get the error. This will work: UPDATE tb2,tb1 SET tb2.data = tb1.data WHERE tb1.id = tb2.id AND tb2.data IS NULL; Which is almost the same of your previous query with Reverend Jim fix to … | |
Re: It seems all these arrays will have the same size, so you can loop them together, for example: # read size of one of these arrays $count = count($_REQUEST['gender']); # loop for($i = 0, $e = 1; $i < $count; $i++, $e++) { echo "Student #{$e}: Gender: $gender[$i] / Shoe-Size: … | |
Re: Check also [unsplash.com](https://unsplash.com) ![]() | |
Re: Check also the Mozilla Developer Network: https://developer.mozilla.org/en-US/ In particular read their HTML[5], CSS and Javascript sections. | |
Re: Hi, set the default charset for the web server to UTF-8, you can do this by adding this directive into your .htaccess file: AddDefaultCharset utf-8 And be sure `default_charset`, in the php.ini file, is set correctly, otherwise set it dinamically: ini_set('default_charset', 'UTF-8'); | |
Re: I don't know if there is a ready PHP solution for this, but if you can install software in your hosting, then use LibreOffice in command line mode: <?php $file = 'something.doc'; $str = sprintf("libreoffice --headless --invisible --convert-to pdf %s", $file); $cmd = escapeshellcmd($str); exec($cmd); There are other solutions as … | |
Re: Hi, regarding the ffmpeg execution in `$RF->newname` are you returning only the filename or also the path in which this file is located? Is the destination path writable? Regarding the execution of the controller from CLI, it seems you are autoloading the session library, this will give the kind of … | |
Re: Also explain the reason, because you could simply use the [Alias directive](http://httpd.apache.org/docs/2.4/mod/mod_alias.html) to point the external directory to clients: Alias /uploads /etc/mnt/storage/uploads that way you don't have to alter your scripts, but if your boss decision was taken for security reasons, then Alias is the wrong solution. | |
Re: Hi, maybe you have multiple file type fields in your page? Try by identifying the field by the ID attribute, for example: // by default, submit is disabled $("#submit").attr("disabled", "true"); $("#upload").on('change', function(){ var val = $(this).val().toLowerCase(); if(!val) { alert('upload your photo'); $(this).focus(); $("#submit").attr("disabled", "true"); return false; } else { var … | |
Re: Hi, try: <?php class One{ public $a; } $b = 'Hello'; $test = new One; $test->a = $b; echo $test->a; For more information read about the **visibility** of class properties: * http://php.net/manual/en/language.oop5.visibility.php ![]() | |
Re: If you can use the command line then use ffmpeg with the `-vframes` option, example here: * https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video Through PHP you can use `exec()` or you can use this PHP-FFMpeg that supports `-vframes` * https://github.com/PHP-FFMpeg/PHP-FFMpeg * https://github.com/PHP-FFMpeg/PHP-FFMpeg/blob/6e3134e4ecc96852b1205e6c88ceffdb8cf17d34/src/FFMpeg/Media/Frame.php#L77 | |
Re: `SUM()` is a function of the `GROUP BY` clause, so, in order to get correct results you have to add a *group by* statement to your query, otherwise: > If you use a group function in a statement containing no GROUP BY clause, it is equivalent to grouping on all … | |
Re: Ok, there is an API key for **server applications** and another for **browser applications**, with the Javascript Google Maps API, you must use the browser applications API Key. Can you play the [example code](https://developers.google.com/maps/documentation/javascript/tutorial#HelloWorld) with your key? <!DOCTYPE html> <html> <head> <style type="text/css"> html, body, #map-canvas { height: 100%; margin: … | |
Re: The function `array_walk_recursive` will set the index key as second argument of the mapped function, the third argument will be the third of the function, since `ltrim` takes only two arguments it's better to define a custom function. Now, the main problem is that `array_walk_*` cannot modify the structure of … | |
Re: Hi, have you tried http://nodeschool.io/ ? | |
Re: Since there were suggested few solutions... here's mine :p Use CJS or GreaseMonkey (TamperMonkey in Firefox) extension to embed a tiny javascript: Target = document.getElementsByClassName("post-first")[0]; Target.className="margin-bottom clear"; It removes `.post-first` from the DOM and returns the standard styling for the first post. I find it really difficult to read all … ![]() | |
Re: Seems fine, go to C:\xampp\htdocs\Bonfire-master\bonfire\codeigniter\database\drivers\mysql\mysql_driver.php Line `73`, method `db_connect()`, you find: return @mysql_connect($this->hostname, $this->username, $this->password, TRUE); change it, temporarly for this issue, to: return mysql_connect($this->hostname, $this->username, $this->password, TRUE) or die(mysql_error()); And then reload the page, you should see the real error that makes the connection fail. ## //EDIT ## By … | |
Re: Have you set the `DocumentRoot` with the correct path? Consider this must be an absolute path. More information here: * http://httpd.apache.org/docs/current/mod/core.html#documentroot |
The End.