wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
You add the error suppression character at the beginning of the line: @$con->striper();
-
Is there a shorter way of doing if...else statement ?
wildteen88 replied to jd2007's topic in PHP Coding Help
ternary operation is far better if you are only comparing one value. You'd use switch if you are going to be comparing multiple values. -
If you are starting out with MySQL then you can go through the beginner tuorials here which shows you how to use MySQL through the command line.
-
[SOLVED] a problem with "php sessions" and W3C validity.
wildteen88 replied to flunn's topic in PHP Coding Help
The problem is because PHP is adding the following HTML tag into your HTML to transport the Session id: <input type="hidden" name="PHPSESSID" value="fa266b3bf02959848ab2ecb6d4ce1727" /> As you are using XHTML Strict DOCTYPE. The validator is failing because form field tags, such as input and textarea etc must be contained within block level elements. They cannot be on their own. There is a few options you can take: 1. Downgrade from XHTML Strict to XHTML Transitional. XHTML Transitional does not require block level elements to be wrapped around form field tags. 2. If you want to stay XHTML Strict you are going to have change PHP's configuration to only use only cookies and not use any other method to transport the sessions id. However this will break you PHP application if your users doesn't have cookies enabled. -
[SOLVED] Replacing a " , " with a " ' "
wildteen88 replied to AdamShegrud's topic in PHP Coding Help
Change your foreach loop to this: foreach($fields as $a => $b) { // Replace commas with a quote $_REQUEST[$a] = str_replace(',', '\'', $_REQUEST[$a]); $body .= sprintf("%s%s", $_REQUEST[$a], $b); } -
if you are getting a file download screen when you go to a .php file then Apache is not configured correctly. I would recommend you to go through the tutorial Lewis987 suggested in his post earlier here for setting up Apache. There is nothing you can do within your scripts to stop this. It is down to Apache's configuration. Also could you attach your httpd.conf file here so I can how you have Apache configured.
-
Index file not recognized and Includes
wildteen88 replied to zimmandrew's topic in PHP Installation and Configuration
if index.html and index.htm is not working then this leads me to believe that you don't have Indexes enabled within the httpd.conf. To check see if Indexes is listed within the Options directive for the document root, should be around line 190 within the httpd.conf. If its not set with the Options directive append Indexes. You will also want to set up your index files by adding them to the DirectoryIndex as thrope suggested above. After you have made any changes save the httpd.conf and restart Apache. Go back to http://localhost/ and Apache should now be serving index files automatically if the directory you are in actually has an index file. -
Are you sure php is reading the php.ini you are editing. You can check this by running phpinfo() function within a php script then looking for the line that starts with Loaded Configuration File. This line should show the full path to the php.ini PHP is loading for it's configuration. Is the path stated the same path to the php.ini you are editing? NOTE: If you don't get a Loaded Configuration File line then look for a line that starts with Configuration File (php.ini) Path instead.
-
You have some invalid HTML issues, input tags do not have closing tags. So removeclosing tags for inputs (</input>) Also your for loop needs to be this: for($i = 0; $i <= count($info); $i++){ Notice the equals sign added after the the less than sign. With the way you have it PHP will never get to the last item within loop, for example it will only loop 7 times if there was 8 items within the array. Working code: <?php // if page is not submitted to itself echo the form if (!isset($_POST['submit'])) { ?> <html> <head> <title>Personal INFO</title> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> PLEASE CLICK INSIDE OF THE SGW SPY LOG AREA AND PRESS CTRL+A THEN CTRL+C THEN CLICK IN THE TEXT AREA BELOW WHERE IT SAYS "INSERT HERE". <textarea rows="20" cols="20" name="info" wrap="physical">INSERT HERE</textarea><br /> ENTER ID: <INPUT TYPE="TEXT" name="id" value="INPUT ID HERE" /><br /> <input type="submit" value="submit" name="submit" /> </form> <?PHP } else { $info = $_POST['info']; $id = $_POST['id']; $wordChunks = explode(" ", $info); <?php // if page is not submitted to itself echo the form if (!isset($_POST['submit'])) { ?> <html> <head> <title>Personal INFO</title> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> PLEASE CLICK INSIDE OF THE SGW SPY LOG AREA AND PRESS CTRL+A THEN CTRL+C THEN CLICK IN THE TEXT AREA BELOW WHERE IT SAYS "INSERT HERE". <textarea rows="20" cols="20" name="info" wrap="physical">INSERT HERE</textarea><br /> ENTER ID: <INPUT TYPE="TEXT" name="id" value="INPUT ID HERE" /><br /> <input type="submit" value="submit" name="submit" /> </form> <?PHP } else { $info = $_POST['info']; $id = $_POST['id']; $wordChunks = explode(" ", $info); for($i = 0; $i <= count($info); $i++) { echo "Piece $i = $wordChunks[$i] <br />"; } } ?>
-
Why do you want to add admin/includes to the include_path. How come you can't use: include './admin/includes/somefile.php'; if admin/includes is outside of the folder the running script is in then you can use ../ to go up a level in the directory tree. For example say your directory tree is like this: someFolder | +- folderA | | | +--- fileA.php | +- folderB | +--- fileB.php Say you are currently running the script fileA.php but you need to include fileB.php but it is folderB and not folderA. In order to include fileB.php you need to tell PHP to go out side of the current working directory (which is folderA) and to go one level higher in the directory tree (which is someFolder) then to go into FolderB to include fileB.php you do this by adding ../ at the start of the path, eg: include '../folderB/fileB.php'; You can use ../ as many times as you want within the path. Everytime you use ../ PHP goes one level higher in the directory tree.[/code]
-
PHP will not connect to mysql - SYSTEM@localhost issue
wildteen88 replied to barry6628's topic in MySQL Help
Thread Locked. Answer posted here. -
Your php.ini is fine. just tried on my local install of AMP and Apache started up with no errors, however I did modify the extension_dir line from C:/php5/ext (which your path) to C:/Server/php/ext (which is my path). I'm not sure what to suggest. Looks like everything is setup correctly. however for some reason PHP is ignoring the username/password credentials you have set up within the mysql connect function and tying to connect to mysql with the username 'SYSTEM'. EDIT. Oh hang on. It is to do with your php.ini. when I use mysq_connect with my username/password credentials I get the same error as you are getting. However If I swap your php.ini with my php.ini I connect to mysql fine. EDIT2: Ohh! I think I just solved it. You had a setting called sql.safe_mode on within the php.ini. When you enable this setting PHP will ignore any username/password credentials you use with in mysql_connect function and this is why you are getting the error message. Turn that setting off and you shouldn't get that error message again.
-
OK can you post how you configured Apache when you setup PHP. Post the lines you added to the httpd.conf file here. Looks like something is not setup quite right with Apache's configuration.
-
You havn't provided a table name. You have only listed the columns to be updated. UPDATE requires a table name followed by the columns and their values, eg: UPDATE tbl_name ('col1', 'col2', 'col3' etc) VALUES ('value1', 'value2', 'value3' etc)
-
Can you attach - dont copy 'n' paste the contents of the file but attach your php.ini here for me to look at. EDIT: Topic locked. Answer posted here.
-
Have you configured Apache? Apache needs to be configured to parse .php files with the PHP interpreter. ALso make sure you are going to http://locahost/filename.php and not going to File > Open ... within your browser. You must go to http://locahost in order run your php scripts. PHP is a server side language and not a client side language like HTML.
-
MySQL Improved functions (mysqli_) are only available for PHP5 or greater. If your host has PHP4 then you wont be able to use the MySQL Improved functions. Instead you will have to resort to using the standard mysql functions (mysql_*)
-
Values have to be in text/numbers only they cannot hold array values. However what you could do is this: <?php $one = array("this1", "that1", "what1"); echo '<input type="checkbox" name="files[]" id="files" value="' . implode(',', $one) . '">'; ?> That will produde this as the checkbox's value: this1,that1,what1 Then in the processing script that retrieves the checkbox's value you can use explode to put it's value back into an array. Eg: <?php $checkbox1_value_array = explode(',', $_POST['files'][0]); print_r($checkbox1_value_array); ?>
-
You will want to add some code which converts spaces to underscores (_) in the filename of the file. Or use urlencode when you go to fetch the file. Ideally files being served should not have spaces within the filename or filepath.
-
As far as I know there is no setting within the php.ini that limits the amount of characters that can be included within in a include/require statement. Is the javascript being created dynamically by PHP? If it is perhaps there is an error causing your editor to fail. How come you are using PHP to include the javascript? Why cant you include the javascript with html using the script tag.
-
You have added an invalid extension to load: ; For example, on Windows: ; extension="c:/php5/ext/" <<< this line >>> ; ; ... or under UNIX: You don't set up the extension directory path within the the extension= directive you only place the extension file name within that directive, eg php_mysql.dll. Remove or comment out that line above. To comment out place a semi-colon at the beginning of the line. If you want to setup the path for where your php extensions are located to then you'll have to modify the extension_dir directive (located around line 520 within php.ini). You'll want to set the extension_dir directive to the full path to the PHP extension folder, in your case it is C:/php5/ext so extension_dir will be set like this: extension_dir = "C:/php5/ext" Now save your php.ini and restart your web server for the changes to take affect/.
-
Interesting error message! Could you post the parts of the php.ini here that you have modified when you went to enable the sqlite extension. Looks like you have set some thing up incorrectly.
-
If thats the case have a read up on AJAX. Here is an [ur=http://www.ajaxfreaks.com/tutorials/1/0.php]Introduction Tutorial[/url] on AJAX. It still uses ajax but it allows you to call a script in the background. AJAX can also return the results from the processed filed to the HTML page too.
-
Converting n and p to noproblem???
wildteen88 replied to rameshfaj's topic in PHPFreaks.com Website Feedback
Sorry about that we are using a feature called Censor Words it is part of this forum. We have Censor Words setup to change text style speak into full english, eg u into you. I don't think there is any work around for this. For now I will refer you to this thread. The user in that thread had the same issue as your but with different characters. Get in touch with an Admin about this.