wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
With that I'd expect they might be using mod_rewrite so they'll have a shorter url, eg: The above url might be rewritten as the following url with mod_rewrite: site.php?var1=0&var2=100 Or you could just use $_SERVER['QUERY_STRING'] to get everything after the question mark then use explode to get the separate numbers, eg: list($var1, $var2) = explode(',', $_SERVER['QUERY_STRING']); echo $var1; // 0 echo $var2; // 100
-
In php the path in which everything gets included from is from the parent include (in your case www/index.php). PHP does not include files in which the included file is located to. What I'd do is setup a constant call this contant SITEROOT and set that constant to your websites root folder, eg: define('SITEROOT', $_SERVER['DOCUMENT_ROOT']); Now whenever you go to include a file do: include(SITEROOT . '/path/to/file');
-
What server do you have installed? Is it apache? If so how have you configured apache with PHP?
-
Form Input Data vs. Retrieved from db Data.......
wildteen88 replied to CaseyC1's topic in PHP Coding Help
Looks like you are storing your numbers as strings that is why when you echo $my_price you're getting '1323456' (quotes around the number). How is the form being populated? Post some more code here. -
Error Message with I click Privilidges
wildteen88 replied to Possum's topic in PHP Installation and Configuration
By "you should reload the privileges before you continue" I believe that means reload the user privileges via the database not refresh the privileges page in phpMyAdmin. Try running the following sql query via phpMyAdmin: FLUSH PRIVILEGES; That should make MySQL reload the grant permissions -
Form Input Data vs. Retrieved from db Data.......
wildteen88 replied to CaseyC1's topic in PHP Coding Help
What do you mean by: How does $my_price now contain quotes when you do that? -
Form Input Data vs. Retrieved from db Data.......
wildteen88 replied to CaseyC1's topic in PHP Coding Help
What does the above code output? Specificly this part: $my_price = $row2[my_price]; $markup = $row1[markup]; echo "My price:" .$my_price ."<br>"; echo "Markup:" .$markup ."<br>"; $retail = $my_price * $markup; echo "Retail:" .$retail ."<br>"; -
Form Input Data vs. Retrieved from db Data.......
wildteen88 replied to CaseyC1's topic in PHP Coding Help
post some code so we can see what you are doing. Not quite understanding you at the moment. -
[SOLVED] 2 GET's in the same URL not working...
wildteen88 replied to MasterACE14's topic in PHP Coding Help
Defaults, but is that acid2 way of doing it? When all browsers go acid2 in fifty years will that still work? The acid2 test has nothing to do with how forms are submitted. The acid2 test is just a benchmark for how well browsers support standards. -
use backticks when defining field/table names within your query and not single quotes: mysql_query('CREATE TABLE `'.$_POST['link'].`'( id INT NOT NULL AUTO_INCREMENT, INDEX KEY(id)") or die(mysql_error()); echo "Table Created!";
-
I see you use short tags. Please try to use full tags (as demonstrated by timmah1 above). Using full tags will allow your code to be more cross compatible with other PHP setups. Short tags are not enabled by default.
-
You are sending the wrong content type header for the first link (http://test.hostbox.us/style.css). Your browser is receiving the text/html content type and thus the new lines are not displaying. You will need to send the text/css content type header in order for the browser to display the newlines. How is style.css being routed. Could you explain your setup.
-
I cannot see why you are your code is outputting a ; at the top of the page. You mostly likely have a random ; somewhere within your HTML when your output the table. Run the code again but this time view the source code (View > Source Code) and have a look to see where the ; is within the outputted HTML. That will give an idea of where it is within your PHP code.
-
This line: foreach ($row as $heading=>$column) { which I presume is line 35 is supposed to be: foreach ($row as $heading => $column) { Also it looks like for some reason the HTML has been converted to htmlspecialcars you will need to convert any instances of < to < and > to > in order for your html code to work properly when outputted by the PHP code. Also when posting code please use the code tags ( )
-
[SOLVED] PHP & MYSQL using Windows Vista
wildteen88 replied to itdmacar's topic in PHP Installation and Configuration
What did you do with the file called libmysql.dll? the mysql extension relys on this library if PHP cannot find this file then the mysql extension wont load properly. By default libmysql.dll is located in your PHP installation folder. I'd advise you on adding your PHP folder to PATH environment variable. -
[SOLVED] checkbox works for "unchecked" but not "Checked"
wildteen88 replied to Grant Holmes's topic in PHP Coding Help
Where/when is the above code executed from? I guess this when the data being pulled from the database to populate the form. Web browsers do not submit checkboxes if they where not checked when the form was submitted. You'll only be able to retrieve the value from the checkbox if it was checked. So you cannot update the database based on the checkbox value (checked or no checked). Instead what you should do is see whether the checkbox variable exists, eg $_POST['Active'] and then assign $Active to 0 or 1 weather or not the checkbox variable exists and update the database that way, like so: $Active = (isset($_POST['active'])) ? $_POST['active'] : 0; -
[SOLVED] PHP & MYSQL using Windows Vista
wildteen88 replied to itdmacar's topic in PHP Installation and Configuration
The mysql extension still isn't enabled, did you follow the FAQ I linked to? What have you done so far? -
No need for the php tags just the configuration code. Also the .htaccess has no filename eg: the following is incorrect: filename.htaccess it's just .htaccess When creating this file with Notepad, make sure the File Type pull down menu is set to All Files and not Text Document
-
Well you could place a .htaccess file in that folder to deny access, or just simply place an blank index.html file in that folder so when a user goes directly to Www.sitename.com/grwgwgd all they'll get is a blank page, or if you go the .htaccess route a 403 Forbidden error.
-
PHP has a built in function for returning the keys a value is stored within the array. So need for any loops. Just two function calls max and array_keys: <?php $a = array ( 1, 4, 6, 3, 6, 1, 6 ); echo '<pre>' . print_r($a, true) . '</pre>'; $max = max($a); // get the max value in an array $keys = array_keys($a, $max); // return the keys for the max value echo 'Max value: ' . $max . "<br />\nFound in Keys:<ul>\n<li>" . implode("</li>\n<li>", $keys) . '</li></ul>'; ?>
-
[SOLVED] PHP & MYSQL using Windows Vista
wildteen88 replied to itdmacar's topic in PHP Installation and Configuration
Make sure you have configured PHP to use the mysql extension, by default PHP5 does not come with mysql builtin (like PHP4 did). Also you'll need to enable the display_errors directive within the php.ini in order for PHP to return any errors during runtime, by default this setting is disabled but PHP will log errors via Apaches error log. To see if the mysql extension has been enabled you can run the following simple script: <?php phpinfo(); ?> That will produce a page full of PHPs current configuration/environment. Scroll down and see if you can find a MySQL heading. If you can't find a MySQL heading then the mysql extension is not enabled and thus your code just outputs "a". Please read this FAQ for doing so. -
Wrapping variables in curly braces does have it's uses, curly braces are not just for defining code blocks. Curly braces are normally used when echoing a variable which is an array within a string, eg: echo "$my_arr['some_key'] bla bla bla"; The above code will result in an error, however if you wrapped the variable within braces the code will work fine: echo "{$my_arr['some_key']} bla bla bla";
-
Use: $optedin = (isset($_POST['optedin'])) ? 'YES' : 'NO'; That will set $optedin to YES if $_POST['optedin'] exists (meaning the checkbox has been checked), otherwise it will set it to NO if $_POST['optedin'] does not exist (not checked).
-
You don't open your php files directly from the browser via file > open. Ensure MAMP is running and open your browser and go to http://localhost/ - your go to that url for running your php files, this will invoke MAMP allowing you to run your php files.
-
Checkboxes do not submit a value if they are not checked when a form is submitted. They only send a value when they are. So if you have a checkbox in your form called cbx1 and it was checked thenyou'll be able to use $_POST['cbx1'] variable in the processing script, however if it wasn't checked when the form was submitted then $_POST['cbx1'] will not exist. So you need to do is is check to see if the $_POST['your_checkbox_name_here'] variable exists in your code.