-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
In that case, convert the character to match what the data is - $items = explode(utf8_encode('•'), $manyItems); print_r($items);
-
Your original data is Unicode/UTF-8 encoded. Do you want it to be that way or can you convert it to ISO-8859-1 which is what the code that works in this thread is using?
-
The function definition should have been part of the script. If it is not defined, you would need to determine where it was being defined at and determine why that was not working. If you found a script that doesn't even run because of syntax and function definition errors, you have got to ask yourself if spending ANY of your time on it is worth it?
-
Under apache, you modify the httpd.conf file to integrate php with the web server. Installation instructions for all the various combinations - http://us3.php.net/install
-
@Nuv, if you are not even trying to solve the problems in your own code, especially if someone has posted the reason why your code is not working, you are not going to succeed as a programmer.
-
You would NEVER execute a query statement that comes entirely from outside your code, in your case a form, because a hacker will quickly take over your database. Also, since you cannot store a database connection in a session and have it persist between pages, using $_SESSION['con'] is pointless. Your logic is testing if the query executed with or without an error. That is not the same as a query that executes but matches zero rows in your database. You can use mysql_error() to find out why your query is failing.
-
When you have a payment account, you don't modify the stored values, you enter a row for every payment that is made (as a - number) and for every expected payment (as a + number) and to get the current account balance at any point in time, you perform a query to get a sum of the + and - amounts of the rows with dates less-than or equal to the date you are interested in.
-
A) What does a 'view source' in your browser show? B) What's your actual php code, because the symptom is usually due to someone putting in a mysql_fetch_assoc() statement somewhere between their mysql_query() statement and the start of their while(){} loop?
-
mysql_num_rows() expects parameter 1 to be resource
PFMaBiSmAd replied to xxreenaxx1's topic in PHP Coding Help
The error message is self explanatory, the parameter you supplied, $result, to the function is a null. You would need to determine why $result is a null in your code. Best guess, since you didn't post the relevant code prior to the error, is that you don't have a $result variable in your code. -
That is a php error and it generally means that your query failed for some reason, but it could also mean you are using the wrong variable name in your php statements or you are overwriting the php variable that did contain the result resource from the query. What's your actual php code from the line where you are forming the query in the $sql variable through to the line where the mysql_num_rows() statement is at?
-
Accessing Object Value that contains whitespace.
PFMaBiSmAd replied to xamlit's topic in PHP Coding Help
That looks like it is for accessing an attribute, rather than a data value. -
Did you get your "Username not found." message or some other symptom that leads you to believe that the problem is the database/query and not in comparison in the php code?
-
If your php.ini did not already have a line in it to load the mysql.dll that you simply needed to uncomment and restart your web server, then it is likely that the method you used to install php requires that you do something completely different to enable an extension. How exactly did you install php?
-
Accessing Object Value that contains whitespace.
PFMaBiSmAd replied to xamlit's topic in PHP Coding Help
You will probably need some single-quotes as well - -
If you use a date() format string of 'w H:i' you can probably get your code to work. 'D' won't work because you cannot compare the day names directly and 'h' won't work because you must have the same number of digits in each number being compared as a string.
-
Call to a member function stmt_init() on a non-object
PFMaBiSmAd replied to jeppers's topic in PHP Coding Help
The problem is that putting or die() on the end of a new mysqli() statement won't ever die because a new mysqli() statement will always return an object even if the connection fails. You would test if an OOP mysqli connection worked or failed by using mysqli_connect_error() or by using mysqli->connect_error in those versions of php where they fixed the mysqli code to work. Having error_reporting set to E_ALL (or to a -1) would be producing a warning message at the failing new mysqli() statement. Also, by putting the or die() on the end of the new mysqli() statement, the value returned is always converted to a bool(true), even with a successful connection, and the or die() should be removed, even if you don't change the code to use mysqli_connect_error(). -
Kind of depends on what else you are using $page for in your code. If you are putting it into a sql statement without validating it, someone could be injecting sql and reading all the rows in your user table. Or you could be using it to determine a file name to include and someone is using it to include their remote raw php code and they just took over your site. Or you are putting it into some eval()'ed code (part of a template for example) and someone got their raw php code to run on your site and they just took over your site...
-
Because you are echoing $page/$_GET['page'] to the visitor, someone could make a link to your site that contains javascript and if they can get someone who is a member of your site (has cookies/session id cookie to your site) to click on that link, the visitor will be taken to your site and the javascript will send the cookie/session id cookie to the hacker. If you are expecting $_GET['page'] to be a number only, you either need to validate that it is only a number or more simply cast it as an integer to remove any non-numeric part.
-
It's not javascipt. It is part of the browser's user interface and you don't have any access to what choice was selected except via the fact that the file was or was not downloaded from the server.
-
type='Button' doesn't actually cause anything to happen by itself. You would need to use some javascript. In most cases, you should be using type='submit'
-
Yes it is that simple, however you wouldn't put the form in an else{} condition because you would want the ability to redisplay the form if there was a form processing error (without repeating code.) See the following post for how you would generally do this - http://www.phpfreaks.com/forums/index.php?topic=325639.msg1533568#msg1533568 If you have more than one form, you would just add conditional logic to test which submit button is set. Only the form processing code that is within the if(){} conditional test that is TRUE will be executed. The point of programming is to write code that does what you want, when and where you want it. You just write conditional logic so that your code does what you want it to do when the page is requested, either when it is browsed to or when your form(s) submits to it.
-
There's no reason to be using ftp_put and ftp_get as part of an upload/download script ON your server.
-
Your query needs single-quotes around the state = '...' data since it is a string.
-
The filename of the image is in the database and the image is in a folder.