2,113 Posted Topics
Re: I see readDateJS not readDate on the PHP script. May be this? | |
Re: Together with pritaeas suggest, you can also append a random string to the end of the file: [code]<a href="/path/file.txt?random_string">file name</a>[/code] you won't need that value to open the file and the browser will read always a new link. | |
Re: I can't think any way to merge the first two arrays, there is no data that can tell where an instrument is. Also, more than a store can have an instrument, so I came up with an example. Array [icode]$a[/icode] is where you save instrument names as keys and store_id … | |
Re: [url]http://www.php.net/manual/en/refs.database.php[/url] Happy reading. | |
Re: You need to use a CSS rule to restrict the area: [icode]td { width: 200px; }[/icode] Add a class if you want to limit that rule only to some [icode]td[/icode]. Otherwise you can use the tag [icode]pre[/icode]. If this is not what you need, please give more information, post an … | |
Re: Can you post the form where there are the checkbox fields? In order to work the checkbox name as to be the same for each group, so you send an array to the script, when you receive that, you implode() the array or do a loop to use it in … | |
Re: Add [icode]or die(mysql_error());[/icode] to the query line so you can check what is happening, probably $myquery is returning [icode]bool(false)[/icode] and so you get an error on line 6. | |
Re: On line 24 you wrote [icode]$message =[/icode] instead of [icode]$message .=[/icode] This resets the variable and deletes what was previously stored. Bye. | |
![]() | Re: Try to compare the page source rendered by the browser before and after login. If something changes maybe is just missing a closing tag. |
Re: Remove select tags and change line 16 to this:[code]echo "<input type='checkbox' name='horse_id[]' value='$horse_id' /> $horse_name (#$horse_id), $breed\n";[/code] This will give you an array, if then you need to select from the database you can use implode() from PHP and in() from MySQL to do a single query: [code]$a = implode(',',$_POST['horse_id']); … | |
Re: You need to use pack() function: [code]<?php $e = "B0436CBFBC5CAAFB7339AF4A1DF845974D53B9D369146E2E4F1451929D9EBE254363E983F4F94517EB9585FDB112E7B1CCE11A33C5BBA23F8D5DE9D3415BA526489AC796A36FBA76D4293C8DFB673708CED10C9732EEC472D9E43D2626AA104121666E79DD8F2FF6BAC0143BD62E0EE826AF6459779C162613508D48BFE2FC8DD558A1834D7205F96EA8D446E9B371E78E990A3995B1052DCBA9CA0AF99CC77ED2A8B55B2B882BA29D4BB4B07FA91AB4D2F10FBB93732B077335A7E6D96FE813AEDC3711A85CD0C13AE22B28C14FCCE3AF4C1F5D2C0F7697DEC7487CCFC0ED4E77B1B65F39BAD5236E3D3C69D33FC484"; echo sha1(pack("H*",$e)); ?>[/code]bye :) | |
Re: Instead of [icode]$p == $predor[1][/icode] have you tried in_array()? Returns TRUE if the item is found: [url]http://php.net/manual/en/function.in-array.php[/url] | |
Re: You can use explode() function: [url]http://php.net/manual/en/function.explode.php[/url] bye :) ![]() | |
Re: [icode]<font color="white">[/icode], which color is the background? ![]() | |
Re: You can, also, query the remote server for an HEAD request and check if provides Content-Length, something like: [code]<?php $url = 'http://www.website.tld/image01.jpg'; $head = get_headers($url); $length = str_replace('Content-Length: ','',$head[6]); if($length < 50000) { echo 'too small: '; } else { echo 'ok: '; } echo $length; echo "\n"; ?>[/code] And … | |
Re: Try this:[code]<?php $datetime= "140811 060632"; $dt = str_replace(' ','',$datetime); $a = str_split($dt,2); $b = $a[2] .'-'. $a[1] .'-'. $a[0] .' '. $a[3] .':'. $a[4] .':'. $a[5]; echo date('Y-m-d H:i:s', strtotime($b)); # 2011-08-14 06:06:32 ?>[/code] bye! | |
Re: This should work: [code]"INSERT INTO classes_entered (class_id, object_id) VALUES ((SELECT class_id FROM shows WHERE show_id=$show_id limit 1),'$object_id')"[/code] bye :) | |
Re: Did you tried this? [code]mysql -uCHRIS -pCHRISSEC[/code] | |
Re: You can get something similar to your desired output with this script: [code]<?php $a = array(array(array('name' => 'praveen','id' => '20'),array('name' => 'kumar','id' => '25'))); $b = array(array(array('name' => 'pandu','id' => '21'),array('name' => 'praveen','id' => '30'))); $c = array_merge($a,$b); $arr = count($c); for($i = 0; $i < $arr; $i++) { foreach($a … | |
Re: Maybe there's something wrong, to me that JSON doesn't seems to have two blocks. You could do something like this: [code]{ "first block": { "name":"value 1", "location":"value 2" }, "second block": { "name":"value 1", "location":"value 2" } } [/code] And in the PHP part: [code]<?php $f = file_get_contents('j.json'); $j = … | |
Re: And also your table name, [b]return[/b], is a reserved word, check this: [url]http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html[/url] Use backticks if you want to use it: [code]"insert into `return` ..."[/code] bye :) | |
Re: Try to add: [code]$result = canUserSendSMS(); if($result == true) { # send SMS code } else { # exit }[/code] A suggestion: don't relate only on IP, most of the times users IP will change at next reconnect to internet, or it can be also changed by who wants to … | |
Re: You need a foreach loop, and the code can be more simple: [code]$RandomItems = array( "<li><a href=\"#northern-germany\" title=\"Northern Germany\">North</a></li>","<li><a href=\"#southern-germany\" title=\"Southern Germany\">South</a></li>","<li><a href=\"#western-germany\" title=\"Western Germany\">West</a></li>","<li><a href=\"#eastern-germany\" title=\"Eastern Germany\">East</a></li>"); shuffle($RandomItems); foreach($RandomItems as $r) { echo $r; }[/code] But you still need to save the new order for a week otherwise at … | |
Re: This is what you should read at least once [url]http://www.php.net/manual/[/url] bye :) | |
Re: I don't see the form tag but I assume you are using post method: [code] $loan = str_replace('PHP ','',$_POST['loan']); if($_POST['CO'] == 'Yes') { # 5% computation $interest = $loan * 0.05; } else { # 10% computation $interest = $loan * 0.1; } echo 'loan: '. $loan; echo 'interest: '. … | |
Re: While reading ardav solution I thought another solution. Maybe is not clean but it should work: [code]<?php function convert($number) { $reverse = strpos(strrev($number),'.'); $number = (strpos($number,'0') == '0') ? str_replace('0','',$number) : $number; $n1 = str_replace('.','',$number); $n2 = pow('10',$reverse); $a = gmp_gcd($n1,$n2); $b = gmp_strval($a); # display greatest common divisor return … ![]() | |
Re: This loop won't timeout: [code]<?php while(1) { # run ftp connection # check for file if(file_exists('file.ext')) { break; } pause(10); } ?>[/code] You can also control ftp timeout, check this: [url]http://www.php.net/manual/en/function.ftp-set-option.php[/url] | |
Re: Try to change [icode]i[/icode] to [icode]$i[/icode] And wrap $name value around quotes: [icode]$name = "James Cool Yang";[/icode] The easiest way to remove vowels is to use str_replace() check example #1 here: [url]http://php.net/manual/en/function.str-replace.php[/url] bye :) | |
Re: Use SimpleXML: [url]http://php.net/manual/en/book.simplexml.php[/url] From that extension you can use simplexml_load_file() with LIBXML_NOCDATA, here's an example: [code]# XML file <?xml version='1.0' standalone='yes'?> <aaa> <bbb> <id>1</id> <title>title 1</title> <msg><![CDATA[hello world string]]></msg> </bbb> <bbb> <id>2</id> <title>another title</title> <msg>another message</msg> </bbb> </aaa> # PHP file <?php $xml = simplexml_load_file('file.xml', 'SimpleXMLElement',LIBXML_NOCDATA); print_r($xml); ?>[/code] | |
Re: Check my reply, and the evolution of the script, in this thread [url]http://www.daniweb.com/web-development/php/threads/375317[/url] The solution is the same. Bye :) | |
Re: You need to change this: [code]imagecopyresampled($bgim_new,$bgim_old,0,0,600,200,$bgth_width,$bgth_height, $bgimage_attribs[0], $bgimage_attribs[1]);[/code] This should be the values: [code]imagecopyresampled('newfile.jpg','original.jpg',0,0,600,200,400,500,1600,900);[/code] In order to crop, GD needs to know where to start cropping. On a 1600px width, if you want 400px width, you have to do 1200px/2, so you end with 600px, the same is done for … | |
Re: Search for Error Handler. On "MySQL Stored Procedure Programming", written by Guy Harrison and Steven Feuerstein there's also a good example. you can find it searching on Google, bye :) | |
Re: You can use JSON if you want to write everything by yourself, otherwise search for Cassandra, Redis or CouchDB, for this last one check this tutorial: [url]http://www.ibm.com/developerworks/opensource/library/os-php-couchdb/index.html?ca=drs-[/url] Bye :) | |
Re: For a CakePHP controller the path is the directory that contains the app. So, probably, that's the root of your server. Is writable that path? Try to change it to something like this: [code]imagepng($dest,'/path/image.png'); # you can add also $_SERVER['DOCUMENT_ROOT'][/code] bye :) | |
Re: You can use .htaccess: [code]order deny,allow deny from all[/code] put this file inside the folder to protect and no one can access from the web. Source: [url]http://httpd.apache.org/docs/2.2/howto/access.html[/url] bye :) | |
Re: You can improve it adding a [b]salt[/b] to your hashing password. Create salt.php: [code]<?php define('SALT','secret string',true); ?>[/code] Then create a directory where you save salt.php and where you also create an .htaccess file: [code]order allow,deny deny from all[/code] And then include it in your main script: [code]include($_SERVER['DOCUMENT_ROOT'].'/safe_path/salt.php'); $hpassword = sha1(SALT.$password);[/code] … | |
Re: The only way for PHP to get form data is to use GET or POST. In PHP you can use PHP DOM* to get an element by id, but it will retrieve the page and analyze it, this page will not contain the data inserted in the form, because is … ![]() | |
Re: Send an echo from functions.php just to be sure is including fine. You should also get some notices from PHP because $_POST variables aren't there until you send the form. A question: max_of_3.php and Maxof3.php are the same file? On the form tag you send data to the second. | |
Re: When you use [icode]hashing::hash()[/icode] you're going to output a new unique_salt() each time, so when the user registers to the website, this value has to be saved to the database, if you don't store it then your script won't be able to get the right match. ![]() | |
Re: You're using curly quotes on all php code, change them to single quotes, so do not use [icode]‘ ’[/icode] but [icode]' '[/icode]. And do the same for double curly quotes. This should solve the problem. A question: which editor are you using? | |
Re: Search for [b]Remove rel=EditURI and rel=wlwmanifest links[/b] on search engine. From what I read that's needed only if you plan to write to Wordpress with windows Live Writer. If you don't need it you can remove it. You get the error because for W3C there are only these [b]rel[/b] values: … | |
Re: Depends also on the PHPMyadmin config, there are 3 ways to login and if it uses the .htpasswd method than I don't think you can save it with Firefox, but with Chrome yes (I had this issue..) | |
Re: Maybe is not the best solution but here's an example: [code]<?php $arr = array('1','2','3','4'); # simple array function sql_where($a) { $b = ""; $n = count($a) -1; for($i = 0; $i <= $n; $i++) { $b .= ($i == $n) ? "`studnum` = '$a[$i]' " : "`studnum` = '$a[$i]' OR … ![]() | |
![]() | Re: Reloading Apache it should work: [code]sudo /etc/init.d/apache2 reload[/code] |
Re: The fields you want to add are already on the database table? If no, use alter command from mysql client to add it, an example: [code]alter table `xeon_users` add `phone` varchar(50) not null; alter table `xeon_users` add `bankName` varchar(255) not null; alter table `xeon_users` add `address` varchar(255) not null;[/code] Then … | |
Re: The best option it to get an hosting with the same features you need. So the bandwidth won't be limited by your connection speed. If you want to run your website from home, you need to check if your IP is static or dynamic. If dynamic, then you need to … | |
Re: First of all, congrats! :) You don't need to write different versions of the same page. Sometimes you need to apply some little adjustments, just grab a CSS tutorial/book and learn from there. Pixels are always the same on each computer, if you set a page at 900px it will … | |
| |
Re: This is wrong: [code]$query = "SELECT * FROM pro_words".$_SESSION['where clause'];[/code] this should work: [code]$query = "SELECT * FROM pro_words WHERE word = ".$_GET['w']; # or $_SESSION['word'][/code] but remember to sanitize data. |
The End.