Jump to content

NLT

Members
  • Posts

    169
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

NLT's Achievements

Member

Member (2/5)

0

Reputation

  1. NLT

    MySQLI query

    Okay that worked, but is there like a way I could of made that throw a error because no rows were found or would I have to check the amount of rows?
  2. Hey, So recently I decided to try learn MySQLi but I can't find any in depth guides or tutorials so I'm pretty much trying things out for myself. I'm having trouble with a simple query and I'm not sure why, it doesn't throw errors (even when I had an error in the query, I had to manually use $mysqli->error) Here is the code: <?PHP error_reporting(E_ALL); $mysqli = new mysqli(); // removed data if ($mysqli->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } $preparation = $mysqli->prepare("SELECT `username`,`password` FROM `users` WHERE `email` = ? "); $username="test"; $preparation->bind_param('s', $username); $Rusername = ""; $password = ""; $preparation->execute(); $preparation->bind_result($Rusername, $password); while($preparation->fetch()) { echo $Rusername . "<br>" . $password . "<br><br>"; } $preparation->close(); ?> Question 2: Can I make it display any sort of error throughout any part of the code?
  3. NLT

    login query

    Are you using md5 when you register? If not, then you need to md5 your password. You can use md5 or you can use one online. If you have, then have you tried to echo the plain text of $_POST['password']?
  4. Are you displaying anything before the header? Can you give us some code to look at please.
  5. I'm not sure if I read it right, but can't you use an if statement, so like: $day = "Saturday"; if($day == "Saturday" || $day == "Sunday") { // Weekend table } else { // Weekday }
  6. What's the best way to do it? Would it be with like if((date('s') - date('s', strtotime($Time)) < (5 * 60))
  7. Use isset to check if it isn't empty first. <?PHP if(isset($_POST['Afloop_dag']) && $_POST['Afloop_dag'] == 1) { echo "selected"; } ?>
  8. I am really confused on what you actually want to do..
  9. 'AllowOverride All' gives me a 500 error. I'll explain what is happening; Say I had a page, and a RewriteRule to that page, but for some reason you are missing something to access that page so it needs to redirect you from it. Now, it gives me a 500 error when I visit the page and I am missing something (session). If I visit the page with the session it works fine
  10. That is what I wanted.. but I can't seem to get it to work in a function. This is my current code(It returns as "no" whatever I use as $input): function test($input) { $blocked = array("Works", "Hyphen", "Hyphen-"); foreach( $blocked as $v ) { if( stripos( $input, $v) !== FALSE ) { echo "Found!"; break; } else { echo "no"; break; } } } test("test");
  11. But then if I remove the "Test" it returns the opposite. The thing is, it will be $_POST data so it could be anything. I want it to find, let's say: Hyphen- from Hyphen-Test and return it true/false. I want it to search the whole word for a blocked word and if it has it anywhere in the word return true/false.
  12. But if I add something after the "Hyphen-" it returns the opposite. EDIT: I don't think I made the post clear. I need it to search the whole word for that particular phrase. Not matching the blocked word with one word on it's own if you know what I mean
  13. $data = "Hyphen-"; // Would usually be $_POST data // Hyphen- returns "Worked". Hyphen-Test returns "Didn't". $blocked = array("Works", "Hyphen", "Hyphen-"); if (array_search($data, $blocked)) { echo "Worked"; } else echo "Didn't";
  14. I've put them in an array and tried using array_search. But say I got a word in array like "Hyphen-", and I make the word that it'll search to "Hyphen-" it'll work fine. But if I use "Hyphen-Test" it won't.
×
×
  • 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.