569 Posted Topics
Re: Hey, Little confused, do you have to ask exam questions and the user answer OR are you given a .txt file with all their grades? | |
Re: You sure you're not setting the SESSION['user_id'] from a $_GET['id']? e.g. <?php $id = $_GET['id']; $_SESSION['user_id'] = $id; | |
Re: Hey, I don't know how much support we can give you on this, because we don't know what your interests are, or, what technologies you are into. Have you done any work with API's? Understanding or using them. These seem to be highly used recently, so maybe base a project … | |
Re: @szjna - In Dev-cpp (I think it's the same compiler) then you need to create a new "Project" rather than just having them in the same folder. | |
Re: @xbat > help with code Really? Did you? I think you're implying that someone does the work for you, rather than hand someone a piece of code.. Please, don't take offence to this but you can't hardly call anyone here (Who, may I add is taking time out of their … | |
Re: Hey, Everything appears to work, up to the fact that: 1) You don't ask for the input for the mathemtical operator (+, -, / etc..) cin >> symbol; 2) Your conditional if statements are wrong, they should be like: if(symbol == '+') { cout << "Add"; } You should consider … | |
Re: I don't get it? What kind of cron job is it? Are you running a specific file on YOUR server that you want other people to be able to have on their server and execute YOUR FILE from their server? | |
Re: Yeah, the output is "This is the way to an A Grade - Grade A for Sure" However, I don't think you'll be getting an A grade with this code ;)! @Ancient Dragon is right, you need to pass by reference NOT value. Also, you're assume that there are 8 … | |
Re: @diafol Is right, when he says: > store the code as plain text - either in text files or in a DB - or for copying from a page. htmlentities() can probably output safely You should (in a way) be able to upload the files (.cpp, .php., .htm, ...) But … | |
![]() | |
Re: Hey, throwing this out there. (I spend my time researching/developing Speech Algorithms so don't code much in PHP anymore) but I read an article that said that PDO removes the risk of SQL injections.. So probabily. There's a lot of debate to whether PDO or MYSQLI is more efficient etc.. … ![]() | |
Re: So essentially, a cookie is stored on the person's machine, whereas a SESSION is stored onto the server. Ok, it depends on the situation in which you are using and both of them will work in most situations, so for me, it's down to the fact I prefer SESSIONS over … ![]() | |
Re: Here is one solution to your problem: <?php function checkPreg($string) { if(preg_match('/^[^\W_]+$/', $string)): return true; else: return false; endif; } $string = "Hello244"; if(checkPreg($string)) { echo 'Yes, its ok'; }else{ echo 'No, its not ok'; } ?> Just use regex with the preg_match, you got the right function. BUT, it … | |
Re: > But the code I have used does not work to write/save the data to the array. What? | |
Re: It should be like this: 'ano (image id) aphote adteail exactar 6 image 7 image 'cid (comt id) user1(userid) ano (image id) comments 1 10 6 first comment 2 9 6 second comments 3 10 7 nice image 4 1 7 yeah Are you confused with the structure, or, the … | |
Re: Hey, pointers are pointers to memory locations (You want to do something specific to that memory block etc..) If we're talking about passing arrays to functions, we use pointers: void Funct(int *element) { cout << element[0]; } int main(int argc, char *argv[]) { int *elements = new int[10]; elements[0] = … | |
Re: My bucket list: - Write a Fast Fourier Transform (It's quite difficult!) - Finish my Speech Library off - Pay off University fee's - Get a decent job where I'll be happy and make a difference :)! - Country mannor house where and a home in major cities around the … | |
Re: //notice the addition of iomanip this gives us access to setw // Make sure we initialize the array to known values NOT >=1 OR <= 25 // Zero is good for this case. int array[5][5] = {{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}}; // For each row for (size_t crow = 0; crow < 5; crow++) … | |
Re: @LastMitch - You aren't from the UK are you? (Just asking because it's "Flooding" atm)! | |
Re: Try this: $value = .$row[booleanresult]; if ($value) { // if true $value = "YES"; } else { $value = "NO"; } | |
Re: @L7Sqr >> something that you are familiar with. Starting from scratch and expecting to be successful is not always the best approach. I did my thesis on Signal Processing / Speech Recognition, something I hadn't even touched or researched before.. I get your point though, good advice :)! | |
Re: Ok, so I don't know if this is what you are looking for: #include <iostream> using namespace std; template<typename Type> class Events { public: virtual void add() { Type s; s.add(); } }; class Coord { public: void add() { cout << "Added Coord" << endl; } }; class Zone … | |
Re: First question: Where do you define: for(;i<right && (data[i]<=data[pivot]);i++) { compares++; } compares? Second of all, you have function declartion: vector<int> quickSort(vector<int> &data, int left, int right) { This assumes that it has a return type, so therefore is expecting a vector of ints to be returned. BUT you send … | |
Re: Insead of: <h2><a href="' . $row['$txt2'] . '/' . $row['$txt2'] . '.php">' . $row['title'] . '</a></h2> </div> Try: <h2><a href="' . $row['txt2'] . '/' . $row['txt2'] . '.php">' . $row['title'] . '</a></h2> </div> I don't understand the purpose of '$txt2' etc here, in this context. | |
Re: Hey, You can use Regex, because you didn't submit any example code, I did an example which hopefully you can follow: <?php $string = "faaf2424_"; if(preg_match('/^[a-z_\-\d]{3,}$/i', $string)) { echo 'Allowed'; }else{ echo 'Not allowed :('; } ?> This would display 'Allowed' whereas if the string was this: $string = "@24@24@"; … | |
Re: Hey, I tried to run the code you've posted and it shows an indentation error. Is this the way that DaniWeb has formatted it, or, is it your code? I don't get what you're trying to ask, is your question regarding the fact that "random" cannot be imported, or, to … | |
Re: unset the session to determine that someone is signed out? I.e. http://php.about.com/od/advancedphp/ss/php_sessions_3.htm ![]() | |
Re: Hey, yes! I like to do it this way though, it's personal preference but: <?php if(!isset($_POST['name'])) { echo 'You have not submitted your name'; return 0; }else{ $name = $_POST['name']; } if(!isset($_POST['email'])) { echo 'You have not submitted your email'; return 0; }else{ $email = $_POST['email']; } if(!isset($_POST['message'])) { echo … | |
Re: @anna.lucas - This is not the forum for such questions. "Artifical Remote Enrolement System"? Lol.. | |
Re: @Dani I didn't know ProgrammingForums existed! Is it owned by DaniWeb? | |
Re: Are you asking how to implement inheritence? If so, such tasks take place primarly in your class definitions (.h) files, so, might be an idea to post them over the class implementation (.cpp). IMO. I don't get it though because inheritence usually has a "IS A", "CAN BE" Are you … | |
Re: For one, don't use: #include <iostream.h> // this is bad // use this #include <iostream> // Don't use: void main() { } // Use: int main() { } You can't expect to use: cout, cin etc.. without declaring you're using the std namespace, so, before your "main" function, always put … | |
Re: Yeah, I don't see any other way than what @myk45 said. It's a static variable, meaning it's scope is the class only. | |
Re: Your implementation of function definition is wrong: int zonePick(int foo); // class definition (prototype) The implementation should be the same: int zonePick(int foo) { } This also assumes that you're passing a variable, or a value to it: int zonePick(int foo); int main() { int foo = 10; int valueReturnedFromFunction … ![]() | |
Re: Yeah @LastMitch is right, MYSQLI is easier to manage. I read somewhere that PDO means that you do not have to worry about SQL injection I don't know how true this is though | |
Re: Why so? I think anything with complex search algorithms that requires in-depth lexical analysis is complicated, so like Google! | |
Re: So basically: I'm guessing by this line: USHORT triangle, square, rectangle, circle; You're defining variables which can then be compareable, why? Also, your comparision is wrong, like this: if (shape = triangle) { ... } A single "=" indicates to the compiler that you are trying to initalise a variable … | |
Re: Should your class name be called "list"...? | |
Re: Ok, I kind of know what it is you're trying to achieve. If you're wanting it so when a user types a key down it comes up with suggestions, this is quite simply.. It is done with jQuery/Ajax =) To do the recommended searches is a little more complex, will … | |
Re: Try this: (save it as .htaccess) and make sure it's in the correct folder (like localhost, www etc.) RewriteEngine on RewriteRule ^(.*)$ $1.php | |
Hello, So basically, I am trying to create a system based on the Singleton Pattern and I'm confused. If I have an Animal class, as well as a Cat class which is derived from Animal and then using a Singleton class will create a single object of which-ever class has … | |
Re: How are you connecting? Wireless or Wired? Have you tried contacting your ISP directly? If you're using wireless, why not try using wired (ethernet) and see if you disconnect. Hope this helps a bit :)! | |
Re: Hello, Do you expect someone to code this for you, for free? That's just plain cheeky!! There are freelance websites out there, obviously, they'll charge you!! | |
Re: Hey, I would do this using a SWITCH statement, over an if statement - If I'm honest. I haven't completeled this, but, look at this logic.. It might help you. Re-write the code for your own use, don't just use it! #include <iostream> using namespace std; int hoursToStudy(char grade) { … | |
Re: >>and then apply inheritance in your classes. >>No to both; you've already been told which classes to write, and there is no inheritance relationship involved: Shouldn't some relationship be here though? Ok, so inheritence can have a "Is a"/"Can Be" relationship so obviously "Customer" {is a} "Item" wouldn't work, however, … | |
Re: It's called Google, been around for a very long time and has a really nice UI you can use ;) ![]() | |
Re: This code: if($SM_pro){ Basically is saying if SM_pro == true, however, DM_pro is an array, so, therefore it won't return true/false. You could try: if($SM_pro <= 0) { Alternatively, you could use the mysqi_num_rows() function.. http://www.nusphere.com/kb/phpmanual/function.mysqli-num-rows.htm Hope this helps :) |
The End.