-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
Unless you post your code in the forum, using the forum's bbcode tags, you won't get much response. You will find that most people won't visit links you put in your post, nor will they download and open .zip files.
-
Some pages show results and some don't for the same code
PFMaBiSmAd replied to Gotharious's topic in PHP Coding Help
You have single-quotes ' ' around your `left` column name in your queries (both in the query that doesn't work and you even have them around the order by column name in the query that does work). That makes them string data. You need to use back-ticks `` not single-quotes ' ' around column names that happen to be mysql keywords. You also have an or die(mysql_error()) on the end of a mysql_fetch_array() statement. Mysql_fetch_array doesn't set mysql_error, so all that will do is stop your code with no output when there are no rows to fetch. The or die(mysql_error()) should be on the end of your mysql_query() statement. -
how to resend data from action to form page?
PFMaBiSmAd replied to prakki79's topic in PHP Coding Help
or you could put the form and the form processing code on the same page. -
How exactly did you notice that, because the method used could be giving you false information or could be converting the value.
-
Here are a couple of wild guess. You have some invalid/empty link for an external css/javascript file or for a media file (image/movie/audio) on your page or IE trying to request a favicon.ico file and when an IE browser requests it while trying to render your index page, you get those errors, whereas other browsers either don't make the request at all or the request that they do make points to a valid file. It could also be related to url rewriting or how your host has added your domain that is broken for the request IE browsers make for your main page that causes two requests, the first one resulting in the error/error page, followed by a request for your index page that you finally see in the browser. I would make sure that your page is valid HTML/CSS at validator.w3.org and http://jigsaw.w3.org/css-validator/ and either temporarily disable all url rewriting or disable each one in turn to see if that affects the problem. You could also post your .htaccess file so that someone could see and/or test if it is doing something that causes this with IE browsers.
-
A) You can use glob to get just a list of files you want glob("frm_*.php");. You would then simply iterate over the array that glob returns and include the files. B) You likely have a fatal parse or runtime error in the code being included. Do you have error_reporting set to E_ALL and display_errors set to on so that php will help you by reporting and displaying all the errors it detects in your code?
-
2 questions based on a remember form details
PFMaBiSmAd replied to j.smith1981's topic in PHP Coding Help
For a 'remember me' feature, you should NOT store the actual userid/username/password in cookies. Anyone with physical or electronic access to the computer data can get the actual userid/username and password and then could log in as that person, every place that person used that same username/password. To identify who someone is (but not if they are logged in), you would generate a unique and hard to guess value and store this in the cookie and store it in the row in the user table for that person. You would then use that value from the cookie to get the actual userid/username (and logged in state) from the user table to store in session variables when they come to your site. If you search the forum for 'uniqid' under my forum's username, you will find several posts concerning this. For a more sophisticated log in system like this (with a remember me feature), you should also store the logged in/logged out state in the row in the user table for that person and test it on every page request so that if the person does log out or you log them out automatically after a period of inactivity, just having and supplying a matching unique id value in a cookie does not consider the visitor to be logged in, they must supply the username/password to become logged in. -
$ATC_itemDescription = $row_productos_RS['color_'.$_SESSION['session_idioma']];
-
In database terminology, there are rows and there are columns/fields. Columns and fields are the same thing and are interchangeable names that refer to the columns/fields that exist in a table. Think of rows going down the page and columns/fields going across the page. Also, you don't alter your table structure to get your columns/fields or rows to be in a particular order, you do that in your query. I'm guessing that your example actually refers to the value in different rows. To get a result set to be in any particular order, you would use an ORDER BY some_column term in your query.
-
I happen to know the person who posted the starting basis of that code, and he wants to know how come you swapped "$date|$time" to be "$time|$date", especially since that is why you are only getting the time part of the result.
-
PHP Add Values in Rows and Separate By Month
PFMaBiSmAd replied to ryanfilard's topic in PHP Coding Help
You would do this in your query by using SUM(views) to add up the numbers and use GROUP BY EXTRACT(YEAR_MONTH FROM your_date_column) to form groups of rows for each year/month period. You should also probably select YEAR(your_date_column) and MONTH(your_date_column) so that you get those two values with the data so that you can detect which year and month the data belongs with as you iterate over the result of the query. Edit: or you might want to use DATE_FORMAT(your_date_column,'%b') to get the abbreviated month name instead of MONTH(your_date_column). -
But you do - output started at /home/content/03/8587103/html/pinkpanthers/pinkpanthers.php:1 (line 1), otherwise that error would not be occurring. You either have something in your file on line one, before the <?php tag or like that sticky post states, you have BOM (Byte Order Mark) characters as part of the file and they are being output.
-
And is the code you posted all in the same program 'scope'?
-
You would use an array, with the key being the color name, to count each occurrence in the data - <?php $counts = array(); // initialize before the start of your loops ... // inside the loop - if(isset($counts[$Colors->Color])){ $counts[$Colors->Color]++; } else { $counts[$Colors->Color] = 1; }
-
Bit confused about getting current "row" and data from previous row?
PFMaBiSmAd replied to gibbonuk's topic in MySQL Help
You would simply store (in a variable $last_num) the current value as the last value (after you have used the previous last value.) Which beings up the question, what do you want the 'last value' to initially be the first time through the loop for the first row of data? You could also do this after the data is stored in the first array by looping over the elements of the array and assessing the current key and the current key - 1 to get the previous value. -
LIKE query works for number but not for character
PFMaBiSmAd replied to elabuwa's topic in MySQL Help
Are you sure you don't have a white-space/non-printing character before the 'a' in the data? You would need to dump the database record that you think the query should match and examine it to make sure that all the data is actually what you think. The uid, account, or type might not actually be what the query is trying to find. -
Bit confused about getting current "row" and data from previous row?
PFMaBiSmAd replied to gibbonuk's topic in MySQL Help
Without an example showing what data you have and what result you want, it's not really possible to provide an answer. Do you want to add up all the numbers? Do you want to add up each consecutive pair of numbers? Do you want to add up all the numbers up to that point? -
^^^ I hope you are not using that, because if you browse to the .inc file, you can see the username and password. You need to use a .php file so that the php code defining the username/password will not be literally output if someone browses to the file.
-
Producing even a blank page is something and is a symptom that helps point to the cause of the problem. What exactly occurs in front of you when you try it? And if you do get a blank page, what does the 'view source' in your browser show? Do you have php's error_reporting set to E_ALL and display_errors set to ON so that php would report and display any errors it detects? Beyond that, you would need to post the code so that someone could see what it is doing that might be server or server configuration specific.
-
You need to use mysqli_stmt_init http://us3.php.net/manual/en/mysqli.stmt-init.php to create a statement object that you use with all the other related functions. There's an example in the mysqli_stmt_prepare documentation - http://us3.php.net/manual/en/mysqli-stmt.prepare.php
-
You are not setting the 4th parameter in the setcookie statement to '/', so the cookie only matches the path where it was set at. I'm pretty sure this is mentioned in the setcookie documentation - setcookie
-
As already stated, you can only define a function name once. I'm going to guess that you also have other function names that are redefined between these included files, but you are only seeing the error for the build() function because it is a fatal runtime error and the code never gets around to redefining the other functions in the files. If you must include more than one of your files at the same time, your current scheme won't work (there's no way to un-define a function and functions have global scope) and your code will need to be rewritten to either use unique names for the functions or use unique class names (you already have unique file names with unique code in each file) or do what requinix suggested and eliminate the build() function definitions. However, based on the minimal information you actually provided ($devModel, $devVendor), your system definition is flawed. You should be manipulating different sets of data using one set of code, not a different set of code for each model/vendor or if your code/variables in each file are really unique, separate, and useful, you should be using classes (with unique names) instead of functions/variables. You better start modifying those files if you have 40-50 of them to do or since you will need to change what you are doing to get it to work at all, you could post an actual example of what you are doing and someone might suggest a workable system to use. Didn't someone prototype a test case and try this scheme before forging ahead with making an entire untested and unworkable system of code?
-
Form Post - Posting Invalid information
PFMaBiSmAd replied to stublackett's topic in PHP Coding Help
The problem is the explode using '='. When the data contains any = characters, you loose them. I recommend using parse_str The following should be equivalent to your code (replace the split() statement and the foreach(){} loop) - <?php $result = substr($result,1); // remove the first character '?' parse_str($result, $result_arr); // break apart the string on any name=value pairs -
Is the logic inside each of these build() functions the same, with only different data values or is the logic completely different? If the build() function logic is different in each file, unless you use namespaces, you are going to need to uniquely name each function. To get help with what you are doing, you are going to need to post at least two examples of the build() functions you are including and I can just about guarantee that you are going to need to change the structure of the code no matter what you do to solve this.