Jump to content

Using Javascript In PHP


murtz

Recommended Posts

Im trying to alert a user on their homepage by using a javascript pop up box. Basically.. if a user has sold a book on the day they he logs on.. then a message should pop up as soon as they log in on their home page saying 'You have sold a book'.

 

At the moment.. Im having to make do with a marquee text. Heres the code Im using..

 

<?php

	include("connect.php");

	$student_id=$_SESSION['session_name'];

 	$result = mysql_query("SELECT * FROM sales WHERE seller_id ='$student_id' and sale_date = CURDATE()");

//Count the rows retrived
$num = mysql_num_rows($result);

?>

<?php 
  
if ($num > 0) { // If it ran OK, display the records.

echo "<marquee><u><strong>You Have Sold A Book Today! Check The Members Area</strong></u></marquee>";
}

?>

 

Thats working at the moment.. but it doesnt have that 'ALERT' effect that I want it to have!.

 

Would something like echo"javascript etc etc" work?

Link to comment
Share on other sites

Mate! You are a star!!! It works!

 

However... is there anyway to limit the pop up to one time only?.. Because imagine this... you log into your homepage.. and you get an alert.. you check your members area and then go back to your homepage.. and get another alert! Can get annoying.

 

Thanks again man.. really helped me out!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.