Jump to content

PravinS

Members
  • Posts

    459
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by PravinS

  1. try this code

    $description_message = '';	
    	foreach ($hosts as $host)
    	{
    		$hostdescription = $host["hostdescription"];
    		$hostaddress = $host["hostaddress"];
    		exec("ping -c $pingcount -w $pingcount $hostaddress", $pingoutput, $Spingstatuscode);
    		if ($Spingstatuscode === 0)
    		{
    			echo("$hostdescription ($hostaddress) is Up <BR>");
    			$description_message .= "$hostdescription ($hostaddress) is Up <BR>";
    		}
    		else
    		{
    			echo("$hostdescription ($hostaddress) is Down <BR>");
    			$description_message .= "$hostdescription ($hostaddress) is Down <BR>";
    		}		
    	}
    	$to = "EMAIL HIDDEN";
    	$subject = "SERVER DOWN: $hostdescription";
    	$message = "ATTENTION: Please check Server Status below <br>$description_message";
    	$headers .= "From: EMAIL HIDDEN\r\n";
    	$mail_sent = @mail($to, $subject, $message, $headers);
    

    i have concatenated your messages in $description_message variable and added it in mail body and taken out mail code from foreach loop

     

    may this will help you

  2. sorry about that 

     function showData()
     {
            $q = "select * from user where id=" . $this->userId;
            $r = $this->connectionString();
            $result = $r->query($q);
            while ($row = $result->fetch_assoc()) 
            {
                echo $row['name'];
            }
    }
    

    try replacing your showdata() function by above function

  3. <?php
    if (isset($_POST['btnsubmit']))
    {
    $input = "website is ".trim($_POST['website']);
    //the above works fine but i want it empty so users can input their own hyperlinked urls
    $clickable = preg_replace('*(f|ht)tps?://[A-Za-z0-9\./?=\+&%]+*', '<a href="$0">$input</a>', $input);
    echo $clickable;
    }
    ?>
    <form action="" method="POST">Update your URL<br />
    Email: <input type="text" value="php url" name="email">
    Website: <input type="text" value="php url" name="website">
    <input type="submit" value="submit" name="btnsubmit">
    </form>
    

    use above code

  4. actually your query should work as it is, its strange that its not working, you can try assigning "CURRENT_TIMESTAMP" as default value for "lastdl" field and remove it from INSERT query

     

    so your query will be 

    INSERT INTO weeklydownloads (app_id, week, weekdownloads) VALUES ('{$this->app_id}', '{$this->week}', 1)
    

    may this work for you

  5. you have passed invalid SQL query to mysqli_query() which return false to mysqli_fetch_array(), so you are getting this error.

     

    you cannot pass array in SQL query, you can convert array into comma(,) separated string and can use IN clause in SQL

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.