I've got a MySQL database table with an ISO-8859-1 encoded text field containing user names. When I export that to a text file using PHP I get a normal text file saved on the client computer. When I open it in Word or Excel on a Windows system, it looks good. When I open it on Mac using Word or Excel, the high-ascii characters are wro...
Hi, I have a bunch of big txt files (game walkthroughs) that I need translating from English to French. My first instinct was to host them on a server and use a PHP script to automate the translation process by doing a file_get_contents() and some URL manipulation to get the translated text. Something like:
http://translate.google.com/t...
I want to replace all instances of an specific words between braces with something else, unless it is written between double braces, while it should show as is it was written with single braces without the filter.
I have tried a code but only works for the first match. The rest are shown depending of the first one:
$foo = 'a {bar} b {{b...
OK, I'm working with converting some very basic PHP to port to a dev server where the client only has CF. Ive never worked with it, and I just need to know how to port a couple things:
<?php
$pageTitle = 'The City That Works';
$mainCSSURL = 'header_url=../images/banner-home.jpg&second_color=484848&primary_color=333&a...
Hi All!
EDITED:
need help on split Array
array example:
array (
[0] =>
:some normal text
:some long text here, and so on... sometimes
i'm breaking down and...
:some normal text
:some normal text
)
ok, now by using
preg_split( '#\n(?!s)#' , $text )...
I know about all the issues with session fixation and hijacking. My question is really basic: I want to create an authentication system with PHP. For that, after the login, I would just store the user id in the session.
But: I've seen some people do weird things like generating a GUID for each user and session and storing that instead o...
Hi, I have a table with 58 records in mysql database. I was able to connect to my database and retrive all records and made 5 pages with links to view each pages using php script.
webpage will look like this:
name number
john 1232343456
tony 9878768544
jack 3454562345
joe 1232343456
jane 2343454567
andy 234456098...
Hello,
I use settings.php to store general settings for my application. When I load this settings file, I can use the variables defined in settings.php in the script itself, but not within any functions I define in it.
For example, in my class definition, myclass.php:
<?php
$preIP = dirname(__FILE__);
require_once( "preIP/settin...
Hello. Is it possible to blend the left, right and bottom sides of an image into a color?
Lets say, I want the image to be blended into the color "#F0F0F0". I want the image to appear as an actual part of the background, so I thought it would look cool if it was blended in. Thanks.
...
Hi, I had a function in php:
//simple method with array()
$sensors = array();
$query = "select id, x(transform(wkb_geometry,". $epsg . ")) as lon, y(transform(wkb_geometry,". $epsg . ")) as lat from mytable;";
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
while ($row = pg_fetch_assoc($result)) {
//va...
I'm coding a sweepstakes entry form in php where the User submits some information in a form and it is stored in a database.
I would like to find a way to restrict this form to one submission per person. Either dropping a cookie or by IP address. What would be the best way to approach this?
I'm building it on code igniter, if that make...
can anybody explain why uploaded php files treated by a server as a text file ?
The symptom is when i try to access a php file, the server send me the content of the file.
i have edited and put part of content as asked. This is output i see in the browser
*** WHAT : Removinng Meta Box in Post using $pageshow thing WHY :*************...
I have a Smarty template located in a directory under templates_dir: templates/some/dir/template.tpl . In the same directory, I have a sub-template: templates/some/dir/_component.tpl .
I can't include the sub-component using an unqualified include, since apparently it looks it up under the templates_dir:
{include file='_component.tpl'}...
I have an array containing the contents of a MySQL table. I need to put each of these contents into curl_multi_handles so that I can execute them all simultaneously
Here is the code for the array, in case it helps:
$SQL = mysql_query("SELECT url FROM urls") or die(mysql_error());
while($resultSet = mysql_fetch_arra...
What could happen if my template looks for variables which weren't assigned?
For example:
var id = '{$tpl_id}';
This snippet is from my javascript code. I outputted the value and it is simply empty. I know I could use isset(). But I couldn't find anything about how Smarty handles non-existing variables. So, what happens if a template...
Hi,
Been trying this for quite a while now and I need help. Basically I have a PHP file that queries database and I want to change the query based on a logged in users name.
What happens on my site is that a user logs on with Twitter Oauth and I can display their details (twitter username etc.). I have a database which the user has add...
I'm trying to piece together a php script to output different text depending on what day it is and the time of day.
Example:
On weekdays (mon-fri), I would like to output text according to the following periods of time (24H, server time, UTC):
00:00-08:00: "Lorem ipsum"
08:00-13:00: "dolor sit amet"
13:00-15:00: "Pellentesque habitant"
...
hi
what i am trying to do is get all the collums of a table (the table can be empty)
example of what i did before:
SELECT COLUMN_NAME FROM
INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'aTable'
AND table_schema = 'theDatabase'
it works perfectly on localhost however on my provider it gives:
#1142 - SELECT command denied to user ...
Hi everyone!
I'm sorry if this has been asked before but I feel my situation is a little different...
I have a huge form (like 50 questions involving checkboxes, drop downs, text boxes and textareas)
When a user submits a form and the validation page throws an error, is there an easy way to keep the info they entered?
My intitial f...
Currently I'm using
<pre><code> code here </code><pre>
to display code. I'm pulling this information from a DB for a blog. The problem I'm having is that some of the code isn't showing. For example, in the source code I have this:
<pre><code><br />
echo '<ul class="mylist"><li><ul class="left">';
foreach($nameArray as $name) {
i...