-
Posts
188 -
Joined
-
Last visited
Everything posted by mdmartiny
-
I reread what you wrote and thought about it and it made sense and I seen what you were saying. Thank you for your help
-
I want to display all of the categories that are in the database and if the post is using one of the categories it puts a check in the box. That way the categories can be changed if the user wants to change it.
-
I am creating a while loop puts a checkmark in a check box when two variables match. The code works till I place a checkmark in a check box. When that happens I get this error message :Fatal error: Uncaught Error: Call to a member function bind_param() on boolean. I can't figure out what is causing this to error out. This is the code that I am using <fieldset> <legend>Categories</legend> <?php $stmt2 = mysqli_query($db, 'SELECT catID, catTitle FROM blog_cats ORDER BY catTitle'); while($row2 = mysqli_fetch_assoc($stmt2)){ $stmt3 = $db->prepare('SELECT catID FROM blog_post_cats WHERE catID = ? AND postID = ?') ; $stmt3->bind_param("ii", $row2['catID'], $postID); $stmt3->execute(); $stmt3->bind_result($row3catID); $stmt3->fetch(); if($row3catID == $row2['catID']){ $checked = 'checked = "checked"'; } else { $checked = null; } echo '<input type="checkbox" name="catID[]" value="'.$row2['catID'].'" '.$checked.'>'.$row2['catTitle'].'<br />'; } ?> </fieldset> This is what the source looks like when using google chrome <fieldset> <legend>Categories</legend> <input type="checkbox" name="catID[]" value="2" >Development<br /><input type="checkbox" name="catID[]" value="9" >Earn Money From Home<br /><input type="checkbox" name="catID[]" value="1" checked = "checked">General<br /><br /> <b>Fatal error</b>: Uncaught Error: Call to a member function bind_param() on boolean in /storage/ssd2/059/12276059/public_html/admin/edit-post.php:141 Stack trace: #0 {main} thrown in <b>/storage/ssd2/059/12276059/public_html/admin/edit-post.php</b> on line <b>141</b><br /> The first two first two empty check boxes work just fine then the third is checked and after that the code stops working, I don't understand why.
-
I see what you are saying now by counter. I can figure out the rest on my own. Thank you
-
How would I use a counter to do this?
-
In a section of a script that I am writing I output the number of records for the person logged into the system. so it looks something like this. 13 of 5 (13 being the id and 5 being the total number of records). What I want to do is get something like this 1 of 5 It doesn't show the record id but the number of the record for that person. Would this be a pagination thing or is there another way of doing this?
-
This is the code output from the server side <div class="row compose-form"> <div class='email-header' style='border-bottom: none; margin-bottom: 25px;'><P>cndjvnjvnjfenvjev</P></div> <div class="row"> <div class="col-md-12"> <div class="col-md-6"><span class="to"> <strong>Michael Martiny</strong></span></div> <div class="col-md-6"><span class="to pull-right"> <a href="#" class="show_hide" rel="#slidingDiv_0"><i class="fa fa-caret-square-o-down" aria-hidden="true"></i></a> 02-14-2017 (23 days ago)</span> </div> </div> </div> <div class = "slidingDiv" id="slidingDiv_0"> <div class="row"> <div class="col-md-12"> <div class="email-content"> <p>Bacon ipsum dolor amet pork loin pork belly short loin, ham capicola biltong meatball beef shoulder brisket. Short loin ball tip turkey turducken fatback filet mignon landjaeger frankfurter pork belly andouille flank, ham beef. Salami andouille strip steak biltong pancetta jerky sirloin shankle tail prosciutto ground round cow leberkas spare ribs venison. Sausage tail frankfurter burgdoggen fatback boudin ham. Short ribs alcatra t-bone picanha, pork chop prosciutto ham beef ribs chuck venison pastrami beef rump shankle meatball.</p> </div> </div> </div> </div> <hr class="mail-controls-divider"> <div class="col-md-12 reply-form"> <form role="form" class="form-horizontal" action="http://martinicms.dev/admin/mail//index.php?page=email&id=13" method="post" enctype="multipart/form-data"> <div class="form-group"> <input type="hidden" name="from" value="1"> <input type="hidden" name="for" value="1"> <input type="hidden" name="date" value="2017/03/09 08:09:10 pm"> <input type="hidden" name="subject" value="cndjvnjvnjfenvjev"> <input type="hidden" name="originalMessage" value="13"> </div> <div class="form-group"> <div class="col-md-12"> <textarea class="form-control" name="inputBody" id="inputBody" rows="5"></textarea> </div> </div> <div class="form-group"> <div class="col-sm-12"> <input type="reset" class="btn btn-warning" name="clear" id="clear" value="Clear"> <input type="submit" class="btn btn-primary" name="sent" id="sent" value="send"> </div> </div> </form> </div> <div class="row"> <div class="col-md-12"> <div class="col-md-6"><span class="to"> <strong>Michael Martiny</strong></span></div> <div class="col-md-6"><span class="to pull-right"> <a href="#" class="show_hide" rel="#slidingDiv_1"><i class="fa fa-caret-square-o-down" aria-hidden="true"></i></a> 02-17-2017 (20 days ago)</span> </div> </div> </div> <div class = "slidingDiv" id="slidingDiv_1"> <div class="row"> <div class="col-md-12"> <div class="email-content"> <p>Bacon ipsum dolor amet irure corned beef adipisicing turkey. Boudin cow short loin pancetta, duis shank cupim alcatra ribeye in laborum. Aliqua chuck cupim, capicola andouille duis commodo. Aliqua dolore jerky, exercitation reprehenderit sausage est brisket.</p> <p>Shoulder boudin officia, et elit cow voluptate. Swine incididunt dolore sed in pork kielbasa sirloin meatloaf qui shankle dolore boudin fugiat. Leberkas tail flank turducken eiusmod pancetta, burgdoggen ut. Turkey consectetur pork, drumstick strip steak ea velit porchetta anim. Ham hock cillum ipsum, turducken short ribs picanha landjaeger. Est burgdoggen kevin pancetta boudin. Short loin short ribs dolor picanha jowl.</p> </div> </div> </div> </div> <hr class="mail-controls-divider"> <div class="row"> <div class="col-md-12"> <div class="col-md-6"><span class="to"> <strong>Michael Martiny</strong></span></div> <div class="col-md-6"><span class="to pull-right"> <a href="#" class="show_hide" rel="#slidingDiv_2"><i class="fa fa-caret-square-o-down" aria-hidden="true"></i></a> 02-17-2017 (20 days ago)</span> </div> </div> </div> <div class = "slidingDiv" id="slidingDiv_2"> <div class="row"> <div class="col-md-12"> <div class="email-content"> <p>Is this working</p> </div> </div> </div> </div> <hr class="mail-controls-divider"> <div class="row"> <div class="col-md-12"> <div class="col-md-6"><span class="to"> <strong>Michael Martiny</strong></span></div> <div class="col-md-6"><span class="to pull-right"> <a href="#" class="show_hide" rel="#slidingDiv_3"><i class="fa fa-caret-square-o-down" aria-hidden="true"></i></a> 03-09-2017 (17 hours, 13 minutes ago)</span> </div> </div> </div> <div class = "slidingDiv" id="slidingDiv_3"> <div class="row"> <div class="col-md-12"> <div class="email-content"> <p>Bacon ipsum dolor amet alcatra shank fatback cupim pastrami picanha filet mignon. Short loin shank pig, porchetta capicola sausage short ribs alcatra ball tip venison landjaeger cow. Beef prosciutto shankle, kevin picanha leberkas drumstick cow spare ribs brisket short loin. Kevin ball tip boudin sausage, short ribs tenderloin bresaola picanha shoulder ground round pig corned beef capicola frankfurter. Kielbasa pancetta ball tip meatball tri-tip. Landjaeger andouille strip steak salami tongue. Drumstick pig porchetta, frankfurter kielbasa shoulder leberkas ribeye meatloaf jowl filet mignon tail.</p> <p>Hamburger ham hock jerky fatback, short loin shankle pork loin turducken tail sirloin turkey venison shank salami chicken. Boudin shoulder short loin porchetta tail pork belly shankle leberkas chicken flank jowl ground round brisket pork loin landjaeger. Shank spare ribs capicola pork bresaola swine meatball frankfurter shoulder pastrami pig pork chop kevin shankle. Pork belly turkey strip steak frankfurter corned beef shankle.</p> <p>T-bone burgdoggen picanha flank. Shoulder strip steak tri-tip pork chop, t-bone filet mignon tongue shank capicola pork landjaeger. Bacon jerky salami boudin bresaola meatloaf flank tail kevin picanha pastrami capicola. Venison ham hock pork belly ball tip, jowl drumstick bacon pork chop ground round pork t-bone capicola.</p> <p>Meatball ham boudin cow bacon ribeye tenderloin rump andouille cupim sausage pork belly chuck flank. Brisket ball tip ham beef ribs. Picanha shankle ribeye andouille. T-bone pork bresaola, capicola ground round cupim andouille frankfurter jerky. Burgdoggen tongue capicola corned beef, pork chop bacon pork. Turkey pig pork alcatra pastrami sausage boudin ham hock brisket picanha strip steak cow andouille tail.</p> <p>Prosciutto ground round alcatra burgdoggen. Turducken shank ball tip landjaeger, kevin bresaola doner ham hock burgdoggen. Capicola pancetta kielbasa sirloin turkey. Tri-tip pancetta short loin beef bresaola beef ribs kevin meatloaf flank landjaeger.</p> </div> </div> </div> </div> <hr class="mail-controls-divider"> </div>
-
I have a script that creates numerous dynamic divs based on the information that it gets from the database. One of these divs I would like to be the last div in no matter how many divs there are. I am not an expert in CSS in any way. I do not know what I am doing wrong with the code that I am using. The div I want at the bottom gets moved but it also gets covered up with the previous div contents. This is the CSS that I am using .compose-form{ margin-left: auto; margin-right: auto; border-radius: 5px; padding: 20px; width: 90%; border: 1px solid #000; background-color: white; margin-bottom: 20px; min-height: 500px; position: relative; } .reply-form { position: absolute; bottom: 0; margin-bottom: 10px; } .email { background: white; border: 1px solid black; min-height:600px; } .email-header { font-size: 20px; line-height: 40px; height: 30px; margin-left: 2px; margin-bottom: 2px; font-weight: 600; padding-bottom: 40px; border-bottom: 1px solid black; } .to { font-size: 15px; ; line-height: 30px; } .email-content { margin-left: 16px; padding-top: 1px; } .slidingDiv { position: relative; display: none; } [class='slidingDiv']:last-of-type { display: block; } This is my HTML/PHP file <div class="row"> <div class="col-md-12"> <div class="col-md-6"><span class="to"> <strong><?php echo $message['to']; ?></strong></span></div> <div class="col-md-6"><span class="to pull-right"> <a href="#" class="show_hide" rel="#slidingDiv_<?php echo $counter; ?>"><i class="fa fa-caret-square-o-down" aria-hidden="true"></i></a> <?php echo date("m-d-Y", strtotime($message['sent']));?> (<?php echo getTimeSince($message['sent']).' ago'; ?>)</span> </div> </div> </div> <div class = "slidingDiv" id="slidingDiv_<?php echo $counter; ?>"> <div class="row"> <div class="col-md-12"> <div class="email-content"> <?php echo $message['body']; ?> </div> </div> </div> </div> <hr class="mail-controls-divider"> <?php if ($counter == 0) { ?> <div class="col-md-12 reply-form"> <form role="form" class="form-horizontal" action="<?php echo MAIL_URL; ?>/index.php?page=email&id=<?php echo $_GET['id']; ?>" method="post" enctype="multipart/form-data"> <div class="form-group"> <input type="hidden" name="from" value="<?php echo $user['id']; ?>"> <input type="hidden" name="for" value="<?php echo $message['sent_to']; ?>"> <input type="hidden" name="date" value="<?php echo date('Y/m/d h:i:s a', time()); ?>"> <input type="hidden" name="subject" value="<?php echo $message['subject']; ?>"> <input type="hidden" name="originalMessage" value="<?php echo $_GET['id']; ?>"> </div> <div class="form-group"> <div class="col-md-12"> <textarea class="form-control" name="inputBody" id="inputBody" rows="5"></textarea> </div> </div> <div class="form-group"> <div class="col-sm-12"> <input type="reset" class="btn btn-warning" name="clear" id="clear" value="Clear"> <input type="submit" class="btn btn-primary" name="sent" id="sent" value="send"> </div> </div> </form> </div> <?php } $counter++; } ?> I have even added a screenshot of what it looks like when it is rendered
-
How else would I set it up differently? This is how I have always set up while loops.
-
I am writing a script for a personal mail system in a CMS system. It produces multiple dynamic divs one the page listing out all of the messages. I have done this using a while loop. At the bottom of the page, I have placed a reply box. I need some of the information from the query in the while loop but I can't get the info outside of the while loop. This is the code that I have so far. I have tried using the counter == 0 on it and that does not work. I have tried doing a variable $message = '' on the outside of the loop but that does not work. Line 42 and 44 is where I am trying to place the variables. <div class="row compose-form"> <?php $id = $_GET['id']; $que = "SELECT mail.*, CONCAT(s_t.first, ' ', s_t.last) AS 'to', CONCAT(s_b.first, ' ', s_b.last) AS 'for' FROM mail INNER JOIN users AS s_t ON mail.sent_to = s_t.id INNER JOIN users AS s_b ON mail.sent_by = s_b.id WHERE mail.id = '$id' OR mail.replied_to = '$id' ORDER BY mail.sent DESC"; $res = mysqli_query($dbc, $que); $counter = 0; while ($message = mysqli_fetch_assoc($res)) { if($counter == 0) { echo "<div class='email-header' style='border-bottom: none; margin-bottom: 25px;'>"; echo "<P>".$message['subject']."</P>"; echo "</div>"; } $counter++; ?> <div class="row"> <div class="col-md-12"> <div class="col-md-6"><span class="to"> <strong><?php echo $message['to']; ?></strong></span></div> <div class="col-md-6"><span class="to pull-right"> <a href="#" class="show_hide" rel="#slidingDiv_<?php echo $counter; ?>"><i class="fa fa-caret-square-o-down" aria-hidden="true"></i></a> <?php echo date("m-d-Y", strtotime($message['sent']));?> (<?php echo getTimeSince($message['sent']).' ago'; ?>)</span> </div> </div> </div> <div class = "slidingDiv" id="slidingDiv_<?php echo $counter; ?>"> <div class="row"> <div class="col-md-12"> <div class="email-content"> <?php echo $message['body']; ?> </div> </div> </div> </div> <hr class="mail-controls-divider"> <?php } ?> <div class="col-md-12"> <form role="form" class="form-horizontal" action="<?php echo MAIL_URL; ?>/index.php?page=email&id=<?php echo $_GET['id']; ?>" method="post" enctype="multipart/form-data"> <div class="form-group"> <input type="hidden" name="from" value="<?php echo $user['id']; ?>"> <input type="hidden" name="for" value="<?php echo $message['sent_to']; ?>"> <input type="hidden" name="date" value="<?php echo date('Y/m/d h:i:s a', time()); ?>"> <input type="hidden" name="subject" value="<?php echo $message['subject']; ?>"> <input type="hidden" name="originalMessage" value="<?php echo $_GET['id']; ?>"> </div> <div class="form-group"> <div class="col-md-12"> <textarea class="form-control" name="inputBody" id="inputBody" rows="5"></textarea> </div> </div> <div class="form-group"> <div class="col-sm-12"> <input type="reset" class="btn btn-warning" name="clear" id="clear" value="Clear"> <input type="submit" class="btn btn-primary" name="sent" id="sent" value="send"> </div> </div> </form> </div> </div>
-
Is there a way to force a div to automatically being placed at the bottom of other divs? I a PHP script that creates a bunch of dynamic divs and one, in particular, I would like to force to be at the bottom of all the other divs.
-
If I echo out the $dir variable it has 'mail' in it.
-
This is my file structure -htdocs - cms -admin - mail index.php Using $_SERVER['REQUEST_URI'] in the index page. My Url will look like this www.example.dev/admin/mail/index.php?page=inbox if the query string is not attached to the URL. It should automatically place the variable there based on the file being in the mail folder. I am trying to get a variable for the mail folder of the URI. ($dir = $path_parts[2]). If the directory equals mail. It opens the "inbox" portion of the page variable; if not it defaults to the "dashboard". When I run the script that I currently get a blank page. The page does not get the "inbox" variable.
-
I am trying to write a small script to run a file based on the directory that it is in. I have tried several different ways of doing this and none of them are working? I do not know what I am doing wrong and I am going insane. $path_parts = pathinfo($_SERVER['REQUEST_URI']); $path_parts = explode('/', $path_parts['dirname']); $path_parts = array_filter($path_parts); $dir = $path_parts[2]; echo $dir; if (isset($_GET['page'])) { $page = $_GET['page']; } else if ($dir = 'mail') { $page = 'inbox'; } else { $page = 'dashboard'; } The above code is what I have come up with so far.
-
The counter is only there to count the number of divs that I have in in the while loop. I moved the counter++; to the end and it worked perfectly. Thank You.
-
I tried that and it did not work. It still iterates through every loop.
-
Thanks I did not think of that. I was actually using the counter for something else but I will give that a try.
-
I am in the process of writing a personal mail system for something that I am working on. I am setting the system up that when you open the message. It shows the original message and all messages associated with the original message. I am doing this with a while loop. I do not want to, however, show the message subject with every iteration of the while loop. How do I make it only show the subject once and run through the rest of the while loop? This is the code that I have so far. <div class="row compose-form"> <?php $id = $_GET['id']; $que = "SELECT mail.*, CONCAT(s_t.first, ' ', s_t.last) AS 'to', CONCAT(s_b.first, ' ', s_b.last) AS 'for' FROM mail INNER JOIN users AS s_t ON mail.sent_to = s_t.id INNER JOIN users AS s_b ON mail.sent_by = s_b.id WHERE mail.id = '$id' OR mail.replied_to = '$id' ORDER BY mail.sent DESC"; $res = mysqli_query($dbc, $que); $counter = 0; while ($message = mysqli_fetch_assoc($res)) { $counter++; ?> <div class="email-header"> <P><?php echo $subject['subject']; ?></P> </div> <div id="toggler-<?php echo $counter; ?>"> <div class="row"> <div class="col-md-12"> <div class="col-md-6"><span class="to"> <strong><?php echo $message['to']; ?></strong></span></div> <div class="col-md-6"><span class="to pull-right"> <?php echo date("m-d-Y", strtotime($message['sent']));?> (<?php echo getTimeSince($message['sent']).' ago'; ?>)</span> </div> </div> </div> <div class="toggler-hide-<?php echo $counter; ?>"> <div class="row"> <div class="col-md-12"> <div class="email-content"> <?php echo $message['body']; ?> </div> </div> </div> </div> </div> <hr class="mail-controls-divider"> <?php } ?>
-
echo '<option value="'.$user_data['id'].'"'.if ($user_data['id'] == $opened['id']){"selected"}.'>'.$user_data['fullname'].'</option>'; Can someone please explain why this is not working properly? What am I doing wrong
-
I am in the process of writing a class to get the ip address and the referring site to store in a database. I am not all that familiar with writing classes and want to make sure that I am on the right path. If I am doing something wrong in it please explain it to me so I can learn class browser_ip_ref{ private $_db; private $_ip; private $_url; public function __construct($db,$ip,$url){ $this->_db = $db; $this->_ip = ip2long($_SERVER["REMOTE_ADDR"]); $this->_url = $_SERVER['HTTP_REFERER']; } function getIp(){ if($this->_ip){ if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $this->_ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $this->_ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } return $this->_ip; } } function insertInfo($this->_ip, $pageID, $browser, $version){ $country_code = $this->_db->query("SELECT `ci` from `ip` WHERE ".$this->_ip." BETWEEN `start` AND `end`"); $country_code = $country_code->fetch_array(MYSQLI_ASSOC); $countryID = $country_code['ci']; $ipCount = $this->_db->("SELECT COUNT(*) AS count from `hit_counter_info` WHERE `longIP` = ".$this->_ip." AND `pageID` = $pageID"); $total = $ipCount->fetch_array(MYSQLI_ASSOC); $num_rows = $total['count']; if ($num_rows < 1) { //if not in the database add it. $this->_db->("INSERT INTO `hit_counter_info` (`longIP`,`pageID`,`cc`,`browser`,`version`) VALUES ('".$this->_ip."', '".$pageID."', '".$countryID."', '".$browser."', '".$version."')"); } } function insertRef(){ $url_parts = parse_url($this->_url); $host_parts = explode( '.', $url_parts['path']); $tld = end($host_parts); $good_tld = array('com','org','edu','uk','net','ca','mil','de','jp','fr','au','us','ru','ch','it','nl','se','no','es'); if (empty($url)) { $this->_db->("UPDATE `hit_counter_referrers` SET `ref_count` = ref_count + 1 WHERE `ref_url` = 'bookmarked'"); } else if (in_array($tld, $good_tld)) { $rowCount = $this->_db->("SELECT COUNT(*) AS count from `hit_counter_referrers` WHERE `ref_url` = '$this->_url'"); $total = $rowCount->fetch_array(MYSQLI_ASSOC); $num_rows = $total['count']; if ($num_rows > 0) { $this->_db->("UPDATE `hit_counter_referrers` SET `ref_count` = ref_count + 1 WHERE `ref_url` = '$this->_url'"); } else { $this->_db->("INSERT INTO `hit_counter_referrers` (`ref_url`,`ref_count`) VALUES ('$this->_url', 1)"); } } } }
-
I have two different tables and I am trying to condense them into one table. The structure of the tables is cc -- ci -- cc -- cn -- alpha_2 countries -- id -- cn -- alpha_2 -- alpha_3 What I want to do is place the info from the column alpha_2 in the countries table into the alpha_2 column in the cc table. I have tried inner joins, left joins, Insert and Select index. Everything that I have tried gives me an error message. I do not know what I am doing wrong and I was hoping that someone would be able to give me a hand. I forgot to mention that I want the placement of the alpha_2 column to be based on the cn columns in both tables. So that the information in the alpha_2 column lines up with the right name in the cn column
-
That is whoever is logged in at the time. In my case to 1.
-
I did that and it works when I do it that way or when I manually put the number in.
-
Yes that is where the Id is coming from.... I changed it to what you said and it still is not deleting the field
-
I will change that but when I look in the database it is still there. So I know that it is not deleting it the way that it should.