-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
Your code contains a fatal php parse error. Parse errors prevent your code from ever executing and the two lines of code that are setting error_reporting/display_errors are never executed to show anything. You must set the error_reporting/display_errors settings in your master php.ini to show all php detected errors. Stop and start your web server to get any changes made to the master php.ini to take effect and use a phpinfo() statement to confirm that the settings were actually changed in case the php.ini that you are changing is not the one that php is using. Those times when you have seen it recommended to put those two settings in your code, are when your code appears to be running but is not doing what you expect.
-
Are you including the file using a file system path? That's (generally) the only way to get php code to be included into another file. Given that you didn't post what you were using in the include_once statement, I suspect you are actually using a URL, which won't work.
-
Unless you have specific rules about the field lengths or the specific range of values for the fields, you won't be able to determine the $b and $c values. For your example, how do you know that $b shouldn't be 12 and $c shouldn't be 7?
-
Are all the lengths of the fields exactly as shown or could say the leading 1 ever be two digits?
-
DATE_ADD() expects a DATE or DATETIME for the first parameter and produced an error in my query browser - Incorrect datetime value: '16:30:00'. Use this for that part of the query - SEC_TO_TIME(TIME_TO_SEC(time) + TIME_TO_SEC(duration)) AS till_time
-
^^^ You have been told how to do that. We are not here to write your code for you and it will take more than changing a couple of lines of code. It will take some actual programming effort. Have you modified (and tested) your code to use a GET parameter to specify which profile to display/edit/update, modified (and tested) your code to cause any links to be built with that GET parameter on them, and then to add (and test) the logic to determine what actions the current visitor can do on any of the relevant pages, depending on if he is a regular member and the profile is his or he is an administrator?
-
Retrieving image from 1&1 mysql web server [URGENT]
PFMaBiSmAd replied to astha's topic in MySQL Help
What have you done to track down at what point your code and data is doing what you expect and at what point they are not? I can guarantee that the problem lies somewhere between those two points. And once you can tell us at what specific point your code and data is not doing what you expect, you would need to post the relevant code if you expected someone who is not standing right next to you to be able to help you with what is wrong with it. -
Using a static class has the same disadvantages as using the global keyword, your code is dependent on the specific name you have hard coded into the function/class that is using it. Extrapolate this problem to a different example of a user object ($user instead of a $db object), where you might have an administrator logged into a site and you want to create a page that lets him access and edit a specific user account information. By keeping your functions and classes general purpose, doing this would be simple. The page would check if the current visitor (the admin) is logged in by putting the $user variable into the function calls and then simply create a second instance of the user class (in $edit_user for example) for the visitor he wants to access. You would simply reuse and call your existing functions/classes with the correct instance of the $user or $edit_user that you need at the time.
-
You pass the $db object into the function as a parameter when you call the function, which is what the $value parameter is in the code witnot1 posted. It does not matter if you are using a function or a class method. The reason you pass it in as a parameter, instead of using the global keyword, is so that your function or class remains general purpose and is not dependent on the specific name of a variable in the calling code. Suppose that you need to have two different database connections at the same time in an application. If you use the global keyword, you would need to use more code to shuffle the two different connections back and forth between the $db variable before each call of your function or you would need to duplicate your function and modify the code in one copy to use the different db object name. However, why would you go through the extra work and coding to do that? Functions and classes are supposed to make writing code easier, not create more work. By passing the db object (or any other main program variable) into the function when you call it, you can use any number of different db objects in your code simply by putting the correct one in as a parameter when you call your function. You can write and test your function once and then use it with one db object or 10 different db objects with the minimum lines of code or extra work keeping track of what you are doing at the current time in your program.
-
Unless you post exactly what you are putting in to the query (echo the $query variable in your code and post what it is), what your data is in your table that you expect the query to match, what result you are getting, what result you expect, and what your actual code is that is executing the query and retrieving and displaying the results, no one here can directly help you. You are expecting us to be able to guess based on "it is still not working" and "the rest of the query works without problems" what your code and data is, what you searched for, and what you saw in front of you that leads you to believe that something that you are doing worked or didn't work.
-
That error is generally due to a php page that has a fatal parse or runtime error and doesn't output anything. You should be learning php, developing php code, and debugging php code on a system with error_reporting set to E_ALL (or a -1) and display_errors set to ON in your master php.ini so that all the errors php detects will be reported and displayed. Setting those two settings in your script won't help for php parse errors, which is likely what you are currently getting from your code. Stop and start your web server to get any changed made to the master php.ini to take effect and confirm that the two settings got changed by using a phpinfo(); statement in case the php.ini that you are changing is not the one that php is using.
-
Just about every quote in your code is a curly/smart quote and won't work in php source code. Your quotes should look like - ' or "
-
I have no idea what is going on. Php not working.
PFMaBiSmAd replied to Alex1646's topic in PHP Coding Help
You have got a semi-colon on the end of the while();, thereby ending the while() statement on that line. -
If the page that is being requested contains a session_start() statement, the last accessed time of the session data file will be updated to the time of the request and the session data file won't be deleted by session garbage collection.
-
If your web server/php is already configured to read the php.ini from C:\PHP\php.ini why would you want to move it someplace else? The tutorials that suggest putting it into the Windows folder were simply trying to take a short-cut because that is the default location (the Configuration File (php.ini) Path in the phpinfo() output) in the pre-built php Windows binaries.
-
I'm going to guess that when you edited your php.ini that you used some Microsoft supplied program and it got saved as php.ini.txt and php is reading the unedited php.ini file. Do you have your operating system configured to display all file extensions (extensions for known file types are hidden by default)?
-
Here is a general hint - you would need to include a GET parameter on the end of the URLs that indicates which profile you want to display/edit/update and then in your code you would determine what if anything the current visitor can do. 1) If the current visitor is not logged in or is logged in but is not an admin and he is also not the same member who's profile is being viewed, you would only display the profile, which I am guessing is what your myprofile.php page is doing? 2) If the current visitor is logged in and is either the same member who's profile is being viewed or the current visitor is logged in as an admin, you would allow them access the profile edit page. The profile edit page would also check the same conditions to make sure the current visitor has permission to edit the profile and the code that saves the changes would also recheck the permissions for the current visitor. The biggest change I see in your existing code would be to get the $id value (that you are putting into the queries) from a GET parameter on the URL instead of getting it from $_SESSION['id'] and to add the logic necessary to test if or what the current visitor (via his $_SESSION['id'] value) can do or see on any page.
-
You also need to define exactly what you want to happen at each step and what you want your user interface to be. For example, if the current visitor is logged in and is an admin, how do you want to let him pick between editing his own profile or picking one of the other user's profile to edit and how does he go about picking which user to edit?
-
By default, the session id is propagated between pages using a cookie and ALL cookies are domain specific. To do this between different domains, you would need to pass the session id (or any other identifier) on the end of the url as a GET parameter. Since php won't automatically do this for you across domains, you will need to write the code yourself to do this, which will require that any place where you want to switch between domains, that you rewrite your existing scripts to put the session id onto the end of the URL's. Also, by putting the session id (or any other identifier) on the end of the URL, you are opening up a security hole because people have a habit of copy/pasting links to pages they visit and sending that link to someone else would allow that person to visit your site and appear to be the original logged in person.
-
Without listing each table name using a UNION query, there's no way to search through all the tables in a database, so the answer to your question is no, there's no built in way to do this and since you should not be storing same purpose data in separate tables, you should not be wanting to do this anyway.
-
$element->{name-with-minus} being completely ignored
PFMaBiSmAd replied to ukweb's topic in PHP Coding Help
See example #3 at this link - http://us3.php.net/manual/en/simplexml.examples-basic.php -
There's nothing logically wrong with your complete query. If it didn't return the results you expected, either you didn't save the changed code or your didn't upload the changed file to your web server or the results you got where actually correct for the data you have and what you searched for.
-
You need to test and limit the value to a positive number ( a negative number in the LIMIT is an error). It would also help if you formed the query in a php variable so that you could echo the actual query as part of the error checking logic on your query, oops, assuming that you had some error checking logic in your code.
-
You are likely getting a fatal runtime error at the mysql_connect() statement because the mysql extension is not enabled. Are you doing this on a system with error_reporting set to E_ALL (or to a -1) and display_errors set to ON in your master php.ini so that all the errors that php detects will be reported and displayed?