wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
**fixed** This is making me nuts... error near " on line 1???
wildteen88 replied to jmilane's topic in PHP Coding Help
Could you post the full error message(s) here please as it'll help us understand whats going on. I think the error you are getting isnt to do with PHP but to do with MySQL queries. As the "[i]error near .... on line 1[/i]" is common with errors in SQL queries as the error is comming from the database rather than PHP itself. -
Someone the other day asked something like this before. there was a reply which posted a link to a site that, or mentioned about a package you can add to a USB flash drive and you could run your PHP scripts of off the usb drive without installing anythink. Prehaps this could be used on a CD. I'll se if I can find that thread. EDIT: Found that thread [url=http://www.firepages.com.au/php_usb.htm]this is the site[/url] I was on about.
-
Looka like PHP isnt configured then if you are getting the download dialog box when opening a PHP script from localhost What - server are using Apache, IIS or other? - what OS are you using (Windows, linux or mac)? - what version of PHP do you have? How have you install the server and php?
-
Could you post the code you are using here Prehaps you want to do something like this for the Print link: [code=php:0]if(empty($_SERVER['QUERY_STRING'])) { $url = "?print=1"; } elseif(!eregi("print=1", $_SERVER['QUERY_STRING'])) { $url = '?' . $_SERVER['QUERY_STRING'] . '&print=1'; } else { $url = '?' . $_SERVER['QUERY_STRING']; } // echo print link: echo '<a href="' . $url . '">Print</a>';[/code]
-
Use $_FILE['upload_Field_Name_HERE'][type'] i believe in order to find out out what file type the uploaded file is.
-
The version of PHP4 you have is out of date. As the latest version of PHP4 is PHP4.4.4. However I'd recommend you to do awayt with using any all-in-on package. And install AMP seperately.
-
Make sure you have error reporting set to E_ALL too. If you want your PHP to errors to be logged you'll have to turn on the log_errors directive and setup the error_log setting too to point to an error log file Also amke sure you are eddting the correct php.ini to by running the phpinfo function in a script and checking that [b]Configuration File (php.ini) Path[/b] is set to the correct path of your php.ini. ALso make sure you are restarting the server too when you make the changes to php.ini
-
[SOLVED] parse error, unexpected T_ENCAPSED_AND_WHITESPACE??????
wildteen88 replied to bobleny's topic in MySQL Help
Try this as the query: [code=php:0]$query = "UPDATE `{$_POST['table']}` SET message = '".$_POST['text']."' WHERE `id` = '".$_POST['id']."'";[/code] Notice the curly braces around $_POST['table'] Also I suggest you validate and try to secure the user input too ehn using it in an SQL query. Never trust raw user input. -
Using TopStyle with PHP
wildteen88 replied to Conjurer's topic in Editor Help (PhpStorm, VS Code, etc)
I guess your using Topstyle Pro. To be able to parse your PHP files when you go to preview them you'll need to add a [i]mapping[/i]. To add a mapping go to Options > Preview > Mappings Now click the Add button. In the Map From textfield type in the full location to your Servers document root, The document root is the folder where you place your files so they can be seen when you goto http://localhost/ - for example if you have IIS installed the document root will be: C:/Inetpub/wwwroot/ by defualt Or if you have Apache it'll be something like C:/Program Files/Apache Group/Apache2/htdocs by default. Once you have setup the mapping. You should be able to see your PHP files when you goto preview them. -
Be cautious though as the referer variable can be spoofed so dont reply heavily on this variable.
-
Have a search for [b]web safe fonts[/b] too. Should return some good results.
-
Fatal error experienced after converting to PHP5 from PHP4
wildteen88 replied to jmosher's topic in PHP Coding Help
[quote]Note**: The variable $result has replaced the accepted variable function $this as $this has been discontinued in version 5 and support is no longer offered.[/quote] Huh! I agree with Barand here. $this has not been discontinued from PHP5. If it has the documentation would reflect this and my OO programmed scripts will fail work. Where did you get that from? -
Thread closed. Please do not post multiple instances of the same thread in different forums. Plus the Regex forum is the correct forum for this too.
-
Or use the [b]e[/b] pattern modifier: [code]$datr = preg_replace("/\[SC\](.*)\[\/SC\]/ie", "'<a name=\"' . myurlen('$1') . '\"></a>'", $datr);[/code]
-
If you want to limit the number of characters for a textarea. Have a look at [url=http://www.phpfreaks.com/forums/index.php/topic,106608.0.html]this thread[/url].
-
If you want #inner_left_shell and #inner_right_shell to line up side by side to each other. You'll wnat to float them so add this to your CSS: [code]#inner_left_shell, #inner_right_shell { float: left; }[/code] If add anything after a floated object. The object will go underneath the float. To stop this you need to clear the float, so add [b]clear: both[/b] CSS to the object you place after a floated object. Or just add [nobbc]<br style="clear: both">[/nobbc] before the closing tag for [nobbc]<div id="outer_shell">[/nobbc]
-
Not sure what you mean by timstamper. Do you mean unix timestamp? However i noticed in your query you are using single quotes. When before you where using single quotes when before you had backticks (`) around [b]article[/b].
-
Opps I did a typo. My bad. This: [code]mysql_query($sql) or die("Unable to perform query <code>{$sql}</code><br />\n" . mysql_query());[/code] Should be this: [code]mysql_query($sql) or die("Unable to perform query <code>{$sql}</code><br />\n" . mysql_error());[/code]
-
Code and the query seems fine from looking at it. To see if its a problem with the query use this: [code]$sql = "INSERT INTO `articles` (title, content) VALUES ('$title','$content')"; mysql_query($sql) or die("Unable to perform query <code>{$sql}</code><br />\n" . mysql_query());[/code] Instead of: [code]mysql_query("INSERT INTO `articles` (title, content) VALUES ('$title','$content')");[/code] If you do get an error post the full error message hear. Also you dont want to use raw user input either. You should always validate user input and make it secure too when using user input in a database query. You can do this using the [url=http://php.net/mysql_real_escape_string]mysql_real_escape_string[/url] function.
-
[quote author=pkSML link=topic=109142.msg439961#msg439961 date=1159024861] For redirections, you could show the user that they are being redirected. Try this code: [code]<?php header("Location: http://www.google.com/"); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Redirection ...</title> </head> <body> You are being redirected to <a href="http://www.google.com">Google</a>. </body> </html>[/code] Of course, besides PHP, you can also do a meta-tag redirect or a javascript redirect. [/quote] WHats the point in that! The user isnt going to see anything. The user will be redirected straight away!
-
One question to those who know a lot about php
wildteen88 replied to 11Tami's topic in PHP Coding Help
Are you using the file functions, such as fopen, fread etc or file_get_contents() or whever then make sure that the PHP setting [b]allow_url_fopen[/b]is enabled in the php.ini and that php is not running in safe mode. If the allow_url_fopen setting is enabled or PHP is in safe mode then this why you cannot use urls within your code. -
Problem with flat file being read by Flash
wildteen88 replied to m00gzilla's topic in PHP Coding Help
Use [url=http://php.net/stripslashes]stripslashes[/url] in that case. Your serverprobably has a setting called magic_quotes enabled which escapes quotes automatically, thus you get \" instead of ". stripslashes will unescape the escaped characters. -
You must of done something to your code, when you copied and pasted the code over, all I did was mofify the if statement. Make sure [b]EOF;[/b] is not indented and is on its own line with no whitespace before or after it.
-
[quote author=tommie link=topic=109057.msg439552#msg439552 date=1158948273] ok when i run the phpinfo i got register global=off so thats my problem i just havnt changed the right php.ini but i cant find anymore lol but how exactly do i do a htaccess file i tried and created a test.htaccess and wrote [code]php_flag register_globals On [/code] but nothing changed. so dont i have to implement it or something? [/quote]Sorry I should of explained how to create a htaccess file. The htaccess file has no name, it is just a file extension on its own. To create the htaccess file open up Notepad and type the following in to a new file: php_flag register_globals On Now go to [b]File > Save As...[/b] type the following exactly into the Filename box [b]".htaccess"[/b] including the quotes. Click save. The htaccess file has now been created. Now move the htaccess file to the htdocs folder (xampp/htdocs/).