Jump to content

bsmither

Members
  • Posts

    213
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by bsmither

  1. My experiment confirms Philip. I am running PHP 5.3.5.
  2. Allow me to start by asking if intended for the array values to be constants? Please perform an experiment where the keys and values are quoted, and the elements are properly separated by commas, and that you are properly declaring $a and $b as array(). I gather what you have posted above is a plain-text approximation of what the arrays contain - not syntactically correct PHP statements.
  3. I think CONCAT() is incremental. That is to say: CONCAT(Nom, " ", Cognoms)
  4. "Your search - xyz - did not match any documents." In your browser, did you enter the address into the address field, or the search field? This address: localhost/phpacademy/MySQLi/Video 6_9/index_7.php?first_name=whatever From this, I will assume you copied the PHP-Academy tutorial directly into the www folder of your WAMP installation? Although it seems to work, Video 6_9 is sometimes not valid as part of the path to a document -- there is a space. But since it seems to work, we can ignore it for now.
  5. I also don't like this part of the SQL query: INTO people(first_name, I like to have plenty of spaces between the various parts of the query, and use backticks appropriately: INTO `people` (`first_name`, The way the statement looks now, people() might be seen as a function.
  6. Within quotes, PHP will expand variables. $_GET is a variable, and PHP will try to show it's contents - but can't because it is an array. Within apostrophes, PHP will not expand variables. So, the line might work better as: exit('$_GET not SET - '.print_r($_GET,true));
  7. A basic web form will POST the form element name (key) and the user entered data (value) back to the form's action attribute. To get a form to submit data via the querystring (so that the script will use $_GET -- if you insist), the form's method attribute must be 'get' (although this might be the browser's default action).
  8. $sql = ('INSERT INTO `'.$_SESSION["use"][0].'` (ID,Amic) VALUES (`'.$_SESSION["person"][0].'`, `"1"`)'); 1. I believe surrounding the entire right side of the equal sign is not necessary. 2. Backticks are used only to "quote" (bad term) database names, table names, and column names - never values.
  9. I found references to the task by Googling: display pdf in flash player
  10. You could try the Flash Player approach. The PDF will need to be converted to a Flash-compatible file.
  11. Usually, the message: Access denied for user 'asdasd'@'localhost' (using password: YES) means that, even though a password is being supplied, the problem is... * the username is not recognized by the database server * the password is not recognized by the database server * the database being connected to does not have permission to let this user access it as per the database server * the database server has been told to only allow this user access from a particular computer, other than localhost
  12. I am not at all sure the ternary format is conducive to making statements (sorry, I don't have the terminology to name this type of statement). As best I know, the ternary format is supposed to return a value from two expressions, one for true and one for false, and assign it to a variable, or to use it 'in-line'. So, this, define('DS', DIRECTORY_SEPARATOR), doesn't evaluate to anything. It certainly does something, but is doing something in this context the same as making a result available for use. (I've seen some weird statement formulations, especially with the for() parameters, so this may be perfectly legitimate.) But I have my doubts. So, I would experiment with: if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
  13. "$_POST ['b_first'] $_POST ['b_last']" ------ ----------- ------ ---------- $_POST is certainly the name of an array variable. The fact that the brackets are disconnected from the variable name makes the brackets a literal string. Hence, they show in the email. So, let's look at this: " $_POST['b_first'] $_POST['b_last'] \n"; ----------------- ---------------- $_POST is certainly the name of an array variable, but can PHP accurately determine if the brackets belong to the variable? Since there is some doubt, we may wish to force the issue and try one of two alternatives: " ".$_POST['b_first']." ".$_POST['b_last']." \n"; This concatenates literal strings with stand-alone variables. Guaranteed to work. " {$_POST['b_first']} {$_POST['b_last']} \n"; This encapsulates the entirety of the variable expression in braces. This may work.
  14. " 8 types of fruits and 8 types of electronic gadgets and you just want to know the total number of count of each item" Can we assume that for each of the 16 types/categories of items, they can be grouped by a distinct identifier? Such that: SELECT COUNT(*) AS `count` FROM `table` WHERE `condition` = 'x' SELECT COUNT(*) AS `count` FROM `table` WHERE `condition` = 'y' SELECT COUNT(*) AS `count` FROM `table` WHERE `condition` = 'z' Can this be grouped such as: SELECT COUNT(`condition`) FROM `table` GROUP BY `condition` (Hope I got that right.)
  15. In the application I am very familiar with, it uses a cache. It will MD5 the query to use as a filename, serialize/base64_encode the resultset as the file contents, then save it. Assuming the database contents don't change all that frequently, the code that would send this query to the database can MD5 the query, do a file_exists() test, and if it's in the cache, re-use that resultset.
  16. Ah! I think the database is returning strings instead of floats. So, the line might work better as: $price[] = (float)$row['krl'];
  17. I don't know PHPChart, but... Maybe because $price is already an array? You are sending an array, of which the only element is the array $price, into the class.
  18. You are assembling <td>'s based on a $row loop. Perhaps you mean to use the $column parameter. Then you can use the $row parameter to have an outer loop that makes $row number of <tr> rows.
  19. I have seen several versions of several browsers be able to detect and internally fix non-serious syntactical errors: <tag attr1="val1"attr2="val2" /> where there is a missing space <tag><nest1></nest1><nest2></tag> where there are open tags When I ask FF to show me the source code, the display will put in bold red things like the above. So, perhaps some browsers would recognize the start of another tag and internally finish the input tag. Or, ignore the less-than-a sequence, treat the href attribute as inconsequential (to be identified by a javascript selector, perhaps), and also ignore the close anchor tag (But that would show in FF's source code view.)
  20. Using global $db is one way. Another way I see often (and confused me because I didn't realize what was going on) is to realize that variables assigned in the global scope can be reached via the $GLOBALS['db'] super-variable. You may want to initially use $GLOBALS['db'] = new PDO().
  21. What are the practical differences between PHPX.Y.Z's source download release, qa release, and snapshot release? I am trying to build my own PHP from source on Windows Server 2008 using Visual Studio 2013. I get to a point in the process as outlined in a step-by-step narrative where I am suppose to choose all my options, but the option to have the FPM enabled isn't in the list - but the folder is there. Is there a specific source variant that gives me everything - and I mean everything! - so I will get the FPM anyway - without the gnashing of teeth caused by having no instruction on what to do when something slightly different is needed than what the narrative lays out.
  22. Please observe how you are using $_SESSION('uid') as the name of a function, rather than the name of an array variable.
  23. This seems to be concatenating three apparent strings to one string. $dob = $dob_day . '' . $dob_month . '' . $dob_year; Then you are using $dob[0], $dob[1], $dob[2] as an array.
  24. There is also Google Charts, which is javascript based. Once the javascript chart is up and running in the browser (with your data), there are some nifty things you can do with it.
  25. I know of two approaches to solve this. At the end of cart_update.php, have: * this statement: include /{full path to store code}/index.php; * or this statement: header(location: /index.php ); The first saves a request by the browser, but the browser sees the incoming page as belonging to the last URL used. The second allows for the code to retain important parts of the querystring, if needed, from the POSTed URL.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.