-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
#include ("Connections.php"); The # makes that line a comment and it is not including anything at all.
-
update page not updating checkboxes or radio buttons?!
PFMaBiSmAd replied to jarv's topic in PHP Coding Help
For debugging purposes, add the following at the start of your form processing code in order to see exactly what you are receiving from the form - echo "<pre>"; echo "POST:"; print_r($_POST); echo "</pre>"; -
Getting posted values using $var not $_POST['var']
PFMaBiSmAd replied to ruski's topic in PHP Coding Help
register_globals have been complete removed in php6, so you will need to correct your code before it will work under php6. register_globals being on also allow hackers to set session variables by simply putting same name GET parameters on the end of the URL when they visit your pages. -
You always want error_reporting to be at least E_ALL (so that you can log all errors, such as when a legitimate visitor (or a hacker) feeds your code unexpected data that your validation logic does not catch.) However, on a development system, you want display_errors to be ON and on a live server you want display_errors to be OFF and you want log_errors to be ON. For your actual error checking, error reporting, and error recovery logic in your code, in its' most basic form - if($result = mysql_query($query)){ // the query executed without error and returned a result resource (SELECT, SHOW, DESCRIBE, EXPLAIN, ... query) or a TRUE value (INSERT, UPDATE, DELETE, DROP, ... query) // your code to process the results of the query here ... } else { // the query failed to execute and returned a FALSE value, usually a syntax error or a problem with the database/table // code to execute when the query failed with an error ... // do any application level error reporting/logging - $application_message = "Query failed: $query<br />Mysql error: " . mysql_error(); // produce message trigger_error($application_message,E_USER_NOTICE); // trigger a NOTICE level error and optionally output/log (depending on error_reporting/display_errors/log_errors settings) // output a user error message echo "Due to an error, the application cannot access data at this time<br />"; } // the remainder of the code on your page that is not dependent on the above query working or not working ... Edit: You should set any error_reporting, display_errors, and log_errors settings globally in the master php.ini, a .htaccess file, or a local php.ini so that you don't need to waste your time continually altering your source code to change the settings in them. Those cases where you see us recommend adding lines to scripts to set those settings are for the "my code is not working and it is not telling me why" posts where it is likely the OP is trying to debug some basic code problems (not finished working code put on to a live server) on a server where those settings are not set to give any immediate feedback.
-
You have not exactly provided any information about why the GROUP_CONCAT() output is not what you expect. For all we can tell, all you really need to do is use a a different SEPARATOR character (a space or a tab) instead of a comma.
-
Do some debugging, display all php detected errors. Temporarily add the following two lines of code immediately after your first opening <?php tag - ini_set("display_errors", "1"); error_reporting(E_ALL); What does the ['error'] element of the $_FILES array show? Any upload errors?
-
You are doing a cross-join of logins and users. If there are corresponding rows in each table, you will get two rows in your result set, not one. When you are echoing $count what do you get and why are you even using the logins table in that query?
-
PHP login form help (Done Most of It)
PFMaBiSmAd replied to lewisstevens1's topic in PHP Coding Help
3rd method - $rs_duplicates = mysql_query("select id from users where user_email='{$_POST['email']}'"); -
PHP login form help (Done Most of It)
PFMaBiSmAd replied to lewisstevens1's topic in PHP Coding Help
The two different syntaxes are equivalent and they are both valid. -
The host name part of the URL is probably www. when you first visit the page, but your redirect just goes to yourdomain.com (without the www.) and the session.cookie_domain setting is not set to match both versions of yourdomain. You either need to set session.cookie_domain (before every session_start) to .yourdomain.com (with the leading dot as part of the setting) or you need to set up your web server so that it always redirects requests to the www. version of yourdomain.
-
See this mysql function - http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat
-
Again - What trigger_error() outputs (by default an E_USER_NOTICE) is dependent on the error_reporting/display_errors/log_errors settings and on a majority of the systems people are using while trying to debug code, it won't output anything and its' use must also include instructions on setting error_reporting/display_errors/log_errors settings.
-
PHP login form help (Done Most of It)
PFMaBiSmAd replied to lewisstevens1's topic in PHP Coding Help
Your query is not matching any row(s) in your table ($num is equal to zero, but your query did execuite without any errors.) You are going to need to find out why it did not match any row(s.) Echo the $sql variable so that you know exactly what it contains. Look directly in your table using your favorite database management tool and check if there is a row that should match the values that are in the WHERE clause in the query. -
If you have no actual characters in the file before the <?php tag, then your file has been saved as a UTF-8 encoded file and the BOM (Byte Order Mark) characters that your editor put at the start of the file is the output. Either save your file as an ANSI/ASCII file or if you must save it as a UTF-8 encoded file, save it without the BOM characters.
-
Posting variables between pages without a form
PFMaBiSmAd replied to nvee's topic in PHP Coding Help
You have at two functional problems by using a page for the form and another page for the form processing. You must pass any errors from the form processing page back to the form and you must pass any entered data back so that you can populate the fields (assuming you don't want to make the visitor keep re-entering everything.) The best choice to pass this information between two pages is to use session variables. -
Array comparisons with MySQL array and a php variable
PFMaBiSmAd replied to danp's topic in PHP Coding Help
1) A call to mysql_fetch_assoc() fetches ONE row from the result set. 2) Since your query is only selecting id, $idchecky will be an array with one element $idchecky['id'] that will contain whatever your id column consists of for the specific owner = that matched the WHERE clause. What exactly does the data in your table look like (post at least two rows that should match a specific owner.) One of the great points of using a database is you only retrieve the information you are interested in. If you find yourself looping through the result of a query searing for a value, you are not using the database effectively. If you only want the row(s) that have a specific value, such as id = $this_id, then you would include that comparison in the WHERE clause in the query. -
That line was in your first post, until you edited it.
-
After you fix the typo in $backcollor on line 6, it works for me. You should be developing php code and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will help you find things like that.
-
The mysql date_format() function is at least a hundred times faster then using php code (comparing the incremental increase in the time for the query with a date_format() with the time it takes php code to do the same amount of work.) You are already executing a query to retrieve the data, why not get the database engine to give you the data in the format that you want it?
-
You need to add - GROUP BY Clients.ClientID
-
email isnt getting through to some sites like hotmail.
PFMaBiSmAd replied to seany123's topic in PHP Coding Help
Is the actual email address for [email protected] a real mail box hosted at the sending mail server? It it is not, that is the reason it is being discarded by hotmail/msn and being voted as spam/junk by the other ISPs or are you are putting in an @hotmail.com or @msn.com From: email address and you are not sending it from a hotmail/msn mail server, then it WILL be discarded by the receiving hotmail/msn mail server. -
For debugging purposes, add the following two lines of code immediately after the first opening <?php tag and temporarily comment out the header() and imagejpeg() statements - ini_set("display_errors", "1"); error_reporting(E_ALL); I see three possible problems - 1) You are not defining $rootPath 2) You are using a \\ as a path separator, which on a UNIX/LINUX operating system has no meaning. You should always use / as a path separator (under Windows, php converts it to a \ before it passes it to the operating system.) 3) Under UNIX/LINUX, you generally must use an absolute file system path for the font files. There are about a half dozen more possible problems which the error_reporting/display_errors lines should uncover.