Jump to content

smokehut

Members
  • Posts

    9
  • Joined

  • Last visited

smokehut's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm pretty new to front-end development and I'm finding myself in a right pickle. This is how it should look by the end. Body <body> <div class="nav"> <div class="nav_container"> <ul> <li id="logo"><img src="images/logo.png" alt="FUCK"></li> <ul class="menu"> <!-- selection 1 start --> <li>Select a theme<span id="fuck"><img src="images/arrow.png" alt=">"/></span> <ul> <li><a href="#">Fuck</a></li> <li><a href="#">Fuck</a></li> <li><a href="#">Fuck</a></li> <li><a href="#">Theme</a> <ul> <li><img src="images/preview.png"></li> </ul> </li> </ul> </li> </ul> <!-- selection 1 end --> </ul> </div> </div> </body> CSS body { background: #e3e3e3; margin: 0 auto 0 auto; } .nav { float:left; background: black; width: 100%; height: 95px; margin: 0 auto; -moz-box-shadow: 0 0 8px rgba(0,0,0,.25); /* drop shadow */ -webkit-box-shadow: 0 0 8px rgba(0,0,0,.25); /* drop shadow */ box-shadow: 0 0 8px rgba(0,0,0,.25); /* drop shadow */ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEyMTUgOTUiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjxsaW5lYXJHcmFkaWVudCBpZD0iaGF0MCIgZ3JhZGllbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIHgxPSI1MCUiIHkxPSIxMjUlIiB4Mj0iNTAlIiB5Mj0iLTI1JSI+CjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMyMjIiIHN0b3Atb3BhY2l0eT0iMSIvPgo8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMzNTM1MzUiIHN0b3Atb3BhY2l0eT0iMSIvPgogICA8L2xpbmVhckdyYWRpZW50PgoKPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEyMTUiIGhlaWdodD0iOTUiIGZpbGw9InVybCgjaGF0MCkiIC8+Cjwvc3ZnPg==); /* gradient overlay */ background-image: -webkit-linear-gradient(bottom, #222 -25%, #353535 125%); /* gradient overlay */ background-image: linear-gradient(bottom, #222 -25%, #353535 125%); /* gradient overlay */ } .nav li { list-style: none; } .nav_container { /*background: white;*/ width: 960px; height: 50px; margin: 0px auto; } #logo { float:left; position: absolute; top: 24px; } .menu { color: #fff; /* text color */ font-family: "Source Sans Pro", sans-serif; font-weight: 200; font-size: 15px; float:left; display: inline; padding: 12px 320px; display:block; color:white; } ul.menu > li { background-color: #323232; /* layer fill content */ -webkit-box-shadow: 0 3px 0 rgba(0,0,0,.5); /* drop shadow */ padding-right: 10px; padding-left: 10px; height: 33px; line-height: 33px; -webkit-transition: background-color .3s; } ul.menu > li:hover { background-color: #282828; /* layer fill content */ -webkit-box-shadow: 0 3px 0 rgba(0,0,0,.5); /* drop shadow */ padding-right: 10px; padding-left: 10px; height: 33px; line-height: 33px; cursor: pointer; } ul.menu li ul { display: none; } ul.menu li:hover ul { display:block; } ul.menu li ul > li { text-align: center; width: 100%; background-color: #212121; } #fuck { padding-left: 15px; } ul.menu li ul li ul li { display:none; } ul.menu li ul li:hover ul li { display:block; } How it should look How it looks
  2. What I'm trying to do in a nutshell is create a full 5 step interaction between a user and a "host" on my site, without the need for one refresh, as I designed my website for fast-linking with #tag for selecting pages. so if a refresh occurs it's back to the home page . Basically, what I've got. ajax.js // Customise those settings var seconds = 5; var divid = "timediv"; var url = "boo.php"; //////////////////////////////// // // Refreshing the DIV // //////////////////////////////// function refreshdiv(){ // The XMLHttpRequest object var xmlHttp; try{ xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari } catch (e){ try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer } catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser does not support AJAX."); return false; } } } // Timestamp for preventing IE caching the GET request fetch_unix_timestamp = function() { return parseInt(new Date().getTime().toString().substring(0, 10)) } var timestamp = fetch_unix_timestamp(); var nocacheurl = url+"?t="+timestamp; // The code... xmlHttp.onreadystatechange=function(){ if(xmlHttp.readyState==4){ document.getElementById(divid).innerHTML=xmlHttp.responseText; setTimeout('refreshdiv()',seconds*1000); } } xmlHttp.open("GET",nocacheurl,true); xmlHttp.send(null); } // Start the refreshing process var seconds; window.onload = function startrefresh(){ setTimeout('refreshdiv()',seconds*1000); } Then, boo.php <? /*$query = "SELECT * FROM deposits WHERE user = ? AND completed = 0"; $stmt = $db->prepare($query); $stmt->bindValue(1, $user_data['username']); $stmt->execute(); $fetch = $stmt->fetch(PDO::FETCH_ASSOC);*/ // Format time output $str = "It is %a on %b %d, %Y, %X - Time zone: %Z"; // Echo results echo(gmstrftime($str,time())); ?> ^ Above is what I'm trying to achieve, but I cannot even get it to echo the time in my other php form that requires the script. <script src="ajax.js"></script> <strong>This is the current date and time (updates every 5 seconds):</strong> <script type="text/javascript"><!-- refreshdiv(); // --></script> <div id="timediv"></div> Can anyone point a beginner in the right direction? Thanks.
  3. I replaced did with deposit_id, and yet still.. A echo rowcount will = 2, and if rowcount > 0 returns else.. Read through kickens post more thouroughly and it turns out "check" was my reversed word, not "did" like I assumed. Thanks guys, this is working now !
  4. Thanks for your help guys, yet I still cannot figure this out for the life of me.. And it's something I've done plenty of times.. if (isset($_POST[$row['id']]) === true) { $query1 = "SELECT did, check FROM admin_flag WHERE did = ? AND check = 1"; $stmt1 = $db->prepare($query1); $stmt1->bindValue(1, $row['id']); $stmt1->execute(); printf("rows returned: %d\n", $stmt1->affected_rows); $fetch = $stmt1->fetch(PDO::FETCH_ASSOC); if ($fetch['did'] == $row['id']) { echo 'Row found '.$row['id']; } else { echo 'Row not found'.$row['id'].' '.$fetch['did']; } } } Even this, I cannot get to return the row ID, I get the output of, returned rows: 0, Row not found, ROW ID and no fetch id.
  5. I run that within my insert section after the execute, and it just returns "rows inserterted: 0".
  6. if (isset($_POST[''.$row['id'].'']) === true) { $query = "SELECT did, check FROM admin_flag WHERE did = ? AND check = 1"; $stmt = $db->prepare($query); $stmt->bindValue(1, $row['id']); $stmt->execute(); if ($stmt->rowCount() < 1) { $query2 = "UPDATE users SET user_flag = user_flag - 1 WHERE username = ?"; $stmt2 = $db->prepare($query2); $stmt2->bindValue(1, $row['user']); $stmt2->execute(); if ($stmt2->rowCount() > 0) { $query1 = "INSERT INTO admin_flag (did, check) VALUES (?, 1)"; $stmt1 = $db->prepare($query1); $stmt1->bindValue(1, $row['id']); $stmt1->execute(); if ($stmt1->rowCount() < 1) { echo 'Insert Inactive.'; } } else { echo 'Update Flag inactive.'; } //header('Location: view_all_cancels.php'); } else { echo 'User flag already removed for this trade.'; } } Briefly, In the admin side of things, if a host cancels a trade, the user is flagged. I can then remove a user flag via this button. BUT when I run it, it doesn't check the database correctly for a row count on the first query, secondly then it doesn't insert the values on the third query. Even though when I am testing it it should get to that else. Any help?
  7. Thank you very much for your post, and thank you for teaching me of new ways to code, looks like I was heading in the complete wrong direction ! I'll edit when I try this and let you know if it works. This works absolutely fine, without any changes ! I'll now be re-doing most of my other while loops in this way, thank you.
  8. Cannot edit: I've bodged this to get it to work and it does by doing this. $query = "SELECT * FROM deposits WHERE completed = 5 AND host = ? ORDER BY id DESC LIMIT 10"; $stmt = $db->prepare($query); $stmt->bindValue(1, $user_data['username']); $stmt->execute(); echo '<table>'; while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $query2 = "SELECT * FROM deposits WHERE id = ?"; $stmt2 = $db->prepare($query2); $stmt2->bindValue(1, $row['id']); $stmt2->execute(); $fetchmethod = $stmt2->fetch(PDO::FETCH_ASSOC); $query1 = "SELECT * FROM users WHERE username = ?"; $stmt1 = $db->prepare($query1); $stmt1->bindValue(1, $fetchmethod['user']); $stmt1->execute(); $fetch = $stmt1->fetch(PDO::FETCH_ASSOC); if ($row['method'] == "RS07") { $coins = $fetch['coins']; } if ($row['method'] == "EOC") { $coins = $fetch['eoc_coins']; } echo '<tr> <td><font size="2" color="black">| ID: '.$row['id'].' |'.$row['user'].' | '.$row['method'].' | Deposit: '.$row['value'].'<font size="1">M/Gp</font> | Now has '.$coins.'<font size="1">M/Gp</font> |</font></td> </tr>'; } echo '</table><br/><br/><br/><br/>';
  9. Here's what I've currently got. $query = "SELECT * FROM deposits WHERE completed = 5 AND host = ? ORDER BY id DESC LIMIT 10"; $stmt = $db->prepare($query); $stmt->bindValue(1, $user_data['username']); $stmt->execute(); $fetchmethod = $stmt->fetch(PDO::FETCH_ASSOC); /*$query1 = "SELECT * FROM users WHERE username = ?"; $stmt1 = $db->prepare($query1); $stmt1->bindValue(1, $fetchmethod['user']); $stmt1->execute(); $fetch = $stmt1->fetch(PDO::FETCH_ASSOC); */ That was before the while loop, hence I've ruled out which I need to include with the first query as if I don't, then the following loop only lists 'one' item. echo '<table>'; while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { /* if ($row['method'] == "RS07") { $coins = $fetch['coins']; } else if ($row['method'] == "EOC") { $coins = $fetch['eoc_coins']; } */ echo '<tr> <td><font size="2" color="black">| ID: '.$row['id'].' |'.$row['user'].' | '.$row['method'].' | Deposit: '.$row['value'].'<font size="1">M/Gp</font> | Now has '.$coins.'<font size="1">M/Gp</font> |</font></td> </tr>'; } echo '</table><br/><br/><br/><br/>'; I need to combine these tables, so I can use an array in the echo'd table to be able to provide which type of coins are being used with the method, and relay that users current coins with the method.
×
×
  • 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.