Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. Basically, most of your database stuff happens here: <?php session_start(); if(isset($_POST['submit'])) { $con = mysql_connect("localhost","root",""); $db = mysql_select_db('cms',$con); $email=$_POST['email']; $name=$_POST['name']; $subject=$_POST['subject']; $designation=$_POST['designation']; $num=$_POST['#']; //$add_type=$_POST['add_type']; // echo $q= "select * from contactus where email='".$email."' and password='".$password."' " or die(mysql_error()); $sql = mysql_query($q); $q= "select * from contactus " or die(mysql_error()); $sql = mysql_query("select * from contactus"); //$res=mysql_fetch_object($sql); $rows = mysql_num_rows($sql); } ?> Note that the code only executes after the form submits. And then you have the following code which executes whether or not the form has been submitted: <?php while($rows=mysql_fetch_array($sql)){ ?> <?php echo $row[0]; ?><br /> <?php echo $row[1]; ?><br /> <?php echo $row[2]; ?><br /> <?php } ?> So...$sql is not going to be defined until the form is submitted. Also note that the following lines are all messed up: //$add_type=$_POST['add_type']; // echo $q= "select * from contactus where email='".$email."' and password='".$password."' " or die(mysql_error()); $sql = mysql_query($q); $q= "select * from contactus " or die(mysql_error()); $sql = mysql_query("select * from contactus"); //$res=mysql_fetch_object($sql); $rows = mysql_num_rows($sql); First, you're using $q before it's defined. The " or die(..." part needs to be connected with mysql_query. Then you use mysql_query() again which doesn't use $q.
  2. Have you considered using a service like Issuu (http://issuu.com/). I know they have an option to prevent direct downloads. I'm not sure about printing though. For what it's worth: someone determined enough to get a copy of the PDF will likely find a way.
  3. It looks like you're missing an end curly quote for the first if condition. I would imagine that one is suppose to go here: //$res=mysql_fetch_object($sql); $rows = mysql_num_rows($sql); }
  4. What do the error messages say?
  5. The database connection link is being saved to $link. $link = mysql_connect("localhost","root",""); You need to use the same variable when calling mysql_select_db(). Try changing this: $db = mysql_select_db('cms',$con); To this: $db = mysql_select_db('cms',$link); Note that there are other problems with the code, but let's start with establishing a database connection.
  6. You would still be dealing with a database object, so it shouldn't make a difference. It may help if we see more code. Of course, you'll want to remove an sensitive information such as the database username and password. Have you tried passing the database object as a function argument? <?php function grab_function($functionName, $language, $conn){ $sql = "SELECT * FROM `functions` WHERE `language` = '$language' AND `name` = '$functionName' LIMIT 1"; //... } ?> Also, do you have all PHP errors and warnings being displayed? To make sure, you can add the following to the top of your script during the debugging process: <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?>
  7. Your function does declare $conn as global. So it should grant the function access to the database object. However, the error says that $conn isn't an object. That leads me to believe that the database connection wasn't made before calling the function. Or the database object wasn't assigned to $conn. Maybe it's being stored in $con, $dbs, or something else.
  8. It sounds like $conn isn't pointing to your database object. Did you open a database connection before calling grab_function()? Was the database object assigned to $conn.
  9. Have you considered saving the functions into include files and then import them as needed? You could still utilize a database to keep track of which include to use where.
  10. Isn't that essentially what Jssor is... Note that I haven't used the jQuery plugin before, so I'm just guessing. To be honest, I haven't spent much time with JavaScript animations. So this isn't my area of expertise. I would imagine that there are all sorts of pre-built libraries to help you out. I'm just not sure what they would be. Note that the first comment on the link I provided earlier talks about something called TweenLite: http://www.greensock.com/gsap-js/
  11. Is PHP set to show all errors and warnings? To do that, you can add the following to the top of your script: <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?> Of course, you'll want to remove the above code once you're done debugging.
  12. Glad to hear it! Note that I marked the topic as solved. If you need anything else, please mark it as unsolved...or start a new topic.
  13. Out of curiosity, what did you need to change?
  14. Let me try this a different way. Looking at your original code, it looks like you are processing a link click. A visitor will click on a link which passes a GET variable named "subj" or "page". After reading in the values, you grab and display another set of links from a database query. If any of those links are related to the GET variable passed, it flags them as "selected". Does that roughly sound like what you are doing? If so, have you looked at the browser's source code to see if the "selected" class appears anywhere? Perhaps the follow echo statement isn't getting executed: if ($subject["id"] == $sel_subj) { echo "class=\"selected\""; }
  15. Sorry, it's still unclear to me on what you are trying to do. The ".selected a" declaration should make all the anchor tags bold as long as they are under a tag with the class of "selected". However, it sounds like you want all the anchor tags to be normal font weight. Then, if someone clicks a link, you want to make that link bold. You could use JavaScript to accomplish this, but most visitors won't see the change since the browser will take them to another page upon clicking a link.
  16. Don't the links just go to another page? If so, you're not really going to see the bold effect once a link is clicked.
  17. Did you try changing this: .selected {font-weight: bold;} To this: .selected a {font-weight: bold;} Note the anchor reference ("a") after .selected
  18. Sorry, could you clarify what you want to do. Are you trying to styles links which have been visited...or are you trying to styles links that are under a tag which has been marked "selected"?
  19. @malma - It looks like you are adding a "selected" class to some <li> tags. Are you trying to bold the links within the <li> tags that have been marked as "selected"? If so, have you tried the following: .selected a { font-weight:bold; } Note that the following example seems to work: <style type="text/css"> .selected a { font-weight:bold; } </style> <ul> <li class="selected"><a href="#">Link 1</a></li> <li class="selected"><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> </ul>
  20. See the note about privacy and the visited pseudo class here: https://developer.mozilla.org/en-US/docs/Web/CSS/:visited
  21. According to the documentation (http://php.net/manual/en/function.urlencode.php), the function returns a string. So it should work; give it a try.
  22. Have tried searching "JavaScript animation"? The following article seems interesting: https://css-tricks.com/controlling-css-animations-transitions-javascript/ If you're looking for a specific effect, like fading in, you could specify that in a search "JavaScript fade in".
  23. So...are you just wondering how to test the values of your drop downs? Your select boxes are named "oudersessieouder1" and "oudersessieouder2". The page that processes the drop downs would use $_POST or $_GET to access the information depending on what your <form> tag's method is set to. If it's set to POST, you can access the first select box with $_POST['oudersessieouder1'] Note that you could use PHP's header() function to perform the redirects. More information can be found here: http://php.net/manual/en/function.header.php
  24. Hmm...maybe it's just a bug in PHP 5.4.37. The above code produces a fatal error for me. However, it works in PHP 5.6.5.
  25. Are you looking to replace the extra spaces for the user? If so, there are many examples here: https://www.google.com/webhp#q=php+replace+multiple+spaces+with+one
×
×
  • 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.