Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. Have you tried outputting your variables to make sure things work as expected? I would likely start with $userID. You could try the following: <?php //... $userID = $_SESSION['user']['username']; var_dump($userID); //... ?> If the ID came through properly, you could check the $row_count variable to make sure a row is being returned. Also, it looks like you are using MySQLi for the database connection. If that's correct, you can find some information about checking for MySQL errors here: http://php.net/manual/en/mysqli.error.php
  2. Have you tried style.color? Note that the following reference sheet might be helpful: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference
  3. Have you tried using array_change_key_case()? More information can be found here: http://php.net/manual/en/function.array-change-key-case.php
  4. Are you still getting the session_start() error? If so, please post the updated code. When posting the code, please surround it with tags. It will make your code and post easier to follow. Also note that you'll want to make sure that all errors are being reported. Try adding the following to the top of your code: <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?> Note that the original code posted has the following line: error_reporting(0); This hides the errors and makes the script difficult to debug. Of course, you'll want to hide errors once the script is fixed and live.
  5. Have you tried creating a print stylesheet? More information can be found here: http://www.smashingmagazine.com/2011/11/24/how-to-set-up-a-print-style-sheet/
  6. Also, have you tried seeing if MySQL is throwing errors? http://php.net/manual/en/mysqli-stmt.error.php
  7. Is your database object stored in $con or $conn? The code seems to use both: <?php $con->prepare(... //... $conn->close(); ?>
  8. To use a variable within a string, you need to use double quotes. mail('me@telusplanet.net',"$user",'From news page'); In this case, the quotes technically are not needed. This should work just fine: mail('me@telusplanet.net',$user,'From news page');
  9. The manual mentions that the headers are optional...assuming that the php.ini contains a default for the from header.
  10. If you post the attempted code, we may be able to let you know why it's not working. If you post more code, please surround it with tags. It makes the code and post easier to follow. When including a variable like $user in the subject line, are you using single or double quotes? Note that you need to use double quotes for a variable to work in a string. For example: <?php mail('yourEmailAddress@yourDomain.com', "$user is unable to log in", 'This is the body of the e-mail!'); ?>
  11. Could you provide more information about what you mean by "...there are times that it transmits correctly, and times that it won't...". Does the script show any errors? Does it only send part of the message...if so, what's missing? Does it fail to send the message altogether?
  12. You could use PHP's DOMDocument class: http://php.net/manual/en/class.domdocument.php
  13. My current preference is to read all the values into an array. Then split the array with array_chunk() and loop through the results. http://php.net/manual/en/function.array-chunk.php
  14. Your first example seems to work. The problem is that the code only executes when the page is first loaded. If the inner width is less than 751 when the page loads, it removes the class. If you're looking to dynamically remove the class, you could look into using .resize(). More information can be found here: http://api.jquery.com/resize/
  15. I'm personally not a fan of "secret questions". If the questions are answered honestly, it's fairly easy for someone who knows me to access my account. So I usually answer the questions with fake answers which are harder to remember and can lead to loosing access to an account.
  16. It should be $searchq = $_GET['search']; Not $searchq = $_GET["$sql"];
  17. For future reference, please post code between tags. It makes your code and post easier to follow.
  18. You're using the grave accent in the following line: $searchq = $_GET[`search`]; You need to use straight quotes: $searchq = $_GET['search']; With that said, the following lines aren't really doing anything: $searchq = $_GET[`search`]; $searchq = ("#[^a-z, A-Z]#i"); I would imagine these lines need to happen before the query where the $searchq variable is used. For now, I would just comment them out until you get the script working. Especially since the second line is going to just overwrite your variable. The second line looks like an attempt to do a regular expression. If you want to get it working, you'll need to look into how they are executed.
  19. The following if test isn't needed: if ($result->num_rows > 0) { mysqli_fetch_array() returns NULL if there are no results. If it's NULL, the loop content will be skipped. Also, you can avoid the extra overhead of mysqli_fetch_array() since you only use the associative array version of the data. You can use mysqli_fetch_assoc() instead. Perhaps the following will work: while($row = $result->fetch_assoc()) { Note that I switch the code to use the object-oriented version. I'm not sure if that's causing the issue.
  20. The following will apply the styles to the <ul> tag in the "nav-bar" <div>...and to every <li> tag on your page: #nav-bar ul, li { Instead, I recommend splitting the styles. You could try something like this: #nav-bar ul { list-style: none; margin: 0; padding: 0; } #nav-bar li { display:inline-block; line-height: 44px; height: 37px; border: 4px solid #000000; border-bottom-color: red; } Hopefully the above also answers your question. Also note that CSS comments are different than the ones in HTML. More information can be found here: http://css-tricks.com/snippets/css/comments-in-css/
  21. Since you're using LIKE, you probably need the wildcard character around the search variable. Here are some examples: http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_like
  22. I wonder if the error is caused by the search string not being enclosed in quotes. Try this: $sql = "SELECT * FROM applicant WHERE `Firstname` LIKE '$searchq' OR `Lastname` LIKE '$searchq'";
  23. Have you tried seeing if there is any MySQL errors? Note that you can find out more information about doing that here: http://php.net/manual/en/mysqli.error.php Basically, you would do something like this: $sql = ("SELECT * FROM applicant WHERE `Firstname` LIKE $searchq OR `Lastname` LIKE $searchq") or die("Could Not Search"); $result = $dbhandle->query($sql) or die($dbhandle->error); Once you get the query working, you'll want to get rid of the "or die..." debugging part.
  24. Also, note that you'll want to protect your queries from SQL injection attacks. Since you're using MySQLi, you can do that with prepared statement queries...or by using mysqli_real_escape_string().
×
×
  • 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.