wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
Because that is what you are telling it do. The += adds whats on the right to the end of whats on the left. So its always going to add [nobbc]<br>[/nobbc] on to the end of whats in you textarea If you want to get javascript to add [nobbc]<br>[/nobbc] where your curser is, then it'll be a bit more advanced as you'll have to use javascript find out where the curser is located to and then get it to add br tag in that location. Also whay are you adding br tag into a textarea anyway? If its to preserver line breaks. Dont bother just use the nl2br PHP function to preserve the line breaks.
-
Use this: [code=php:0]$a_status = '<form action="' . $_SERVER['PHP_SELF']; . '" method="post" name="form1" id="form1"> ';[/code]
-
Did you write that code or did someone else write that script for you? If someone else wrote, it'll be best if you ask them. If you wrote then surely you must know. But anyway. For this: [code=php:0]$file_dir = "what i write here ?";[/code] You need to put the absoulute path to where the file being uploaded will go to. For example if you want the uploaded files to go to a folder called images which is in your document root folder, you'll use this: [code=php:0]$file_dir = $_SERVER['DOCUMENT_ROOT'] . '/images/';[/code] For this: [code=php:0]$file_url = "what i write here ?";[/code] You put in the url to the file dir, eg mysite.com/images/ [code=php:0]$file_url = "http://www.mysite.com/images/";[/code]
-
getting an extra %22 either side of the get url
wildteen88 replied to madspof's topic in PHP Coding Help
Oops, typo mistako! Use This: [code=php:0]echo '<a href="audio2.php?directory=' . $file . '">' . $indent . ' ' . $file . "<a/><br />\n";[/code] -
getting an extra %22 either side of the get url
wildteen88 replied to madspof's topic in PHP Coding Help
Your're adding quotes into the url where you're not supposed to: echo "<a href=audio2.php?directory=[color=red]\"$file\"[/color]>$indent $file</a>" The offedning code is highlighted in red. Use this instead: [code=php:0]echo '<a href=a"udio2.php?directory=' . $file . '>' . $indent . ' ' . $file . "<a/><br />\n";[/code] -
By the way, $datas and $names variables are created by the foreach loop automatically.. So this code: [code]$names = array(); $data = array(); $names = mysql_fetch_array(mysql_query("SELECT config_name FROM config")); $data = $_POST;[/code] Isn't needed. Just [code=php:0]foreach($_POST as $datas => $names)[/code] will do. Also you have the $datas and $names variables round the wrong way in the foreach loop it shold be this: [code=php:0]foreach($_POST as $names => $datas)[/code] $names holds the key in the $_POST arrray, ($_POST['domain_name'] - domain_name is the key in the $_POST array) and $datas holds the value form the form field. So just use this as the code: [code=php:0]foreach($data as $names => $datas) { $mysite = "UPDATE `config` SET `config_value` = ".$datas." WHERE CONVERT( `config_name` USING utf8 ) = ". $names .""; $mysite = mysql_query($mysite); }[/code]
-
Then mny code above should work for you. Did you try it out? [quote author=wildteen88 link=topic=106755.msg427228#msg427228 date=1157306905] [code=php:0]foreach($_POST as $field_name => $field_value) { $mysite .= "UPDATE `config` SET `config_value` = ". $field_value ." WHERE CONVERT( `config_name` USING utf8 ) = ". $field_name ."<br />\n"; } $tpl->assign('errmsg', $mysite);[/code] [/quote]
-
Try: $fp = opendir($dir . '/' .$directory); instead of $fp = opendir($dir/$directory);
-
Is the fields in your form the same name as whats in the config_name column if they are use a foreach loop: [code=php:0]foreach($_POST as $field_name => $field_value) { $mysite .= "UPDATE `config` SET `config_value` = ". $field_value ." WHERE CONVERT( `config_name` USING utf8 ) = ". $field_name ."<br />\n"; } $tpl->assign('errmsg', $mysite);[/code]
-
Umm, post link or image or sometime so I can see the site.
-
oldmanice, never_rain doesnt have to create a virtual host. mod_rewrite will do just fine what he is atteempting to do.
-
I belive that means line1 of your javascript code i'm not sure. Looks liek you have an extra ) in your code somewhere. Also I guess you are using IE. IEs javascript debugger isn't that greatye. If you have FireFox installed, download the Web Developer Extension. Now load your page up in FireFox when theres an error on your page you'll get a red icon appear to the right of the screen on the web developer toolbar. Click the red icon this will open the Javascript Console. It should dispaly the error(s) and a green arrow pointing to the error in question.
-
If you want to use PHP with MS Access Database I believe you'll need to use the [url=http://php.net/odbc]ODBC[/url] driver functions. I did a quick search on this and found a tutorial over at [url=http://www.phpbuilder.com/columns/siddarth20000228.php3?page=1]phpbuilder.com[/url] on how to connect to MS Access with PHP. To install gd on windows. All you have to do is enable the gd extension in the php.ini, as advised in the post above
-
PHP4 code is backwards compatible with PHP5. So if someone creatse an app on a server using PHP4 and they move it to a server running PHP5 the script will still work. However the thing that will either make or break you app is the difference between how PHP is setup on the two servers. Such as the PHP4 server may have a setting turned on, ie register_globals, but the PHP5 server has this setting disabled. This may cause your app to function incorrectly.
-
How to store PHP and HTML code to a variable?
wildteen88 replied to djmike's topic in PHP Coding Help
They are the samething yes. However if you ahve variables or whitespace characters (\n, \t, \r, etc) in single quotes PHP will just treat them as normal text. However if you used double quotes PHP wont treat them as normal text and will parse the variables and treat \n, \t, \n etc as whitespace characters. Also I use single quotes on html blocks to save having to type the backslash . This also helps keep the code a readable as possible. -
wrap number_format around your round function: [code=php:0]$pcent = round('1.00' * ($p_array[$playerid]['goalsa']) * (60/$p_array[$playerid]['minutes']), 2); $p_array[$playerid]['gaa'] = number_format($pcent, 2, '.', ',');[/code]
-
This: [code=php:0]include = code.php[/code] is supposed to be this: [code=php:0]include 'code.php';[/code] You cannot use include with an equal sign. As it isn't the the correct syntax. The include synx is either of the following: [code=php:0]include("filename.php"); include "filename.php"; include 'filename.php';[/code]
-
Where is your php.ini located to. Move your php.ini to C:\WINDOWS\ (or C:\WINNT\ if WINDOWS doesnt exist). Restart your server. Is PHP using the correct ini now?
-
How to store PHP and HTML code to a variable?
wildteen88 replied to djmike's topic in PHP Coding Help
Just use: [code=php:0]$body = '<p align="center"><img src="images/l2-019.jpg" width="155" height="156" /></p> <p align="center"> <a href="hr0.php?p=' . $p . '">Introduction</a>';[/code] -
PHP isnt working!
wildteen88 replied to Imtehbegginer's topic in Editor Help (PhpStorm, VS Code, etc)
This is an old MYSQL client API problem. What version of PHP and MySQL are using? To solve this you'll need to save your mysql password for the userrname you are using with the OLD_PASSWORD function, you'll have to reset the password via command promt. -
OKay. Is PHP using using the correct php.ini. You can check this by running the phpinfo() function in phpscript: [code=php:0]<?php phpinfo(); ?>[/code] Look for the [b]Configuration File (php.ini) Path[/b] row. To the right that should be the path to the php.ini it using. Is this the correct path? Also make sure you are restarting the server too when making any changes to the php.ini.
-
No valid feeds at phpfreaks.com
wildteen88 replied to Forki's topic in PHPFreaks.com Website Feedback
We are aware of any problems with the main website. We do have plans instore for fixing the verious issues with the main site. Hopefully develeopement should start within the month now that our admins have access the sites files. -
Create a form which submits to itself, then use PHP to populate the form fields. Have a submit button and name it update. Then have an if statement which checks whether the submit button been pressed. If has update the database. Heres an example: [code]<?php if(isset($_GET['id']) && is_numeric($_GET['id'])) { $id = $_GET['id']; $sql = "SELECT * FROM pokebash_users WHERE userid='$id'"; $result = @mysql_query($sql) or die(mysql_error()); $user = mysql_fetch_assoc($result); echo <<<HTMLFORM <form action="{$_SERVER['PHP_SELF']}" method="post"> <table border="1" cellpadding="2" cellspacing="1" width="400"> <tr> <td wdith="35%">Username:</td> <td>{$user['username']}</td> </tr> <tr> <td>Full Name:</td> <td><input type="text" name="fullname" value="{$user['fullname']}" /></td> </tr> <tr> <td>Email Address:</td> <td><input type="text" name="email" value="{$user['email']}" /></td> </tr> <tr> <td colspan="2"> <input type="hidden" name="userid" value="{$user['userid']}" /> <input type="submit" name="update" value="Update Profile"> </td> </tr> </table> </form> HTMLFORM; } elseif(isset($_POST['update'])) { foreach($_POST as $field_name => $field_value) { ${$field_name} = mysql_real_escape_string($field_value); } $sql = "UPDATE pokebash_users email='$email', fullname='$fullname' WHERE userid='$userid'"; $result = mysql_query($sql) or die(mysql_error()); echo "Successfully updated profile"; } else { //########REDIRECTS TO YOUR HOME PAGE IF UID IS NOT PRESENT IN THE URL######### echo '<meta http-equiv="refresh" content="0;URL=user.php" />'; } ?>[/code]
-
Well you've setup an array ($get) with a key called userdata. its part of the get array you setup
-
it is becuase your are passing a id (profile.php?id=1) parameter and not a userid parameter, which is what your script is using, you want to use $_GET['id'] and not $_GET['userid']) So change this: [code] if($_GET['userid']) { $id = $_GET['userid'];[/code] To this: [code] if(isset($_GET['id']) && is_numeric($_GET['id'])) { $id = $_GET['id'];[/code]