-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
Just use the mysql MONTH() function to get the month number from your existing values. Storing the month separately results in redundant data and breaks the normalization of your table (i.e. if you update any of the dates, you must also waste processing time regenerating the month value.)
-
There is nothing wrong with the first example. It works in FF. If it is not working for you, best guess is you have another radio button with that same name and value somewhere else in your form.
-
mysql query by ID error (upgraded from php4 to php5)
PFMaBiSmAd replied to DarkJamie's topic in PHP Coding Help
The problem is register_globals and has nothing to do with php5. Register_globals were turned OFF BY DEFAULT in April of the year 2002 (php 4.2) because they allow hackers to set session variables by simply putting GET parameters on the end of URL's when they visit a site. Register_globals being on finally generates a depreciated error in php5.3 and they have been completely removed in php6. You need to correct your code so that it works for all php configurations by using the actual source of the external data. In your case $_GET['id'] Edit: All $_POST, $_GET, $_COOKIE, $_FILES, $_SESSION, $_SERVER, and $_ENV... variables that you code is expecting to be copied into program variables would need to be corrected. If you are using session variables with session_register(), session_is_registered(), or session_unregister() functions, you will need to make addition changes in your code in order to remove those functions. -
mysql query by ID error (upgraded from php4 to php5)
PFMaBiSmAd replied to DarkJamie's topic in PHP Coding Help
Where in your second piece of code are you setting the $id variable to a value? -
Did you read the errors? They are telling you why the code does not work - No such file or directory And since the path list in the error /var/www/html/videos/ has nothing to do with code you have been posting in this thread, it will be a little hard for anyone to actually help you until you get your code to match what you are trying to do.
-
When your page contains $target_path = "$_SERVER["DOCUMENT_ROOT"]/upload/"; you are getting a blank page because that is a fatal syntax error and your code is never executed. When learning php, developing php code, or in this case debugging php code, please do it on a server with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will help you by displaying all the errors it detects. You will save a TON of time. Stop and start your server to get any change made to the master php.ini to take effect and confirm the settings afterwards in case the php.ini that you are changing is not the one that php is using. $target_path = $_SERVER["DOCUMENT_ROOT"] . "/upload/";
-
The inner SUBSTRING_INDEX() would need to find the 3rd comma. The outer SUBSTRING_INDEX() would need to go back to the previous \n
-
The screen where you created your database, the database user/password, and assigned that user/password permission to access the database should have also displayed the correct hostname or IP address to use for accessing the correct database server for your hosting account (most larger web hosts have multiple database servers and assign your account a specific one to use.) Edit: also many web hosts require that your database name and username be a combination of your web hosting user name - see this relevant link from the hostgator FAQ section - http://support.hostgator.com/articles/cpanel/how-to-connect-to-the-mysql-database
-
To troubleshoot what your code is actually doing, echo out the values. For example, if $rank is not one of the strings shown, $hourly will be a null value...
-
SELECT name, SUBSTRING_INDEX(SUBSTRING_INDEX(data, '\n', 2),',',-1) + 0 as data FROM tablename HAVING data != 999 ORDER BY data DESC LIMIT 3
-
Which would look like this - SELECT name, SUBSTRING_INDEX(SUBSTRING_INDEX(data, '\n', 2),',',-1) + 0 as data FROM tablename ORDER BY data DESC LIMIT 3
-
You should be able to use two nested mysql SUBSTRING_INDEX() function calls to get the value you are interested in. You would then just need to do an ORDER BY the_value DESC LIMIT 3 If you fix your table design, so that each value is stored as a separate row, you can then easily construct queries to efficiently find any value(s) you want.
-
Umm. The names of your $_REQUEST variables don't match the index names of the $fields array. Edit, also the syntax for the $fields array elements is incorrect so they probably don't exist anyway.
-
Having 24 columns named like that indicates a bad table design. So the answer is yes you can simplify that, by starting with a good table design. And, no you cannot use wild-cards in column names. You must specify each column name individually.
-
Deny, Allow .htaccess Flash Load Possibility?
PFMaBiSmAd replied to drath's topic in Apache HTTP Server
Media, like a SWF file are requested by the browser and the server, well serves (hence the name) those files to the browser for display. You put a link to the media on your page, the page is requested by the browser, the browser then makes a http request for any media on that page. If the media on your page then requests other media from the server, that is just another http request that the server handles from the browser. What exactly are you trying to accomplish? -
It sure would be nice if you showed us the data that was causing your query to fail, but best guess is that it contains SQL special characters that should be escaped before being put into a query so that the syntax of the query is not broken.
-
This is just a guess, but it sounds like the php/mssql client library (the client that php uses to communicate with the database) is not the latest version and is not compatible with the database server.
-
Echo mssql_get_last_message() as part of your error reporting logic to find out any additional information. Is that the only or the first mssql_query() on the page, because -
-
Your query is either failing (due to things like a table name that does not exist, in which case $query will contain a FALSE value) or the query is returning zero rows (in which case mssql_fetch_array() will return a FALSE value and the WHILE() loop will be skipped over.) Real code (code that will tell you when and why it is failing) must test if the query worked ($query is not a FALSE value) and should use mssql_num_rows() to test how many rows were returned before ever executing a WHILE() loop to fetch data from the result set.
-
Yes, but what exactly is it doing? We are not standing right next to you. We only see the information that you post. Are you getting a blank page? One of your error messages from the code? The form just redisplays? A php detected error? Just stating something does not work is useless information, we already know that because you would not be making a post on a help forum if your code was working as expected. The only one here that can actually troubleshoot what your code is doing on your server with your database is YOU. You must show some investigative curiosity and find out what your code is doing. What execution path it is taking, what data values it is testing or using?
-
The code most likely is using short open tags <? and <?=, which was another blunder by php. Who would make multiple different tags the define what php code IS, then make some of them optional/conditional with the ability to turn them off. Php.net itself points out - "It's been recommended for several years that you not use the short tag "short cut" and instead to use the full <?php and ?> tag combination." and that short open tags not be used in code that is intended to be distributed (i.e. sold or posted for others to use) because it results in code that is not portable between different server configurations. I would recommend that you take a few minutes with a programing editor and do a search/replace on all the <? and <?= and convert them to <?php and <?php echo so that the code will work on all server configurations.
-
And does it contain a session_start() statement? And are you learning php, 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 would help you by displaying all the errors it detects?
-
PHP 5.3.1 Apache 2.2.14 - PHPinfo() not working
PFMaBiSmAd replied to warwick's topic in PHP Installation and Configuration
How exactly did you install it and how did you remove the previous version? Is the file with the phpinfo() statement in a folder where your other .php files work at? -
Do while loops are almost never used because they require extra logic to make sure that there is data and to pre-fetch the first piece of data before the start of the loop. If you want help with your code, you will need to post all of it from where the query is being formed through the end of your presentation code that is not working the way you expect it to.