
Glese
Members-
Posts
166 -
Joined
-
Last visited
Never
Everything posted by Glese
-
Which is the Most Efficient Way to Generate an Unique Random Number?
Glese replied to Glese's topic in PHP Coding Help
I did not say it is an article, I said it is a contribution, I am working on a game like application for teenagers, I do not want to go in further detail. Though notice, the documentation states that the uniqid function does use the milli seconds to generate, in this sense a duplicate ID is technically possible, yet the possibility is very low that it hits the exact same mili seconds twice. A modification can make it even less likely possible by appending the user_id for example as a prefix. -
I have heard compared to other frameworks it is not as feature rich and provides rather the basics. It is also more matured than the others since it is longer around and it also is robust enough. I personally like that idea more, I would like to have one which provides the basics, and I would like to have full control over the more detailed features, that is how I really do consider a speed up of the working process. Can you confirm this?
-
The title describes the question.
-
Which is the Most Efficient Way to Generate an Unique Random Number?
Glese replied to Glese's topic in PHP Coding Help
In my initial post I stated I want to use the random id for the title of the contribution. -
Which is the Most Efficient Way to Generate an Unique Random Number?
Glese replied to Glese's topic in PHP Coding Help
I just think if it is done with auto increment the page will look a bit industrial and lifeless, with random numbers it gives it more life. What do you think of using uniqid(), I just tried it and it does work, I am just wondering if the ID is really always unique or if two can happen coincidentally as well. Other than that I could start a number at 10000 and do it with auto increment from there on. -
Hard Fixed Input Box? Can This Be Done with jQuery?
Glese replied to Glese's topic in Javascript Help
Where are you stuck is a good question, I did not know that you can create EVERYTHING in jQuery you could create in JavaScript, I understood jQuery as an addition in way a plugin, I do know it is a library, but it can mean multiple things. The answer is clearly yes then. And furthermore, would you suggest to try it in jQuery, I assume it could be easier in jQuery ? JavaScript seems like a letter soup to me, though jQuery can be too when it becomes complex, but this functionality should not be that complex to achieve in my opinion. -
Normally, when I click submit, the script becomes executed in the background and I get a confirmation and that's it, if this was a normal issue I would surely not post a thread on it, kind of pointless to even assume otherwise. This time I click submit and the php script file itself gets loaded in a new page, I do not see the source code, but I do see a bunch of error messages. When I do include the script file into the form file and I leave the action attribute empty, then it does work, but as soon as I use the action attribute it does not work anymore. I am expecting the script to execute in the background while still keeping the form in my view and not opening the script file itself in a new page with a bunch of error messages.
-
I am looking to create a hard fixed input box and I am wondering if this can be done with jQuery, which I would find easier than doing it with regular JavaScript. What I mean by this is, a textarea which has a fixed length of 100 characters PER line and a fixed amount of 3 lines, this means the textarea is one with 3 lines and with 100 characters input possibility each. It should also not be possible to re-size the area, which means that those lines are not relational, it is all hard fixed. Any suggestions?
-
The form loads the script FILE in a new window.
-
I am looking to generate a random number for every user contribution as a title of the contribution. I could simply check the database each time with a query and generate a number which does not equal to any of the entries of the database. But I imagine this as inefficient and it could become slow if the database is big in my opinion. Also I'd have to contain all the numbers of the database somewhere to manage the "not equals to", in an array or something similar but that can end up as a giant one. Excuse the layman's speech I am new to this. Any suggestions how this can be solved efficiently without straining the resources too much? You can explain it linguistically and do not have to provide me any scripts, I will figure it out.
-
<!-- The Input Form --> <form action="changemail_script.php" method="POST" > <input type="text" name="new_email" /> <input type="submit" name="submit_new_email" value="Submit" /> </form> When I have it as above, and I click submit, then the form loads the script itself and since the database connection variables are included into the header it will not work anymore. Any ideas why it does that? Should rather just include the script file and simply leave the action field empty, or do you have a better suggestion?
-
Using c:/ instead does not seem to work for me, I will look into this more.
-
Even though the path is right I am getting a warning: Warning: include(/php_projects/myproject/controller/registering/register_2.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\php_projects\myproject\controller\authentication\login_register.php on line 7 I am trying to include the file register_2.php into login_register.php, and the path is right I double checked it, I am trying to use an absolute path excluding the domain instead of a relative path. This is how I include the login_register.php file: <?php include ($register_2); ?> And this is the path.php file just to showcase: // The Login Register Page $register_2 = root . "controller/registering/register_2.php"; $login_2 = root . "controller/authentication/login_2.php"; And the define function: define('root', '/php_projects/myproject/'); With other paths this method does work, but it does not seem to work with paths which are a bit deeper in the structure. And I am wondering, why? Even using the domain, which means, putting the localhost in front of it does not work. Only a relative path will work.
-
The path.php file gets included into the header.php file, and from there on I am using variables for every path on the whole project MVC style. But other than the header.php I do not include it any where. You mentioned a check, is there any specific way to do it. Other than that I will try to define it directly in the header.php file and see if that will work. EDIT: Putting the define function inside of header.php file did solve it, keep in mind that I did not define it twice though, I assume it may have become reloaded twice.
-
What you are seeing is path.php, it is impossible that I am defining it twice, I just typed it neweley, it must be a fatal mistake apocalypse.
-
As you can read my goal in the title, I do want to develop those super snappy websites. There are a few things to consider, the programming languages of choice: HTML 5, CSS 3, jQuery, Ajax and PHP 5. I do intend to use all languages the proper way and how it is meant to be, so I achieve the maximum speed, be it proper HTML tags or no workarounds in CSS, and also bare use of images, or even having no page reloads with the help of Ajax, no matter what, my goal is to squeeze that last bit of second to create very snappy web applications, because those fascinate me the most, simple as that. But there are other things to consider, for example the hardware used. Do you guys have any suggestions regarding a very fast Hosting Service, I am as of now at namecheap.com, I do like their service a lot, it is a great all around service, though I think the speediness in the servers comes only after bigger plans as I assume. And how about the proper use of PHP for speediness, any suggestions regarding that, are there any tweaking books regarding this topic to tweak the last second out of PHP? I am open for suggestions and experiences.
-
I am not understanding, how am I defining it twice, I am trying to use it, or do you mean because I use it inside a variable. What would you recommend me to accomplish what I am trying to accomplish?
-
I am trying to use absolute path across my project excluding the domain as of now and I am trying to do it as follows: define('root', '/php_projects/myproject/'); // The Standard Data $path = "path.php"; $connectvars = "connectvars.php"; // The CSS Styles $reset_css = root . "view/reset.css"; $style_css = root . "view/style.css"; This works so far, the only problem I am having is that it is producing a notice. And my question is, how can I get rid of the notice? The notice is this one: Notice: Constant root already defined in C:\xampp\htdocs\php_projects\myproject\path.php on line 3 Why does the notice get produced in first place? I never defined it twice, as it states.
-
Is This a Proper Use of fetch_all () or Is There an Alternative?
Glese replied to Glese's topic in PHP Coding Help
lol I confused it with mysqli_fetch_all(), wait a minute, I am working on an older project and got a confused for a bit, I will rework the code a bit and then I'll post the pagination with the fetch_all function. -
if (isset($select_category) || isset($most_liked)) { // ALL but NO OTHER if (((($select_category == 'All') || (!isset($select_category)))) && (!isset($most_liked))) { $query = "SELECT * FROM con, user WHERE con.user_id = user.user_id ORDER BY contribution_date DESC"; fetch_all ($dbc, $query); // CATEGORY but NOT most_liked } elseif (isset($select_category) && !isset($most_liked)) { $query = "SELECT * FROM con, user WHERE con.user_id = user.user_id AND category = '$select_category' ORDER BY contribution_date DESC"; fetch_all ($dbc, $query); // CATEGORY and MOST_LIKED } elseif (($select_category != 'All') && (isset($select_category) && isset($most_liked))) { $query = "SELECT * FROM con, user WHERE con.user_id = user.user_id AND category = '$select_category' ORDER BY likes DESC"; fetch_all ($dbc, $query); // ALL or NO CATEGORY but MOST LIKED } elseif ((($select_category == 'All') || (!isset($select_category))) && (isset($most_liked))) { $query = "SELECT * FROM con, user WHERE con.user_id = user.user_id ORDER BY likes DESC"; fetch_all ($dbc, $query); } } What I am basically trying to accomplish is, choose a category through a drop down list, select that category and then go through all the rows in the database and print the content out. As of now it is working for me, I am also using a pagination script to print out everything in a table. The problem I am having is that fetch_all function is also printing the query out together with the content. Any ideas why it does that? Did I use this function the right way? If you need more information let me know.
-
I am trying to wrap my head around it, keep in mind I am not the most complex thinker. I just started a new project and tried to use the MVC model and I see it did not do it quite right, so I still can modify it. In layman's speech, Model is the area where the scripts and the SQL statements, which means the database accesses or transfer goes to. While controller has also all the static pages and the navigation bar, the links, and also the input forms et cetera, right? Just to state it in layman's speech. While view contains the design aspect, jquery and similar. No functions, no sorting. And the purpose of all of these is, I can let others work on this project, by giving them the files they really need and not more. A designer may need the controller level and not necessarily the model level with all the SQL statements, he also may need the view level for the jquery effects.
-
Where and which configuration needs to be done to not showcase the filename including the file extension in the address bar? Example: domain.com/view/page.php Should become: domain.com/view/
-
Proper Use of Path Structure for Folder Structure with Multiple Levels?
Glese replied to Glese's topic in PHP Coding Help
I got it to work, I had a mistake in the path. -
Proper Use of Path Structure for Folder Structure with Multiple Levels?
Glese replied to Glese's topic in PHP Coding Help
I think what I actually have to do is, I have to make the css file an absolute path. Though how do you do an absolute path on a local server? c:/ et cetera did not work for me and http://localhost/ et cetera did not work for me either. Any suggestions?