paulkd 59 Newbie Poster

Try this

<?php echo PHP_VERSION; die;?>
paulkd 59 Newbie Poster

Change it to:-

<?php phpinfo(); die; ?>

paulkd 59 Newbie Poster

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?

paulkd 59 Newbie Poster

But how does havenumbers() flip from TRUE to FALSE ?

paulkd 59 Newbie Poster

add a test page to your site containing

<?php phpinfo(); ?>

and see what it displays

paulkd 59 Newbie Poster

If IIM's solution doesn't fix your problem can you stick pages 1, 2 and 3 into a zip file and upload?

paulkd 59 Newbie Poster

What you describe sounds like a nav menu. Perhaps you could search in this area?

paulkd 59 Newbie Poster

Maybe you are using PHP V5.4 ?

session_is_registered

paulkd 59 Newbie Poster

I assume there's more code as we are in infinite loop territory otherwise :-)

paulkd 59 Newbie Poster

Any Code?

paulkd 59 Newbie Poster

I've done that too. :-)

paulkd 59 Newbie Poster

Isn't that what I said?

paulkd 59 Newbie Poster

I'm not understanding your problem. The menu div will automatically size to its contents unless you explicitly make it a fixed height.

paulkd 59 Newbie Poster

Do your divs look something like this?

<div id="container">
    <div id="menu">First</div>
    <div id="content">Second</div>
</div>
paulkd 59 Newbie Poster

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);
}
paulkd 59 Newbie Poster

Do you already have a an email function?

paulkd 59 Newbie Poster

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;
}
paulkd 59 Newbie Poster

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>
Albert Pinto commented: Thanx Sir..... +2
paulkd 59 Newbie Poster

Is your text HTML? or just text? is your muddled text just one big paragraph of text or is it truly scrambled?

paulkd 59 Newbie Poster

Can you place your code on a site we can view?

paulkd 59 Newbie Poster

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);
paulkd 59 Newbie Poster

I've had problems in the past trying to install Apache and MySql standalone.

So I used WAMP

paulkd 59 Newbie Poster

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++;
        });
paulkd 59 Newbie Poster

Two thoughts come to mind

  1. Cacheing
  2. Publishing process

Is there a public URL we can view?

paulkd 59 Newbie Poster

I was iterating through array.

If there is an actual array involved, then I would use array.length

paulkd 59 Newbie Poster

Using jQuery is the simplest method.
Before providing code I will explain the concept that you require.

  1. Your main php page will contain two select drop downs

  2. The first select is populated using your GetAllDept query. The second select will be empty

  3. 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

  4. 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>

paulkd 59 Newbie Poster

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?

paulkd 59 Newbie Poster

Do you know how to program in JavaScript?

paulkd 59 Newbie Poster

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).';'; ?>

paulkd 59 Newbie Poster

@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.

paulkd 59 Newbie Poster

@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] ); 
paulkd 59 Newbie Poster

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?

paulkd 59 Newbie Poster

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.

paulkd 59 Newbie Poster

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']; ?>

paulkd 59 Newbie Poster

I am indeed incorrect. Another thing learnt today.

You will need to use JavaScript - are you using any jQuery? (I prefer jQuery).

paulkd 59 Newbie Poster

There is no readonly attribute in an <input type="text" field. There is disabled="disabled".

re-edit: I may be incorrect. :-(

paulkd 59 Newbie Poster

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']);
}   
paulkd 59 Newbie Poster

Lines 21 & 22 Change to:-

$('.success').fadeOut(200);
$('.error').fadeIn(200);
paulkd 59 Newbie Poster

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>
paulkd 59 Newbie Poster

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.

paulkd 59 Newbie Poster

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.

paulkd 59 Newbie Poster

What is the actual problem you are having?

paulkd 59 Newbie Poster

Are you using jQuery or just raw JavaScript?

paulkd 59 Newbie Poster

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('|') ); 
paulkd 59 Newbie Poster
<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.

paulkd 59 Newbie Poster

Seriously, you posted jquery.min

paulkd 59 Newbie Poster

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.

sprintf syntax

$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);
paulkd 59 Newbie Poster

valid_weight, valid_height and valid_privacysec are missing $

paulkd 59 Newbie Poster

Netbeans + Toad

paulkd 59 Newbie Poster

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);