2,113 Posted Topics
![]() | Re: That drop of Duncan Weir at the last minute still hurts here... but it was well deserved. I can already see the whitewash coming to us. > England and Ireland giving everything for the full 80 minutes Beautiful game, indeed. Ireland and England performances are stellar right now. ![]() |
Re: Hi, you could also use a regular expression, for example: if(/^rgb\(0,\s*0,\s*255\)$/i.test(document.getElementById(id).style.backgroundColor)) Docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions | |
Re: Check the **.htaccess** file, there is probably a rewrite to match the switch cases in **header.inc.php**. Also check the code of the `getCurrentFilename()` function, that should give some hints about the url manipulation. | |
Re: Did you solved the problem? Looking at the linked page, it seems all fine now. An evident error, in the above code is this: $q="select count(*) \"total\" from comments"; Because with the aliases and the column names you have to use the backticks not the quotes. So: $q = "select … | |
Re: Hi, show your query, the table structure and the output of `explain` over the query. Otherwise it is difficult to give correct suggestions. | |
Re: Hi, check the Apache error log, you should find an extended error message, if you have doubts post the errors here. | |
Re: If you're referring to the datepicker then yes, use `dateFormat`: $("#datepicker").datepicker({ dateFormat: 'dd-mm-yy' }); Documentation: * http://api.jqueryui.com/datepicker/#option-dateFormat * http://api.jqueryui.com/datepicker/#utility-formatDate | |
Re: Hi, if you're using Apache and you can use the **.htaccess** file, then you can apply these rules: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^site1.tld RewriteCond %{REQUEST_URI} logo.png RewriteRule ^logo\.png$ logo1.png [L] RewriteCond %{HTTP_HOST} ^site2.tld RewriteCond %{REQUEST_URI} logo.png RewriteRule ^logo\.png$ logo2.png [L] RewriteRule ^ - [PT] </IfModule> So … | |
Re: Hi, can you show us your code? Otherwise it not simple to help. | |
Re: Hi, I'm not sure this is the best solution, but if you open the file **jquery.poptrox.js**, at line `253` you will find: _caption .on('update', function(e, s) { if (!s || s.length == 0) s = settings.popupBlankCaptionText; _caption.html(s); }); Change it to: _caption .on('update', function(e, s) { if (!s || s.length … | |
Re: Hi, in this case `IFNULL()` is not useful, because `count()` will return `0` in case the value you submit is NULL, and `1` if you submit a string or a boolean: select count(null); +-------------+ | count(null) | +-------------+ | 0 | +-------------+ 1 row in set (0.00 sec) -- with … | |
Re: Hi, please can you explain better the relations between these three tables and the conditions that you want to use to insert the data? Right now I do not understand much. ![]() | |
Re: Hi, check if this thread helps with your issue: * http://www.daniweb.com/web-development/databases/mysql/threads/473216/alternative-way-of-an-insert-with-where-clause | |
Re: Hi, this: $zip = $_['zip']; Must be: $zip = $_POST['zip']; Then, if you still get an error, post the details of the error, otherwise it becomes difficult to help. | |
Re: Hello, can you explain the issue? Currently I see few errors in the first method, as you are not declaring the variables checked by the `IF` statement. Also the second method, i.e. `addLeads_duplicate()`, seems to be truncated. This in particular: $result=$res->result_array();enter code here Will generate an error because `enter code … ![]() | |
Re: An alternative to avoid the extra query, is to inject the user session with a variable that will log out the user as soon he performs an action. So, when you go to **logoutuser.php**, submit the **session id** of the user instead of the **user id**, for example: /logoutuser.php?sid=2ehks4jp50u6s5isv4713l6uk1 And, … ![]() | |
Re: Hi, before the undefined index notice there is: > unable to select dataid is empty but this is no where in the above code, it could be related to the error. Also, do not mix backslash and slash as here: c:\xampp\xampp\htdocs\rustoleum/photocms/ And if you want to use it, at least … | |
Re: A suggestion: this does not solve the problem if the client disables javascript. The suggestion of **network18** is correct, in your server side you should check if the index key exists. So instead of: if($_POST['wdays1']=='') echo $wdays1v = 0; else echo $wdays1v = 1; It should be: # default $wdays1v … | |
Re: Hi, from the **psql** client you can use `\dt`, it will list something like this: \dt List of relations Schema | Name | Type | Owner --------+-----------+-------+---------- public | cities | table | cereal public | provinces | table | cereal public | weather | table | cereal (3 rows) … | |
Re: Hi, you cannot submit javascript as recipient, so this: $recipient = "[email protected]<script type="text/javascript"> /* <![CDATA[ */ (function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})(); /* ]]> */ </script>"; must be: $recipient = "[email protected]"; check the available formats for the first argument of the `mail()` function: * http://www.php.net/manual/en/function.mail.php | |
Re: In addition: the `eregi()` function is weak, an attacker can submit extra code by using a **null byte** character. For example: <?php $email = $_GET['email']; if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { echo "<strong>$email</strong> is correct"; } else { echo "<strong>$email</strong> is wrong"; } And submit these links: # first http://localhost/[email protected] # second http://localhost/[email protected]%20,[email protected] … | |
Re: Try with the **DateTime** class: <?php $minute = 45; $second = 01; # value to test $test = new DateTime(); $time = $test->setTime(0, $minute, $second); # match this $minDate = new DateTime(); $min = $minDate->setTime(0, 45, 0); if($min->diff($time)->i == 0 && $minute == 45 && $min->diff($time)->s > 0) { echo … | |
Re: > So another problem, when the student request on tuesday, the expected date of release is next tuesday. etc. So, a delay of 4 working days? In MySQL you can create a function based on `WEEKDAY()` which: > Returns the weekday index for date (0 = Monday, 1 = Tuesday, … | |
Re: Hi, use the `coalesce()` function: select id, coalesce(c1, 0) + coalesce(c2, 0) + coalesce(c3, 0) ... In practice, if the value of `cN` is null it will output `0`. Docs: * https://dev.mysql.com/doc/refman/5.6/en/comparison-operators.html#function_coalesce Bye! | |
Re: You are missing the dot after `echo "Name:"`, the same happens for each line. So starting from the top, the first should be: echo "Name: " . $xml->name . "\n"; Also, by enabling the error reporting at the top of the file: error_reporting(E_ALL); ini_set("display_errors", 1); You should be able to … | |
Re: Hi, maybe your problem is related to the recently privacy changes made by Gmail. They are now caching HTML emails and so, the included images are not pulled directly from your server but from their proxy servers. It seems that only the first request can be tracked because they have … | |
Re: Hi! Try to print the mime type received by the `$_FILES` array. Sometimes the `.doc` files are not correctly detected. So try: print_r($_FILES['pdf_main']['type']); You can also use the Finfo library to check the mime: $mimes = array( 'application/msword', 'application/pdf' ); $finfo = new Finfo(FILEINFO_MIME_TYPE); if( ! empty($_FILES['pdf_main']['name']) && ! in_array($finfo->file($_FILES['pdf_main']['type']), … | |
Re: Hi, do you want to compare this: array(2) { [0]=> string(16) "anna lukaševica" [1]=> string(17) "anna lukashevicha" } between themselves, i.e. `array[0] != array[1]`, or against the other resulting arrays? And once you get a match, which result you want to achieve? Also, by showing how you generate this array, … | |
Re: > What do I need to add or change so that any backups older than the 5 newest gets pruned? In the local or in the backup server? In addition: try to avoid the use of spaces in name constants, otherwise you have to use the `constant()` function, I'm referring … | |
Re: Yes, if you browse a page without `session_start()` you cannot load the related data that you want to destroy. Check the example: http://www.php.net/session_destroy | |
Re: Not simple. Check out **CMUSphinx** and **Julius** projects: * http://cmusphinx.sourceforge.net/ * http://julius.sourceforge.jp/en_index.php Both are open source and provide a **C** API, Sphinx4 provides also a **Java** API. So if you want to make them work along with PHP you can create CGI scripts: * http://httpd.apache.org/docs/current/howto/cgi.html Or write a PHP extension: … | |
Re: Hi, in my opinion, it is better to save the images in directories and the names in a database, mainly because you can serve the images as static content, without involving the PHP engine and the database in this output process. | |
Re: Hi, in this case you can use a subquery to return all the rows from `user_status`: selecting their `max(status_type)` and `max(status_value)` and grouping by the `user_id`. Then you need a *row constructor*: select id, name from user, (select user_id, max(status_type) as status_type, max(status_value) as status_value from user_status group by user_id) … | |
Re: Do you mean you want to select a specific row from a result set? Which API are you using: MySQLi, PDO, MySQL? * http://www.php.net/manual/en/mysqlinfo.api.choosing.php | |
Re: Check out for Sequel Pro or MySQL Workbench: * http://www.sequelpro.com/ * http://dev.mysql.com/downloads/tools/workbench Or you can always use the command line client. Note: if, from Firefox, you were using PHPMyAdmin to connect to a remote database, make sure you can directly connect to it from your IP, sometimes remote connections are … | |
Re: Hi, you could explode by the spaces between the names: $names = explode(' ', $row['name']); echo $names[0]; echo $names[1]; BUT you cannot distinguish between name, middlename and lastname. The correct solution would be to normalize this information during the collection step. Which means: firstname: <input type="text" name="firstname" /><br /> middlename: … | |
![]() | Re: Hi, if you using this query in PHP then this value: $_SESSION (['MM_Username']) Must be: {$_SESSION['MM_Username']} Full query: "SELECT transactions.UserName, transactions.transactionDate, transactions.transactionType, transactions.transactionAmount, transactions.OpeningBalance, transactions.EndBalance, users.FirstName, transactions.transactionID FROM transactions, users WHERE users.UserName = transactions.UserName AND users.UserName = {$_SESSION['MM_Username']} ORDER BY transactions.UserName, transactions.transactionID DESC" Documentation: * http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex |
Re: Hi! You can use `concat_ws()` to add content to a string, for example: update table1 set color = concat_ws(',', color, 'green') where id = XX; Full example: > create table table1 ( id int unsigned auto_increment primary key not null, color varchar(255) not null, food varchar(255) not null); > insert … | |
Re: Hi, I think the OP wants to check if a given image matches the minimum print sizes at a defined DPI: <?php $image = 'img1.jpg'; list($w, $h) = getimagesize($image); $dpi = 150; # current sizes in inches $inW = round($w / $dpi, 2); $inH = round($h / $dpi, 2); # … | |
Re: The correct solution would be to serve web.py as fastcgi together with PHP and ASP, this should be managed by a server as Apache or Nginx. But if you want to try the built in server you could do something like this: #!/usr/bin/env python import web from subprocess import check_output … | |
Re: Hi, You can use **Gparted** to create or resize the partitions, but you have to start linux from a liveCD or an USB so you can change the partition without corrupting the operative system. For more information check these links: * https://help.ubuntu.com/community/GParted * http://ubuntuguide.org/wiki/Multiple_OS_Installation | |
Re: If the undefined index message is related to the `$_POST` variables it is because when you normally open a page you execute a GET request, when you submit the form, instead, you perform a POST request and only in this case the `$_POST` array is populated. So from: $name = … | |
Re: Look at the ZipArchive class: * http://www.php.net/manual/en/class.ziparchive.php An example: <?php # array of files $files = array( 'feh.jpg', 'img1.jpg' ); # name $zipname = 'archive.zip'; # create the archive $zip = new ZipArchive; $res = $zip->open($zipname, ZipArchive::CREATE); if($res === TRUE) { foreach($files as $file) { $zip->addFile($file); } $zip->close(); } # … | |
Re: I've used this a couple of times: * http://dev.umpirsky.com/list-of-all-countries-in-all-languages-and-all-data-formats/ | |
![]() | Re: I'm not sure I've understood but you can use both at the same time. For example you have a method like this one: public function activation($id) { $data = array( 'id' => $id, 'code' => $this->input->get('code', true) ); $this->load->view('signup/activation', $data); } And call the url in this format: http://localhost/signup/activation/1?code=random_string_123 The … ![]() |
Re: Hi, if you're using MySQL then there is the `timestampdiff()` function, for example: select id, title, date from article where timestampdiff(hour, date, now()) =< 10; Docs: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_timestampdiff | |
Re: You need a GSM modem connected to your server or you need to use an external service. If you can connect a GSM modem you can use an SMS gateway server like this one: [url]http://code.google.com/p/sms-gateway-server/[/url] bye. | |
Re: Look at `valid_elements`: * http://www.tinymce.com/wiki.php/configuration:valid_elements | |
Re: Or the DateTime library: $dt = new DateTime(); $dt->setTimezone(new DateTimeZone('Asia/Kolkata')); echo $dt->format('d/m/Y h:i:s a'); Docs: http://www.php.net/manual/en/class.datetime.php | |
Re: Hi, by "word document" are you referring to Microsoft Word file? `doc` or `docx`? Or it is just a plain-text file? |
The End.