505 Posted Topics

Member Avatar for Octet

You could add something simple like this following after increasing the health value. $health = min($health, 100);

Member Avatar for blocblue
0
213
Member Avatar for ehpratah

That should be simple enough if all you want to do is charge an additional day if the customer doesn't return the vehicle on or before the time they collected the vehicle. <?php date_default_timezone_set('Europe/London'); define('SECONDS_IN_DAY', 86400); define('DAYS_IN_MONTH', 30); define('DAYS_IN_WEEK', 7); define('COST_PER_MONTH', 52500); define('COST_PER_WEEK', 15000); define('COST_PER_DAY', 2500); $start_date = '2012-06-01 06:00:00'; …

Member Avatar for ehpratah
0
216
Member Avatar for hwoarang69

Thats because a . in CSS refers to a class, not an id. /** Id syntax */ #bold2 {margin-left:50px;} /** Class syntax */ .bold2 {margin-left:50px;}

Member Avatar for blocblue
0
101
Member Avatar for riseguim

`strcasecmp('Hello', 'HELLO') == 0` - when strings are identical, regardless of case

Member Avatar for riseguim
0
135
Member Avatar for vijayram
Member Avatar for bo0ga

Yes, you're correct that line 2 is important. That's checking the email field to determine whether the form, or at least an email addres has been submitted. You could modify your code to the following: <?php if (isset($_POST['comment']) && $_POST['comment']) { $ToEmail = 'youremail@site.com'; $EmailSubject = 'Site contact form'; $mailheader …

Member Avatar for blocblue
0
122
Member Avatar for Patiodude

It looks like most of the errors are caused by the fact that your `connect.php` script cannot be found and included, hence your database queries, etc are failing. It looks like you're in the news subdirectory. Is your connect script in the same directory, one above or elsewhere? Fix that, …

Member Avatar for blocblue
0
348
Member Avatar for ehpratah

You're calling the `diff` function on a non object. Lines 10 and 11 should read: $datetime1 = new DateTime($date1); $datetime2 = new DateTime($date2);

Member Avatar for ehpratah
0
2K
Member Avatar for renjithdas

There was a similar post topic quite recently, just with BB syntax instead. Try: function highlight($string, $term) { return preg_replace("/(?<!\<)(\b{$term}\b)(?!\>)/i", '<span style="color:#f00;">\\1</span>', $string); }

Member Avatar for blocblue
0
150
Member Avatar for mariaceline_21

You're calling a variable `$firstname` on line 66 of your file index.php and it hasn't been declared before use. Without seeing further code, it's difficult to advise further.

Member Avatar for sway1101
0
95
Member Avatar for Reliable
Member Avatar for blocblue
0
245
Member Avatar for rotten69

At a guess, I would think it has to do with the data type. In your first example, you're using simple variables, floats, ints, etc. In the second, you're using arrays, which in JavaScript are objects. Therefore, when assigning a variable to `var a`, you're actually just passing it a …

Member Avatar for rotten69
2
234
Member Avatar for adige72

I've not encountered the `get_header` action before. Should this not be `wp_head`? I've also not used the `wp_localize_script` function either. When using ajax functionality in WP admin, I too have used the `wp_ajax_<your action name>` action, which to call needs to correspond to the action called on the ajax-admin.php URL. …

Member Avatar for blocblue
0
1K
Member Avatar for udaydesai

When I used to use Zend, it didn't have built in support for handing XLS files, so I used to use the [PHP Excel](http://phpexcel.codeplex.com/) library. Beware - It can be a little heavy on the memory, if handling very large XLS files (10,000 lines).

Member Avatar for udaydesai
0
1K
Member Avatar for kingofnothing

To get the featured image, you can use the following code: <?php if(has_post_thumbnail()): ?> <div class="image"> <?php the_post_thumbnail(); ?> </div> <?php endif; ?>

Member Avatar for kingofnothing
0
150
Member Avatar for scobi
Member Avatar for devianleong

On line 122 above, you're overwriting the total with every iteration of your loop. Create a preset variable `$total = 0` on line 103, and then replace line 122 with `$total += $subtotal;`

Member Avatar for Szabi Zsoldos
0
208
Member Avatar for johnef_sh

Can you post your HTML form code? After submitting your form, are you getting any errors? Which form message are you seeing - the one on line 31 or 33? R.

Member Avatar for blocblue
0
101
Member Avatar for prem2

Have you tried looking [here](http://letmegooglethat.com/?q=mvc+design+pattern+benefits) yet?

Member Avatar for baig772
0
146
Member Avatar for Tenaciousmug

I don't see that your query is correct. The subquery you have used in the NOT IN statement uses the *u* alias, which isn't defined within the subquery itself. Likewise, the user collection table doesn't join the user item table, which is defined as using the *u* alias. Have you …

Member Avatar for 1stDAN
0
106
Member Avatar for piotrekw

Apparently you need to use negative assetions, as [described here](http://stackoverflow.com/questions/6056472/regex-to-match-keyword-if-not-enclosed-by-curly-braces) So, for your case, where you don't want the text matched if it's between square brackets, you would use: (?!\[)(\bsome title\b)(?!\]) function highlight($string, $term) { return preg_replace("/(?!\[)(\b{$term}\b)(?!\])/i", '<span style="color:#f00;">\${1}</span>', $string); } R

Member Avatar for piotrekw
0
167
Member Avatar for kairoland

I'm not sure that I fully understand why you feel that you need to use dynamic variable names. Have you tried something like: <input name="tableId[]" type="checkbox" value="<?php echo $row['ID']" /> This will allow you to select multiple checkboxes, and when submitted, they will all be contained within the variable tableId. …

Member Avatar for blocblue
0
115
Member Avatar for decade
Member Avatar for blocblue
0
1K
Member Avatar for A T Smith

If you need to access and manipulate the tld data, a more appropriate solution would be to create a tld table, and instead store a foreign key to the correct tld in your domains table.

Member Avatar for blocblue
0
138
Member Avatar for Reidmere

I am a little confused. If you want a random integer, why would you want to increment / decrement it by one to select the next track? Surely, you'd want another random track? Anyway, you could: $result = mysql_query('SELECT COUNT(*) AS `count` FROM songlist'); $count = mysql_fetch_assoc($result); // Find random, …

Member Avatar for Reidmere
0
215
Member Avatar for madhan

Depending on what you're trying to accomplish with the value you pass to PHP, you could try using the [jQuery Post](http://api.jquery.com/jQuery.post/) function. $(function() { $('#myTable td').click(function(event) { var value = $(this).closest('tr').find('.name').html(); $.post('test.php', {value: value}, function(response) { alert(response); }); ); }); <?php // test.php $value = isset($_POST['value']) ? $_POST['value'] : null; …

Member Avatar for blocblue
0
2K
Member Avatar for lastgame2007

You haven't explained what you're trying to do, so I have assumed that you want to insert a comma separated lsit of days into your database field. The reason only the last day is being saved is because you're overwriting the values in your loop on line 18. Instead, why …

Member Avatar for blocblue
0
101
Member Avatar for dyingatmidnight

Can you provide examples of the URL structure you would like, and what you need that URL rewritten back to?

Member Avatar for blocblue
0
166
Member Avatar for asif49

Make it a .PHP file and just include headers to serve the content as XML. [CODE]header('content-type: text/xml');[/CODE]

Member Avatar for almostbob
0
377
Member Avatar for florin1

Store the song names in an array when fed from the form. E.g.: [CODE] <form method="post" action=""> <!-- field labels and submit button excluded for simplicity --> <input type="text" name="song[]" /> <input type="text" name="song[]" /> <input type="text" name="song[]" /> <input type="text" name="song[]" /> <input type="text" name="song[]" /> <input type="text" name="song[]" …

Member Avatar for florin1
0
168
Member Avatar for bavenbabu

Two points to note: DOMDocument::saveXML() returns either an XML string, or false on failure. To test if an error occurred, try var dumping the result. E.g.: [CODE]var_dump($dom->saveXML());[/CODE] If this is boolean false, then you have an error. Otherwise, the method will have returned an XML string. As such, you cannot …

Member Avatar for blocblue
0
245
Member Avatar for garyjuano

Strange... I have just tried your second example and it is giving me 00:50. [CODE] date_default_timezone_set('UTC'); $difference = strtotime('20:00:00') - strtotime('19:10:00'); echo date('H:i', $difference); [/CODE] Have you tried adding a full date before the time to see if it makes any difference? [CODE] date_default_timezone_set('UTC'); $difference = strtotime('2012-01-01 20:00:00') - strtotime('2012-01-01 …

Member Avatar for edwinhermann
0
140
Member Avatar for baig772

Have you enabled comments for the post? This must be done when editing a single post. If the comment options are not visible when editing the post, select the screen options link from the top right of the page and tick comments.

Member Avatar for simplypixie
0
203
Member Avatar for bavenbabu

mysql_fetch_assoc will return an array indexed by the column values specified in the select part of your query, whereas mysql_fetch_array will return a numerically indexed array with values in the order specified in the select part of your query.

Member Avatar for pritaeas
0
178
Member Avatar for darianculbert

Contact Form 7 and Gravity Forms are both good WP Form plugins. And getting more than one row on a single line can be accomplished with CSS if the plugin does not support that feature.

Member Avatar for darianculbert
0
121
Member Avatar for infinitus

To give you a large hint, look at the function [URL="http://php.net/manual/en/function.fgetcsv.php"]fgetcsv[/URL]. This page will also include a code example demonstrating how to use the function. The function reads in a CSV file one line at a time, and stores the data in a numerically indexed array, thus allowing you to …

Member Avatar for infinitus
0
233
Member Avatar for scarcella

For the remove empty function, try using the array_filter method. It removes zero and null values.

Member Avatar for scarcella
0
88
Member Avatar for piotrekw

Wrap the loop in a function. E.g. [CODE] function is_date_between($date, $dates_from, $dates_to) { $count = max(count($dates_from), count($dates_to)); for($i = 0; $i < $count; $i++) { $date_from = isset($dates_from[$i]) ? $dates_from[$i] : false; $date_to = isset($dates_to[$i]) ? $dates_to[$i] : false; if($date >= $date_from && $date <= $date_to) return true; } return …

Member Avatar for blocblue
0
86
Member Avatar for anthonyjpv

@pritaeas - unset requires you knowing the array index, which I'm guessing the OP will not know. Another option would be to change the way you're storing items in the session to the following: [CODE] $_SESSION['product_id'] = array( // Product id => Quantity 1 => 1, 2 => 3, ); …

Member Avatar for karthik_ppts
0
5K
Member Avatar for davy_yg

It looks like you're using WordPress. If so, can you not just use the built in [URL="http://codex.wordpress.org/Function_Reference/paginate_links"]pagination functionality[/URL]? [CODE] <?php global $wp_query; ?> <?php if($wp_query->max_num_pages > 1): ?> <footer> <p class="pagination"> Pages: <?php $big = 999999999; // need an unlikely integer $pagination = paginate_links(array( 'base' => str_replace($big, '%#%', get_pagenum_link($big)), 'format' …

Member Avatar for blocblue
0
261
Member Avatar for cartergarth

Try: [CODE] function func_name($date = null) { if(is_null($date)) $date = date('Y-m-d'); // Your code here } [/CODE]

Member Avatar for pritaeas
0
224
Member Avatar for IanArcher

Have you checked your file permissions? The file needs to be writable by the server. chown apache businessinfo.txt chmod 644 businessinfo.txt R.

Member Avatar for IanArcher
0
216
Member Avatar for perfectweb

If your website is installed in [url]http://localhost/mvc[/url], you need to set the rewrite base: [CODE] RewriteEngine On RewriteBase /mvc/ [/CODE]

Member Avatar for blocblue
0
308
Member Avatar for phillyt

I'm not sure whether you've already set the values of $date and $time... [CODE] if(isset($_POST['want2book']) && $_POST['want2book'] == 'Yes') { if(! strlen(trim($_POST['date'])) || ! strlen(trim($_POST['time']))) { header("Location: {$errorurl}"); exit(0); } } [/CODE]

Member Avatar for phillyt
0
163
Member Avatar for rahman86

Or try using HTML map and area tags, with each area containing a link to the page with the seat information. It might however be quite time consuming to add all of the areas.

Member Avatar for rahman86
0
410
Member Avatar for hhall56

Where is $query set? The line above is executing the query, without capturing the result. Looks like it should be replaced with: [CODE] $query = " UPDATE Liberty SET firstname='$FName' , lastname='$LName' , PatientPhone='$PatientPhone' , FacName='$FacName' , FacAddress='$FacAddress' , PatRoom='$PatRoom' , FacCity='$FacCity' , FacState='$FacState' , FacZip='$FacZip' , FacPhone='$FacPhone' , CaregiverName='$CaregiverName' …

Member Avatar for facarroll
0
202
Member Avatar for 4cpukid
Member Avatar for Zrakot

I don't mean to be rude, but that code is a mess. 7000 lines in a single file? No wonder you're having issues. Anyhow, that doesn't help you. The issue could be further up the file, seeing as you have nested if/else statements, etc so I would suggest you use …

Member Avatar for blocblue
0
207
Member Avatar for saybabs

If you're not even going to display the photographs on the website, save yourself the time and hassle of learning to develop a website and then actually building one, and just use a cloud storage provider - e.g. - Dropbox - Live Drive - iCloud - etc...

Member Avatar for blocblue
0
112
Member Avatar for desup

I think your problem needs to be split into two parts. First, finding the letter(s). Second, finding the position. [CODE] $string = '0001564AC587B4965B5'; $positions = array(); // Find all letters preg_match_all('/[a-z]/i', $string, $matches); // Check if any letters found if(isset($matches[0])) { $offset = 0; // Iterate through each letter and …

Member Avatar for desup
0
138

The End.