Jump to content

Barand

Moderators
  • Content count

    18,481
  • Joined

  • Last visited

  • Days Won

    312

Barand last won the day on September 7

Barand had the most liked content!

Community Reputation

1,178 Excellent

About Barand

  • Rank
    Sen . ( ile || sei )

Profile Information

Recent Profile Visitors

55,570 profile views
  1. You can do with an animated SVG image also function fadingMessage($messageToDisplay) { $msg = <<<MSG <svg width=800 height=80 viewBox="0 0 800 80"> <style type='text/css'> .msg { font-family: verdana, sans-serif; font-size: 36pt; fill: #8F1FCF; } </style> <text class="msg" x=0 y=70 >$messageToDisplay</text> <animate attributeName="opacity" from="1" to="0" begin="1s" dur="3s" fill="freeze" /> </svg> MSG; return $msg; } echo fadingMessage("This text will just fade away")
  2. Barand

    Ajax Insert Bason on Button Value

    Is it your form action that is taking you there? If you are using ajax you don't need an html form. This works: Sample.php <?php include("db_inc.php"); $db = pdoConnect('test'); /******************************************************************************* * PROCESS THE AJAX REQUEST ********************************************************************************/ if ($_SERVER['REQUEST_METHOD']=='POST' && isset($_POST['action'])) { $stmt = $db->prepare("INSERT INTO transaction_log (product_id) VALUES (?)"); $res = $stmt->execute( [ $_POST['action'] ] ); exit( $res ? 'Product log updated' : 'Oops!' ); } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="generator" content="PhpED 18.0 (Build 18044, 64bit)"> <title></title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type='text/javascript'> $(function() { $(".main-product-button").click( function() { var id = $(this).val() $.post ( "sample.php" , {"action":id} , function(resp) { alert(resp) } , 'TEXT' ) }) }) </script> </head> <body> <button name='product1' id='productID1' class='main-product-button col-md-2 btn btn-primary btn-lg space' value='1'>Widget<br/> £2.50</button> <button name='product2' id='productID2' class='main-product-button col-md-2 btn btn-primary btn-lg space' value='2'>Gizmo<br/> £4.50</button> <button name='product3' id='productID3' class='main-product-button col-md-2 btn btn-primary btn-lg space' value='3'>Wotsit<br/> £6.50</button> </body> </html>
  3. Barand

    Count all rows where a field value only appears once

    As you are grouping by transaction_id, all the values in those columns are meaningless. What is the table structue? In which column are looking for unique values? What purpose is the MIN() serving?
  4. Barand

    notifications system not working

    A few comments about the design of your "private_mesage" table pm_id int(255) - you cannot store integers with 255 digits (max 10 digits if unsigned = 4294967295). If you add one record every second you will run out in about 130 years. If this is not sufficient, make it BIGINT (20 digits). Make pm_id the primary key (not a key and a unique key). Don't use numeric values in enums. They are designed for things like "size enum('S', 'M', 'L', 'XL', 'XXL')". Just use TINYINT with values of 0 or 1. receiver and sender names should not be in this table, just their uid (which you have). The names should be stored once only in the user table. Thus the table would be like this: CREATE TABLE IF NOT EXISTS `private_message` ( `pm_id` int NOT NULL AUTO_INCREMENT, `r_seen` tinyint NOT NULL, `sent_time` datetime NOT NULL, `subject` varchar(255) NOT NULL, `message` text NOT NULL, `sdelete` tinyint NOT NULL, `rdelete` tinyint NOT NULL, `parent` int NOT NULL, `has_replies` tinyint NOT NULL, `rread` tinyint NOT NULL, `sread` tinyint NOT NULL, `receiver_uid` int NOT NULL, `sender_uid` int NOT NULL, `os_id` int DEFAULT NULL, PRIMARY KEY (pm_id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  5. Barand

    DB query not working

    Have you set the PDO connection option to throw exceptions? I don't see any error checking in the code. BTW, if you don't like the idea of pecifying the parameter :sess twice, you could SELECT ... WHERE :sess IN (sender, receiver) AND ...
  6. Barand

    DB query not working

    Have you called session_start() at the top of the script? try a echo '<pre>', print_r($_SESSION, true), '</pre>' ; to check what's there.
  7. Barand

    problem running program with exec()?

    Try it with a closing quote.
  8. Barand

    DB query not working

    Try :sess1 and :sess2 and bind the session value to both.
  9. All our illusions shattered with a single post. 😄
  10. Barand

    Can someone assist with this foreach loop?

    I know what $i was doing before you removed the loop. The point is there is no loop now , therefore $i does not have a valid value - yet you are still using it.
  11. Barand

    Can someone assist with this foreach loop?

    What value are you expecting fot $i in this code (now the for loop is removed)? if (count($trackingNumbers) > 0) { //for ($i=0; $i < count($trackingNumbers); $i++) { $trackingInfoInEmail[] = "<a href='" . $trackingNumbers[$i]['url'] . "' target='_blank'>" . $trackingNumbers[$i]['track_no'] . "</a>"; //} }
  12. All the solutions (mine and yours) are using a "mailto" link containing the email address as part of the HTML. If you don't want to expose the johndoe@example.org then send the email with PHP, not a mailto link.
  13. This should do what you are trying to do. <div style="height:1500px; background-color: #ffe;"> Padding to give page more content </div> <h2 id="backhere">Questions? Need More Information? Contact us at:</h2> <?php if ( !isset($_GET['email']) || $_GET['email'] != "info") { ?> <form action="#backhere" method="get"> <input type="hidden" name="email" value="info"> <input type="submit" value="Show e-mail address"> </form> <?php } else { ?> <a href="mailto:johndoe@example.org" title="Email John">johndoe@example.org</a> <?php } ?> However I think using javscript would be a better approach so that everything happens clientside instead of reloading the page. <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type='text/javascript'> $().ready( function() { $("#showemail").click( function() { $(this).css("display","none") $("#email_link").css("display", "inline") }) }) </script> <style type='text/css'> #email_link { display: none; } </style> </head> <body> <div style="height:1500px; background-color: #ffe;"> Padding to give page more content </div> <h2 id="backhere">Questions? Need More Information? Contact us at:</h2> <button id="showemail">Show email address</button> <a id="email_link" href="mailto:johndoe@example.org" title="Email John">johndoe@example.org</a> </body> </html>
  14. Barand

    Can someone assist with this foreach loop?

    That line won't work. Do you have error reporting turned on? As I have no idea what your input data looks like, that doesn't mean much to me.
×

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.