-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
Problem uploading images with Firefox for MAC.
PFMaBiSmAd replied to robjan's topic in PHP Coding Help
You can confirm this by adding the following line of php code to the beginning of your php code in the processing page - die('Processing page reached'); -
Problem uploading images with Firefox for MAC.
PFMaBiSmAd replied to robjan's topic in PHP Coding Help
When the target page of a form submission 'hangs' (i.e. a forever loop or takes a really long time to process), the form page sits there until a connection timeout or a script timeout occurs, because it has not received a complete http response back from the server. Your symptom in the form page is most likely being caused by your form processing page not finishing and sending a complete http response back to the browser. Start by debugging your form processing code. -
Slightly off topic, but when your table and column names are from external data, escaping the values won't prevent sql injection, because the point of escaping string data values is so that you cannot break out of (escape from) single-quotes in the query. Since table and column names (and numerical data values) are not surrounded by single-quotes in the query, the type of sql injection that does not use any quotes in it, can still be used in table and column names (and numerical data values.) If table and column names come from external data, you must validate that they only contain expected and valid table and column names before you put them into the query. ----------------------- As to your database design. Databases are not spreadsheets and trying to treat them as spreadsheets (i.e. finding data among a bunch of empty 'cells' in each row) results in a lot of extra code and complicated, dynamically produced, queries. You need to forget about having same meaning data spread out in a bunch of different tables that only differ in the table name and forget about having a bunch of same meaning columns spread out in a row that only differ in the column name and put each piece of same meaning data into one table, with one row per separate piece of data, so that your queries can easily find the relevant data that you need.
-
Problem uploading images with Firefox for MAC.
PFMaBiSmAd replied to robjan's topic in PHP Coding Help
What type of image and its file size are you trying to upload? And what is your .php logic that detects the image type? The reason I ask this is because different browsers and different versions of any one browser send different mime type for the same file and this is the most common reason why file upload scripts operate unexpectedly for the same uploaded file. -
Since $subscription_type is what is being echoed to produce the output that you see, how could it have "s2member_level4" in it, since that would echo - "s2member_level4: 1 members"?
-
http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_avg
-
If your session.save_path is set to the default \tmp folder, it means that the session settings of all the accounts running on the server will affect your session data files too. The symptom you have described usually occurs when someone sets the session.gc_maxlifetime to a short value in a misguided attempt to get the session handling to log out inactive users. On shared web hosting, you need to make your own folder for the session data files and set the session.save_path setting to point to your own folder. The session.save_path must be set before every session_start statement, so that your session data files will only be stored and referenced in your own folder. If you have the ability to create folders that are outside of your document_root folder (closer to the root of the disk), that is the best place to create this folder. If you only have the ability to create folders inside your document_root folder, you will also need to put a .htaccess file in the folder to prevent all HTTP requests to the files in that folder.
-
force download mp3, not downloading full file.....pls help
PFMaBiSmAd replied to pavelazad's topic in PHP Coding Help
The path/filename you have stored in the database is apparently relative to your document_root folder or perhaps even your banglasong folder. When used directly as the path/filename, the leading slash / refers to the root of the current hard disk. You would either need to make that into an absolute file system path or a path relative to the download.php script. To use an absolute file system path - $file = $_SERVER['DOCUMENT_ROOT'] . $file; // if the stored path/filename starts at your document_root folder $file = $_SERVER['DOCUMENT_ROOT'] . '/banglasong' . $file; // if the stored path/filename starts at your banglasong folder To use a path relative to folder that the download.php file is in - $file = '.' . $file; -
None of the top forum members here would have same meaning data spread out in a load of tables in a database.
-
SQL insert into with mysql_real_escape_string
PFMaBiSmAd replied to a.mlw.walker's topic in PHP Coding Help
And where does the data come from that is being put into the query statement? -
They are storing related (same meaning) data in one table. All user information is stored in a `user` table. All rating information is stored in a `rating` table. All item/product information is stored in a `product` table. They are not storing that information with the user that rated the product. They are storing that information in a table specifically designed to hold rating/vote/view information. Only user information (user_id, user_name, email, hashed password, ...) is in the user table. A table holding information to calculate ratings for something would have columns for - who (the user_id who gave the rating), what (the product_id that the rating is for), when (the datetime of the rating), and the rating that was given.
-
SQL insert into with mysql_real_escape_string
PFMaBiSmAd replied to a.mlw.walker's topic in PHP Coding Help
Echo your $sql variable after you form the query in it. You will probably find that nothing is present after the ' from your form, most likely because your HTML of your form is missing some quotes around a value= '.....' attribute. -
The only way you can do what you are asking is if you fix your database design to store all the users in one table. The reason there is no query statement that can be applied to [all tables] is because that would be extremely inefficient, so the database simply does not support a query like that.
-
SQL insert into with mysql_real_escape_string
PFMaBiSmAd replied to a.mlw.walker's topic in PHP Coding Help
How do you know nothing after the ' is inserted into the database? Have you looked directly in the database table using your favorite database management tool or does this symptom show up when you use php code to retrieve and display the value on a web page? If it is the latter, please post your code responsible for retrieving and displaying the value on a web page. -
force download mp3, not downloading full file.....pls help
PFMaBiSmAd replied to pavelazad's topic in PHP Coding Help
When you open the downloaded file in your programming editor, what do you see? -
Are you doing this on your local development system or on shared web hosting?
-
OK, why not devise a method and test it to either A) remove the region 0 data (hint: unset), B) skip over the region 0 data while looping (hint: if), or C) use a loop that specifically loops over just regions 1-5 (hint: for)? OK, why not devise a method and test it to detect the condition that represents the s2member_level4 in the data and skip over displaying those values(hint: if)? To get from "I want"/"I need" in programming to a working result is what programming is all about. Define something you want to happen, then devise (and test) code to do that. Repeat as needed until you are done. Listing the "I want"/"I need" is just the first step. It's up to you to attempt the rest of the steps.
-
Look at what you are setting $target to - '/Uploads' The file is in the root of your hard disk with the file name 'Uploads'.
-
Error in Code, going to white screen and not redirecting
PFMaBiSmAd replied to snowdog's topic in PHP Coding Help
You have a fatal php parse error on line 41. You need to have php's error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will report and display all the errors it detects. You will save a TON of time. I didn't mention what the error message is or what is causing it (it is actually fairly obvious to find when you know the general area in the code to start looking), because learning to find and fix errors in programming is as important a skill to have as being able to write code. -
For the code in your last post, you will know that any rows the query matched will have address = '$address'. You don't need further code to test if this is so (you do need code to test if the query matched any rows.) Zero matching rows means $address was not found for that user_id. One or more matching rows means $address was found for that user_id. In your previous code, the $value = (in_array("", $arr)); statement makes no sense. in_array tests if the first parameter is found in the $arr and returns a bool true/false. In that statement, if there was an element with an empty string for a value in the array, $value would be a TRUE, otherwise $value will be a FALSE. You cannot then test if $address == $value because they don't contain the same type of values. The correct logic, assuming you had an actual reason to do it this way, instead of directly in a query, would have been if(in_array($address,$arr)){
-
This is something I just posted earlier today, modified to match what you are apparently doing - You would never select a bunch of rows from a table (unless you wanted to display all the matching rows at once from your table) and then use php to loop through them trying to find if a value exists. Php is a relatively slow parsed, tokenized, and interpreted language. The database engine uses compiled code to perform searches and is significantly faster at finding and filtering information than using php code. A generic answer to your question would be to add a term to the WHERE clause in your query to match row(s) that have $planet_id for a value. If you only need to know if a match was found, you can use mysql's COUNT() function in the query or if you actually need the matching row(s) of data, you can use use mysql_num_rows() to find how many row(s) are in the result set.
-
explode produces an array from a string. That's NOT what you want, because there is no mysql query statement in existence that understands a php array variable.
-
While the suggested method is OK, the specific syntax is not - http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#function_in The IN() comparison takes a comma separate list of numbers (or strings), not an array.
-
If Statement inside While statements...I think
PFMaBiSmAd replied to sonphish's topic in PHP Coding Help
Your goal is to get the query to return the data you want in the order that you want it. To produce your output, where you have headings/subheadings for the date and times, you would remember the 'last_heading' and 'last_subheading' (initialized to some value that will never appear as data, such as a null value.) Then as you iterate over the result set, you would detect when the heading and subheading changes, output the new heading/subheading, and save the new heading/subheading values for the next comparison. See the following logic for an example of how to do this - http://www.phpfreaks.com/forums/index.php?topic=349740.msg1650897#msg1650897 As to your separate DATES and TIME tables. Unless you are specifically doing this exercise to learn joins, I would not do that. Dates and times are final/literal data values. You should store the DATETIME of each event in a DATETIME column in the events table. Edit: You will probably want to split and format the DATETIME into separate date and time values, with the final format you have shown, directly in the query so that the query will return separate values that can be used in the 'last_heading' and 'last_subheading' logic. -
Those are table aliases to save some typing in the query statement. They don't have any meaning outside the query.