murtz Posted June 20, 2008 Share Posted June 20, 2008 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? Quote Link to comment Share on other sites More sharing options...
DarkerAngel Posted June 20, 2008 Share Posted June 20, 2008 echo "<marquee><u><strong>You Have Sold A Book Today! Check The Members Area</strong></u></marquee>"; echo "<script type=\"text/javascript\">alert(\"You Have Sold A Book Today!\\nCheck The Members Area\");</script>"; Quote Link to comment Share on other sites More sharing options...
bilis_money Posted June 20, 2008 Share Posted June 20, 2008 i think AJAX is better for this. Quote Link to comment Share on other sites More sharing options...
murtz Posted June 20, 2008 Author Share Posted June 20, 2008 Ok.. any idea how I could imbed it in my code?.. Is it worth me learning AJAX for such a minor thing? Quote Link to comment Share on other sites More sharing options...
DarkerAngel Posted June 20, 2008 Share Posted June 20, 2008 I don't think that AJAX is that big a deal for something so trivial. Though in your spare time AJAX is a vary useful thing to pick up. Find the first line of code in my last post and replace it with the second line in my last post. Quote Link to comment Share on other sites More sharing options...
murtz Posted June 21, 2008 Author Share Posted June 21, 2008 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! Quote Link to comment Share on other sites More sharing options...
murtz Posted June 21, 2008 Author Share Posted June 21, 2008 Anyone?? Its really irritating have the pop up come up everytime I go to the homepage Quote Link to comment Share on other sites More sharing options...
murtz Posted June 22, 2008 Author Share Posted June 22, 2008 I guess its either impossible or nobody knows how to do it? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.