Try this
<?php echo PHP_VERSION; die;?>
As iamthwee and myself mentioned - our idea was to send an email at the time that a particular product's stock level becomes zero.
Your code appears to want to check all products' stock levels on demand and send an email.
So forget code... let's think process. Do you simply want a function that can be run anytime that checks the stock level of all products and sends an email reporting which products are at zero?
But how does havenumbers() flip from TRUE to FALSE ?
add a test page to your site containing
<?php phpinfo(); ?>
and see what it displays
If IIM's solution doesn't fix your problem can you stick pages 1, 2 and 3 into a zip file and upload?
What you describe sounds like a nav menu. Perhaps you could search in this area?
I assume there's more code as we are in infinite loop territory otherwise :-)
Any Code?
I've done that too. :-)
Isn't that what I said?
I'm not understanding your problem. The menu div will automatically size to its contents unless you explicitly make it a fixed height.
Do your divs look something like this?
<div id="container">
<div id="menu">First</div>
<div id="content">Second</div>
</div>
I can send email in PHP
So the answer is Yes.
I presume there is a PHP function you call to remove an item from the database. After this function is run, you should simply run the function that returns the product quantity of the item and then send a PHP email if quantity is less than 1.
Pseudo code (PHP):
decrementProduct($productId);
$product = getProductDetails($productId);
//assumption that returned $product is an array
if($product['quantity']<1) {
sendNoStockEmail($product);
}
Do you already have a an email function?
I have a function that I use with PayPal that you could perhaps use/adapt.
function array2nvp($arr)
{
$str = '';
$delim = '';
foreach ($arr as $key => $value) {
$str .= $delim . $key . '=' . urlencode($value);
$delim = '&';
}
return $str;
}
First off, I wouldn't store comma-delimited lists in a database field.
That said, here is some code for you to try.
<?php
$hobbies = array(
'Swimming',
'Trekking',
'Scuba Diving',
'Birding'
);
//simulate your database field result
$dbResultHobbies = 'Swimming,Trekking,Birding';
$dbResultHobbiesArray = explode(',',$dbResultHobbies);
?>
<form>
<?php foreach($hobbies as $hobby): ?>
<?php if(in_array($hobby,$dbResultHobbiesArray)): ?>
<p><input name="hobby[]" type="checkbox" value="<?php echo $hobby; ?>" checked="checked"> <?php echo $hobby; ?></p>
<?php else: ?>
<p><input name="hobby[]" type="checkbox" value="<?php echo $hobby; ?>"> <?php echo $hobby; ?></p>
<?php endif; ?>
<?php endforeach; ?>
</form>
Is your text HTML? or just text? is your muddled text just one big paragraph of text or is it truly scrambled?
Can you place your code on a site we can view?
how can I remove something like everything except for "efg" from "abcdefghijklm" without know what anything is except for "ef"?
var alpha = 'abcdefghijklm';
var pattern = 'ef';
var re = new RegExp(pattern+".");
result = alpha.replace(re,"");
alert(result);
Move count out of the if(val
$('input[type="text"]').each(function() {
var val = Number( $(this).val() );
if (val && val >= 0) {
sum += Number(val);
}
count++;
});
Two thoughts come to mind
Is there a public URL we can view?
I was iterating through array.
If there is an actual array involved, then I would use array.length
Using jQuery is the simplest method.
Before providing code I will explain the concept that you require.
Your main php page will contain two select drop downs
The first select is populated using your GetAllDept query. The second select will be empty
You will have a second php page which will call your GetTeacher query and will simply display the results inside <option> tags like your original code. This second page is run something like www.yourwebsite.com/getteachers?deptcategory=itdepartment
When the value of the first select is changed, JavsScript/jQuery is used to "quietly" run the second php file (with the value of the first select) and then inject the displayed <options> into your second empty select.
---
Page 1.
<select><option></option><option></option><option></option></select>
<select></select>
Page 2.
<option></option><option></option><option></option>
It's a judgement call. I was once called out for not having the company's name in a variable. Who knew they would eventually change their name? However it was fairly easy to use a script to change all occurrences of "Old Company Name" to "New Company Name".
So, what does 6 represent?
Do you know how to program in JavaScript?
Hi, the document.write was simply to show that the array was created as you asked. It is not required.
I'm having trouble creating an array for the data though. For static data I've made it something like this:
I was under the impression that your static array worked. If so, then the code I provided will create a variable that can be embedded in your JavaScript block.
var dataLevel = <?php echo json_encode($q).';'; ?>
@mallows.yum what is the purpose of the form?
You are performing a LIKE search to return more than one record, but your form is designed for one record only.
@atikah8890 using my code you can then create your JavaScript var using
var dataLevel = <?php echo json_encode($q).';'; ?>
and to test the following JavaScript line should print understand
document.write( dataLevel[2][1] );
I don't understand why you have asked for a random sequence.
If you want to display a different image per page refresh, then a session variable is all that is needed with a math MOD function to continuallly iterate through your images.
Can you explain what you want to happen each time a user visits the page, each time a user refreshes a page?
I totally agree with diafol and have said it on another thread - never trust client side validation, always validate server side. It's so easy to manipulate forms with Firebug and/or chrome developer tools.
You could append the $_GET['idfield'] to the next page link
e.g. (untested) <a href="records.php?page=<?php echo $nextPageNum; ?>&idfield=<?php echo $_GET['idfield']; ?>
I am indeed incorrect. Another thing learnt today.
You will need to use JavaScript - are you using any jQuery? (I prefer jQuery).
There is no readonly attribute in an <input type="text" field. There is disabled="disabled".
re-edit: I may be incorrect. :-(
This should give you the data structure you are after:-
$q = array();
while($row = mysql_fetch_assoc($query)){
$q[] = array((int)$row['q_id'],$row['response_value'],(int)$row['cr_chpt'],(int)$row['ql_level']);
}
Lines 21 & 22 Change to:-
$('.success').fadeOut(200);
$('.error').fadeIn(200);
Your code didn't resize at all for me.
<div style="height:50px;background:#F75D59;">
<div style="float:left;">
<span style="color:white;font:bold 20px arial;left:50px">GOOGLE </span>
<input type="text";text size="50px">
<input type="button" value="search">
</div>
<div style="float:right;">
<span style="color:white"> mythili mydhili </span>
<input type="button" color="#ff0000"value="1">
<input type="button" button size="10px" value="+share">
<img src="a.png"height="20px";width="20px">
</div>
<div style="clear:both")></div>
</div>
It would seem to me that both of your requirements are the same. That is, there are no records found.
jqGrid is a client side component. Getting data from the database is a server side operation, which if there are no records found shouldn't even bother trying to display a jqGrid - just a "No records found" message, with an option to refine the search.
Can you not create a function that is called on every page load to check for the existence of the required session vars, or request vars, and takes appropriate action (e.g. redirect to a form to create the required variables or a page that says "you were told!" :-)
Seems doubtful that IE can do something that Firefox can't - especially JavaScript.
What is the actual problem you are having?
Are you using jQuery or just raw JavaScript?
Script to produce a list of random numbers in an array that you can then iterate.
var ubound = 32;
var sequence = [];
var slotAvailable;
var i;
for(i=0; i<ubound; i++) {
sequence.push(0);
}
for(i=0; i<ubound; i++) {
slotAvailable = true;
while(slotAvailable) {
randomSlot = Math.floor((Math.random()*ubound));
if(sequence[randomSlot]===0) {
sequence[randomSlot] = i;
slotAvailable = false;
}
}
}
//just to show the finished sequence
document.write( sequence.join('|') );
<style type="text/css">
#rotating-img-container {
position:relative;
}
#rotating-img-container img {
position:absolute;
}
</style>
<div id="rotating-img-container">
<img class="rotating-img-item" src="images/1.jpg" />
<img class="rotating-img-item" src="images/2.jpg" />
<img class="rotating-img-item" src="images/3.jpg" />
<img class="rotating-img-item" src="images/4.jpg" />
<img class="rotating-img-item" src="images/5.jpg" />
</div>
<script>
function rotateImage()
{
var $e = $("#rotating-img-container");
$e.find("img").last().fadeOut("slow",function(){
$(this).prependTo($e);
$(this).css({display:"inline"});
});
}
$(window).load(function(){
setInterval(rotateImage,3000);
});
</script>
This works with jQuery 1.4.2, but you should review your version. 1.9.1 is current.
Seriously, you posted jquery.min
It's a bit difficult to see with all the escaping and no layout.
Try this instead:-
I've assumed your donor_id is an integer, you'll need to sort the rest. I use '%s' for strings %d for integers and %.2f for decimals.
$sql = sprintf("
INSERT INTO donors (
donor_id, name, gender, dob, weight, height, conid, statid, cityid, bloodid, email, phone, mobile, address, privacy
) values (
%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'
)
",
mysql_real_escape_string($_SESSION['donorid']),
mysql_real_escape_string($_SESSION['dname']),
mysql_real_escape_string($_SESSION['gender']),
mysql_real_escape_string($_SESSION['dobbirth']),
mysql_real_escape_string($_SESSION['weight']),
mysql_real_escape_string($_SESSION['height']),
mysql_real_escape_string($_SESSION['country']),
mysql_real_escape_string($_SESSION['state']),
mysql_real_escape_string($_SESSION['city']),
mysql_real_escape_string($_SESSION['bloodgrps']),
mysql_real_escape_string($_SESSION['email']),
mysql_real_escape_string($_SESSION['phone']),
mysql_real_escape_string($_SESSION['mobile']),
mysql_real_escape_string($_SESSION['address']),
mysql_real_escape_string($_SESSION['privacy'])
);
$result = mysql_query($sql);
valid_weight, valid_height and valid_privacysec are missing $
Code works fine, but in case I mistyped $_SESSION, here's the before and after delid=19 is removed.
$delid = 19;
$cartItems = array(
array('id' => 18, 'name' => 'book'),
array('id' => 19, 'name' => 'testing'),
array('id' => 1, 'name' => 'fruity loops')
);
print_r($cartItems);
foreach($cartItems as $key => $products){
if($products['id']==$delid) {
unset($cartItems[$key]);
}
}
echo '<hr>';
print_r($cartItems);