-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
Perhaps you are trying to write a function? You cannot just put lines of code inside of a class definition. Code would need to be inside of a method/function definition inside of a class definition.
-
increasing letter by one letter then wrap over again to A
PFMaBiSmAd replied to flemingmike's topic in PHP Coding Help
Is there some reason you keep starting new threads for the same problem? That just throws away previous information about what you are doing and responses you have already gotten. -
This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=310983.0
-
No, the built in auto-increment works for integers or floating point values only. And since this a mysql question, moving thread to that forum section...
-
So confused why this is happening to login
PFMaBiSmAd replied to adamlacombe's topic in PHP Coding Help
I doubt the posted code is ALL the relevant code that is being executed by or due to your while(){} loop code. The only ways that code execution could be causing the symptom is - 1) Your code is setting the $_SESSION variables directly. 2) Register_globals are on (they were turned off by default over 8 years ago) and you are setting a program variable that has the same name as one of your session variables. Edit: Another possibility is you have a header() redirect either in or affected by the while(){} loop code and you don't have an exit; statement after the redirect and some code after the header() is altering the $_SESSION variables. -
You can always use the error_log function to write information from your script to an error log file of your choice. Edit: If you are using ajax for this, you should also be using ajax to display any status/error information that your php code sends out to the browser.
-
There nothing special about the $_POST variables. You can write your own values to them, so you don't have to do 1, 2, or 3 in your list if you don't want to. If you are going to be making multiple references to a variable during specific processing of it, it does save a little typing to make a copy of a $_POST variable into a regular program viable. However, be careful of any use of variable variables or extract to blindly create program variables from ALL the $_POST variables as that will allow a hacker to set any of your existing program variables to any value he wants, so it is possible to screw up the execution of your code. If you use variable variables/extract like this, you should always prepend a prefix name to the variables so that they cannot overwrite any of your existing program variables.
-
echo mysql_error(); on the next line after the line with your msyql_query() statement to see if there are any query errors. There is a maximum packet size for any query that you are likely exceeding (all the more reason to NOT store files in a database.)
-
I've got to ask if you understand the basic client(browser)/server relationship that is going on and what the flow of information is in this process? The browser makes a HTTP request for a web page, lets say your index page with the HTML of your form on it. If your form happens to contain hidden form field(s), they are part of the HTML that makes up that form and they are output to the browser. The web server simply outputs the requested page. The web server then goes on to service other HTTP requests. It is not sitting there expecting your form or any other form to be submitted and in fact it does not know or care that the page that it just output contains a form at all. The browser renders the HTML/CSS/Javascript on that page. At this point in time, you have a form in front of you (well assuming that your HTML/CSS was valid and that if there is any javascript that javascript is enabled in the browser.) When (or if) you finally submit that form, the browser makes a HTTP request to the URL that is in the action="" attribute. As part of that HTTP request, the browser sends the form field name/values to the server. If the form happened to contain hidden form fields when it was originally output, those hidden fields are sent to the server as well. When the page that is in the action="" attribute of the form is requested, the form field name/values that were submitted are available to it and it can do whatever it wants or needs to do when it processes that data. The action="" attribute can be anything you want. It can be empty or not present and the form will submit to the same URL as the page the form is on (the form and the form processing code is on the same page.) It can be for a different page on your server (the form and the form processing code are on separate pages on your server.) It can even be to a page on a completely different server.
-
Sorry to be blunt, but every php/mysql book or basic php/mysql tutorial shows how to retrieve multiple rows from a query. You are asking something that is very basic, so it would seem that you have not bothered to learn the basic information that you need to know before you are attempting to do this with your data. (Before you can write a book, you must know how to write at all.) If you take the time to learn some of the basic php/mysql programming information, you can produce working code at least 10 times faster than if you just try things you might have seen without knowing what they mean or what each line of code actually does. A basic php/mysql tutorial that executes a query and iterates over all the rows that it returns - http://w3schools.com/php/php_mysql_select.asp
-
You are going to find that posting your code in the thread is about the only way that someone here is going to look at it.
-
That scheme serves to check that someone's browser or something (a bot script) visited (requested) your form page at least once and supports passing the session id between pages. That's all it really can check. The session variable should be unset in the form processing code so that only one submission will be processed per visit to the form and the hashed value should be randomly generated and not a fixed/static value. If the hash value is fixed/static for any one visitor, once someone gets that value by actually visiting your form, they can keep using it to submit data and that scheme would consider all the submissions to be valid. If the randomly produced hash was also displayed in the form in the form of a captcha image, the scheme would also require that someone/something has the ability to read the image and submit the value as form data.
-
After you use file(), you could use in_array() to find if there is a match.
-
http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#function_in
-
MySQL & Header Re-direct URGENT HELP PLEASE!
PFMaBiSmAd replied to BCAV_WEB's topic in PHP Coding Help
And it adds more processing/overhead to each page and more importantly consumes memory that could push a large program over the limit of available memory. It also delays the output of the HTML to the browser, so the browser must wait to start rendering a page when it could already be processing elements on the page. You should only use output buffering if you want to buffer output, not to mask errors (it will also mask php error messages that are output to the browser when you then do a redirect, so it also hinders troubleshooting.) -
That would be !isset()
-
Use isset to test the $_SESSION variable. It won't produce an error when the variable does not exist.
-
Do you normally enter a DNS name, such as mysql.somedomain.com as the host name? Try that as well. And posting whole error messages helps about ten times more than posting your interpretation of what the error message is. xxxxx out any information in the error you don't want to show.
-
What happened when you tried the IP address of the mysql server?
-
This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=310908.0
-
MySQL & Header Re-direct URGENT HELP PLEASE!
PFMaBiSmAd replied to BCAV_WEB's topic in PHP Coding Help
Based on where the output is being reported at by the error message and that there are not 10 lines of code in dbconnect.php, you likely have characters after the closing ?> tag in the file and they should be removed as they are content that is being output to the browser. And since this is not a mysql problem, moving thread to the php help forum section... -
Based on the information you provided in the first post - $array = array(); $array['one'] = "Blah"; $array['two'] = "Blah Again"; If you provide more complete information about where and what you are getting or setting values, someone could provide a more complete example.
-
MySQL & Header Re-direct URGENT HELP PLEASE!
PFMaBiSmAd replied to BCAV_WEB's topic in PHP Coding Help
Add the following two lines of code between the <?php tag and the session_start() statement in loginaction.php - ini_set("display_errors", "1"); error_reporting(E_ALL); -
Just use an array (arrays are for sets/series of related data values.)
-
If you echo mysql_error(); it will tell you why the query failed.