Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About lional

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling
  1. lional

    content changes on hover

    Hi All I am trying to write a page to have a similar effect as the following page http://www.pht.co.za/about.php Is there tutorials that I can have a look at to figure out how to accomplish it. I have been trying to do it but my main problem is that when I hover over a menu item on the left the content must change and that content must remain until I hover over a new menu item. I am not asking that this be done for me because then I will not learn just to point me in the right direction Any help will be appreciated
  2. lional

    problem with mysqli

    Thanks, I will look and see why it is doing that and try to rectify it
  3. lional

    problem with mysqli

    Hi All I am converting my scripts from mysql to mysqli and I am having some difficulty $query = mysqli_query($conn,"SELECT * FROM products WHERE prod_id IN ("); foreach ($_SESSION['cart'] as $key => $value) { $query .= $key . ','; } $query = substr ($query, 0, -1) . ')'; $result = mysqli_query($conn, $query) or die(mysqli_error($conn)); while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) { } I get the following error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1111)' at line 1 I have tried to change it with my limited knowkledge. I am not asking for the answer just to point me in the right direction. Any help will be appreciated
  4. Hi I am struggling a bit to convert mysql to mysqli and some things don't seem to be working and I have been battling for hours I have this code that gives me the following error message Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given while (($row = mysqli_fetch_assoc($result)) !== false) { $names[$row['user_name']] = $row['user_id']; return $names; } Thank you in advance
  5. Hi All I am busy changing from mysql to mysqli on my old scrips and I have one problem that I cannot seem to solve. <?php // checks a given username and password combination. function validate_credentials($user_name, $user_password) { $conn = mysqli_connect("localhost", "root", "", "hebron_college"); /*@mysql_select_db('hebron_college');*/ $user_name = mysqli_real_escape_string($conn, $user_name); $user_password = sha1($user_password); $result = mysqli_query($conn, "SELECT * FROM users WHERE user_name = '$user_name' AND user_password = '$user_password'"); $num = mysqli_num_rows($result); echo 'number' . $num; if (mysqli_num_rows($result) != 1){ return false; } return mysqli_result($result, 0); } ?> I have done some research and I believe there is no mysqli_result function. How would I be able to replace the mysql_result line in mysqli
  6. Hi I found this facebook like messaging system tutorial that seems to be just but what I need, however when I press the reply button to send the new message it seems to be stuck on that page I am attaching all the related code. The Script.js looks like this $(document).ready(function(){ /*post message via ajax*/ $("#reply").on("click", function(){ var message = $.trim($("#message").val()), conversation_id = $.trim($("#conversation_id").val()), user_form = $.trim($("#user_form").val()), user_to = $.trim($("#user_to").val()), error = $("#error"); if((message != "") && (conversation_id != "") && (user_form != "") && (user_to != "")){ error.text("Sending..."); $.post("post_message_ajax.php",{message:message,conversation_id:conversation_id,user_form:user_form,user_to:user_to}, function(data){ error.text(data); //clear the message box $("#message").val(""); }); } }); //get message c_id = $("#conversation_id").val(); //get new message every 2 second setInterval(function(){ $(".display-message").load("get_message_ajax.php?c_id="+c_id); }, 2000); $(".display-message").scrollTop($(".display-message")[0].scrollHeight); }); I am sure it is something smaal, I have been looking at it for a few hours now and I will continue to look to see if I can solve the problem get_message_ajax.php index.php logout.php message.php post_message_ajax.php
  7. lional

    Modal Popup

    Hi All I am trying to create a modal popup but I would like it to do the following 1. Load when the user enters the site, but only once not every time they navigate to a new page. 2. when they leave the site. again only when they leave the site not when they move from page to page. I am still busy on number 1 so I haven't started working on nr 2. I have got the popup part right but it loads every time the page is refreshed. I have been trying to play with cookies but then it doesn't load at all <script> if (once_per_session==0) $(document).ready(function() { if ($.cookie('20080521') != '1') { $('#myModal').modal('show'); $.cookie('20080521', '1', { domain: '', path: '' }); } }); </script> <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Modal Header</h4> </div> <div class="modal-body"> <p>Some text in the modal.</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> <style> .modal{ position:fixed; top:0; right:0; bottom:0; left:0; z-index:1050; display:none; overflow:hidden; -webkit-overflow-scrolling:touch; outline:0 } .modal.fade .modal-dialog{ -webkit-transition:-webkit-transform .3s ease-out; -o-transition:-o-transform .3s ease-out; transition:transform .3s ease-out; -webkit-transform:translate(0,-25%); -ms-transform:translate(0,-25%); -o-transform:translate(0,-25%); transform:translate(0,-25%) } .modal.in .modal-dialog{ -webkit-transform:translate(0,0); -ms-transform:translate(0,0); -o-transform:translate(0,0); transform:translate(0,0) } .modal-open .modal{ overflow-x:hidden; overflow-y:auto } .modal-dialog{ position:relative; width:auto; margin:10px } .modal-content{ position:relative; background-color:#fff; -webkit-background-clip:padding-box; background-clip:padding-box; border:1px solid #999; border:1px solid rgba(0,0,0,.2); border-radius:6px; outline:0; -webkit-box-shadow:0 3px 9px rgba(0,0,0,.5); box-shadow:0 3px 9px rgba(0,0,0,.5) } .modal-backdrop{ position:fixed; top:0; right:0; bottom:0; left:0; z-index:1040; background-color:#000 } .modal-backdrop.fade{ filter:alpha(opacity=0); opacity:0}.modal-backdrop.in{ filter:alpha(opacity=50); opacity:.5 } .modal-header{ padding:15px; border-bottom:1px solid #e5e5e5} .modal-header .close{ margin-top:-2px } .modal-title{ margin:0; line-height:1.42857143 } .modal-body{ position:relative; padding:15px } .modal-footer{ padding:15px; text-align:right; border-top:1px solid #e5e5e5 } .modal-footer .btn+.btn{ margin-bottom:0; margin-left:5px } .modal-footer .btn-group .btn+.btn{ ; top:-9999px; width:50px; height:50px; overflow:scroll}@media (min-width:768px){ .modal-dialog{ width:600px; margin: 30px auto } .modal-content{ -webkit-box-shadow:0 5px 15px rgba(0,0,0,.5); box-shadow:0 5px 15px rgba(0,0,0,.5) }.modal-sm{width:300px}}@media (min-width:992px){ .modal-lg{ width:900px } } </style> Thank you in advance
  8. lional

    tooltip stays on page

    Hi I am trying to keep a tooltip on the page even when the user scrolls What I had in mind is keeping the the tooltip in a static position on the screen so as the user scrolls the position would stay teh same but for this to happen the margins would need to dynamically change. Here is my CSS so far /* Tooltip container */ .tooltip { /* border-bottom: 0px dotted black; If you want dots under the hoverable text */ } /* Tooltip text */ .tooltip .tooltiptext { border-radius: 5px 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 5px 5px rgba(0, 0, 0, 0.1); -moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.1); font-family:Arial, Helvetica, sans-serif; font-size:16px; position: absolute; left: 1em; top: 2em; z-index: 99; margin-left: 350px; width: 450px; margin-top:25px; visibility:hidden; background-color: rgba(0, 75, 133, 0.5); opacity:0.6; padding-left:15px;padding-bottom:15px;padding-right:15px } /* Tooltip arrow */ .tooltip .tooltiptext::after { content: ""; position: absolute; top: 100%; left: 50%; ; border-width: 5px; border-style: solid; border-color: #555 transparent transparent transparent; } /* Show the tooltip text when you mouse over the tooltip container */ .tooltip:hover .tooltiptext { visibility: visible; opacity: 0.8; } My html line is repeated for each category which I have 17 categories <a data-image-id="1" class="navigation <ul> <li> <a data-image-id="1" class="navigation tooltip" href="#"><h2 style="text-align:center;margin-top:5px">Category1</h2><span class="tooltiptext">Tooltip Text</span></a> </li> <li> <a data-image-id="2" class="navigation tooltip" href="#"><h2 style="text-align:center;margin-top:5px">Category2</h2><span class="tooltiptext">Tooltip Text</span></a> </li> --> </li> and I have javascript to handle images changing <script type="text/javascript"> //<![CDATA[ window.onload=function(){ (function() { var images = { "1": "images/hygiene1.png", "2": "images/hygiene1.png", "3": "images/change_room.png", "4": "images/foam.png", "5": "images/drains.png", "6": "images/factory.png", "7": "images/cleaning.png", "8": "images/consumable.png", "9": "images/lifting.png", "10": "images/deboning.png", "11": "images/smoking.png", "12": "images/deboning.png", "13": "images/water.png", "14": "images/a_z.png", "15": "images/csk.png", "16": "images/boyens.png", "17": "images/galactic.png" }; var navTv = document.getElementById('nav-tv'); var arr = document.getElementsByClassName('navigation'); for(var i=0; i<arr.length; i++) { arr[i].onmouseover = function(e) { var a = e.target; var imgId = a.getAttribute('data-image-id'); var imgSrc = images[imgId]; var style = ['background-image: url(', imgSrc, ');'].join(''); navTv.setAttribute('style', style); } } })(); }//]]> </script> Any help pointing me in the right direction so that I can code it will be appreciated
  9. Hi I am trying to write a script that changes the background based on a navigation hover and I have got that part right. What I would like to further do is when I move off the navigation bar it remembers the last image, if this makes sense. Here is my code so far <nav> <ul> <li> <a href="#">Home</a> <img src="pic2.jpg" alt=""> </li> <li> <a href="#">About</a> <img src="pic3.jpg" alt=""> </li> <li> <a href="#">Clients</a> <img src="pic4.jpg" alt=""> </li> <li> <a href="#">Work</a> <img src="pic5.jpg" alt=""> </li> <li> <a href="#">Contact</a> <img src="pic6.jpg" alt=""> </li> </ul> </nav> <img src="pic1.jpg" alt=""> </div> and the css .container { position: relative; overflow: hidden; margin: 100px auto; width: 800px; height: 500px; -webkit-box-shadow: 10px 10px 10px rgba(0,0,0,0.3); box-shadow: 10px 10px 10px rgba(0,0,0,0.3); } .container img { position: absolute; top: 0; left: 0; z-index: -60; } .container li img { position: absolute; top: 0; left: 800px; z-index: -50; -webkit-transition: all 1s ease; -moz-transition: all 1s ease; -o-transition: all 1s ease; -ms-transition: all 1s ease; transition: all 1s ease; } nav { width: 170px; height: 500px; background: #fff; } nav h1 { padding: 20px; color: #ccc; text-align: right; font: 25px Georgia, Times, serif; } ul { width: 800px; height: 500px; list-style: none; } li a { z-index: 1; display: block; padding-left: 20px; width: 150px; height: 30px; background: white; color: #444; text-decoration: none; font: 14px/30px Helvetica, Verdana, sans-serif; } li:nth-child(1) { padding-top: 50px; } li a:hover { background: #eee; } li a:hover + img { left: 0px; } I think I would need javascript in here somehow. I am a newbie at javascript so if someone can point me in teh right direction it would be much appreciated.
  10. lional

    MySqli with foreach loop

    Hi I am trying to do a foreach loop withing a mysqli query I had it working with mysql but am struggling doing it with mysqli here is my code so far $query = mysqli_query($conn,'SELECT * FROM cooking_classes WHERE class_id IN (' . foreach ($_SESSION['cart'] as $key => $value) { $query .= $key . ','; } $query = substr ($query, 0, -1) . ')'; $result = mysqli_query($query) or die(mysqli_error()); Thanks in advance Lional
  11. lional

    PHPMailer Help

    No, I am using PHP mailer to send the mail. If I print the variable to screen before PHPmailer assigns the array it is correct, it is just when the array is done it only takes the last name
  12. lional

    PHPMailer Help

    Morning, At the top of the message I want to say Good Morning, John for example If the table field does not have a value in it then it should just say Good Morning However what is happening is it is attaching the last name in the Database to all the emails, so if Brian is the last name in the database table all the mails will day Good Morning, Brian instead of that persons individual name Thanks Lional
  13. lional

    PHPMailer Help

    Hi I am trying to write a script where each mail body has the clients name after the greeting $result_first = mysqli_query($conn,"SELECT * from clients WHERE profmed = '1' AND email != ''"); while ($row_first = mysqli_fetch_assoc($result_first)){ $surname_out = $row_first['surname']; $email_out = $row_first['email']; $firstname_out = $row_first['firstname']; $known_as_out = $row_first['known_as']; /*print $known_as_out;*/ $complete_name = $firstname_out . ' ' . $surname_out; $final_msg = $greeting_in_out . ' ' . $known_as_out . '<br /><br />' . $textToStore; $mail->Subject = $subject_out; $mail->IsHTML(true); $mail->Body = " <html> <head> <title></title> </head> <body> <table><tr><td> $final_msg $mail_sig</table></body></html>"; A quick explanation. The client sends through the greeting that he requires to send which is the variable $greeting_in_out, the persons name $known_as_out and the message ($textToStore) is appended to it. But $mail->Body only takes the last name pulled from the database. How can each mail have the persons name on the message Thank you Lional
  14. lional

    creating php files with php

    Thank you, I thought of that approach but the only issue I have with that is how would the client access the page outside of the site. would it be something like this: www.somedomain.com/buspage.php?usrid=(then the client id)
  15. Hi All I have a a directory website but numereous listings don't have their own website so they are requesting a single page to show a summary of their business and products. I know how to do most of it the part I am unsure of is: I have a form where they upload text, images, etc to a database and upload the images. what I would like to do is to save it as a file under a subdirectory. Is it possible to save a file php file using php Thank you in advance Lional

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.