
NLT
Members-
Posts
169 -
Joined
-
Last visited
Everything posted by NLT
-
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?
-
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?
-
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']?
-
Are you displaying anything before the header? Can you give us some code to look at please.
-
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 }
-
What's the best way to do it? Would it be with like if((date('s') - date('s', strtotime($Time)) < (5 * 60))
-
<?php if ($_POST['Afloop_dag'] == "1") { echo "selected"; } ?>
NLT replied to stijn0713's topic in PHP Coding Help
Use isset to check if it isn't empty first. <?PHP if(isset($_POST['Afloop_dag']) && $_POST['Afloop_dag'] == 1) { echo "selected"; } ?> -
I am really confused on what you actually want to do..
-
'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
-
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");
-
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.
-
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
-
$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";
-
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.
-
OK. I have a wordlist and a few words contain a hyphen (-). I'm currently using an array_search to search a string with the words from the wordlist, but I think a regular expression would be better. How can I search the string with words from the wordlist the easiest and fastest with preg_match
-
I have made a template system. Here are the directories: Template files are held in: /class/templates/ Classes are held in: /class/ I've used ob_start() etc so I can write PHP in the TPL file. But when I use one of my variables I have used in the configuration file to declare a class, it says undefined variable. It even says it when I include the configuration file from the TPL file itself. And I know it's reaching there because it's connecting to the database and things.
-
Ah yes, I did also forget to mention: Fatal error: cannot use string offset as an array in register.php:112
-
So should I move the script around or...? It's in $_GET contents, so that really shouldn't be executed (if you know what I mean).
-
Cannot modify header information - headers already sent by register.php:25 in register on line 117 Code: http://pastebin.com/XaSicWvU I have also had a error on the second part with a redirect loop.
-
I've done exactly what I've showed above, I'm not sure what, if, you need anything else.
-
That's what I did. It still gives me an error in a directory
-
I have tried using what I have above and getting the same thing.