i just start to practice with php built-in, gettype() and its return value. This function is capable to return testing result such as boolean, integer, unknown type, etc. But among those testing result, there's one caught my eyes : unknown type.
After reading gettype, and try to find some reference here, i can not get any. So, the qu...
Hi, I am getting the error; Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Why do I get this error? The mysql_real_escape_string() works on all of my pages apart from one? Is it something to do with MySQL being on a different s...
Hey everyone. This is my first post here, so I hope I'm doing it appropriately.
I have several jQuery $.post calls that work just fine. They send data to a PHP script that modifies a database and returns some data. No problem.
But this one doesn't work. The returned data is just NULL.
$.post("act_addTaskLog.php",
{description: $("#lo...
I have function that updates log table.
function wslog($userID, $log, $where) {
safe_query("INSERT INTO ".PREFIX."log ( time, userID, log, where ) values( '".time()."', '".$userID."', '".$log."', '".$where."' ) ");
}
And I have this php code:
wslog($userID, 'server|'.mysql_insert_id().'', 'servers');
But I keep getting syntax e...
I am inserting the following characters into my DB: 汉字 / 漢字
This is the meta tag on the page that is inserting the characters:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
I have altered all the columns in my table that is holding the characters to be utf8_unicode_ci
The foreign characters show up like so in...
I am looking to start a community based on user posted scripts such as bashrc, screenrc, aliases, etc.
Does anyone know of a web application in PHP that would do that?
I am not looking for a snippet program, or a link directory.
Users can store linux/UNIX/Windows configuration files, as well as maybe an option to attach a screenshot....
I am using php to output some rich text. How can I strip out the inline styles completely?
The text will be pasted straight out of MS Word, or OpenOffice, and into a which uses TinyMCE, a Rich-Text editor which allows you to add basic HTML formatting to the text.
However I want to remove the inline styles on the tags (see below), but...
For usability purposes I like to set up my form fields this way:
<?php
$username = $_POST['username'];
$message = $_POST['message'];
?>
<input type="text" name="username" value="<?php echo $username; ?>" />
<textarea name="message"><?php echo $message; ?></textarea>
This way if the user fails validation, the form input he entered...
Hi,
i have a pictures table : pictures(articleid,pictureurl)
And an articles table : articles(id,title,category)
So, briefly, every article has a picture, and i link pictures with article using articleid column. now i want to select 5 pictures of articles in politic category.
i think that can be done using IN but i can't figure out ho...
I had some troubles implementing Lawler's algorithm but thanks to SO and a bounty of 200 reputation I finally managed to write a working implementation:
http://stackoverflow.com/questions/2466928/lawlers-algorithm-implementation-assistance
I feel like I'm using too many variables and loops there though so I am trying to refactor the co...
Not sure if this is possible..basically a server forwards/bridges an incoming connection
Client -> Server -> Destination
Now, rather than a normal proxy script on the server(or a simple redirect),
1) the Destination sees the incoming connection as from the CLIENT (not from the SERVER).. aka masking the server
2) the Server in the midd...
is it possible, that in php something, which was written as comment( like //comment...), makes some influence on the script? i remember, that once i use open source script, but when i delete all comments from it, it became non working. sorry for an abstract question. i haven't the code now, so i dont show it.
...
Suppose you have a messaging system built in PHP with a MySQL database backend, and you would like to support searching for messages using arbitrary date strings.
The database includes a messages table, with a 'date_created' field represented as a datetime.
Examples of the arbitrary date strings that would be accepted by the user sho...
I went to a PHP job interview, I was asked to implement a piece of code to detect visitors are bots to crawl thru the website and steal content.
So I implemented a few lines of code to detect if the site is being refreshed/visited too quickly/often by using a session variable to store last visit timestamp.
I got told that session varai...
I'm trying to perform a usort on an array inside an instance of a class. But the sort is dependent on the properties of said instance.
Code (which doesn't work):
class foo {
private $array;
private $key;
private $dir;
function sort() {
usort($this->array, array("foo", "orderArray"));
}
function orderArray($a, $b) {
...
I'm using PHP and MySQL. Is this the best method to select information about "user_1" from four different tables? I know it works, because I have tried it. But is this the preferred method of selecting information from multiple tables for "user_1"?
$query = "SELECT table_1.username, table_2.city, table_3.state, table_4.country
FROM...
I have a site which relies heavily on javaScript. I created a mirror site, which has all the JS as well as all the elements that require JS removed. What is a good, easy way to redirect users to the mirror site if they don't have javaScript enabled?
I tried this, but it doesn't seem very good:
<noscript>
<meta http-equiv="refresh" co...
I'd like to populate a google map with several markers. When the user clicks on a marker I would like it to send the user to a different webpage which is designated for that location. (for example: lets say the markers represent homes, when you click on a marker it takes you to a page with more information about the home)
What is the s...
i have the variable $a = 5; i want to show it in binary form, with length, equal 8, with writing * at white spaces, just like this, like this * * * * *101
here the script
$number = 5;
printf("%*8b", $number);
it doesn't work with *, but if "0"-s it works
printf("%08b", $number);
//returns 00000101
why it doesn't work ...
I'm trying to build a multi-level "game". A randomly generated option (Option1) will trigger other options in a drop down (Option2)...the options in the new drop down will be directly related the to Option1. Option2 will then trigger another drop down with info directly related to Option2 and so forth until reaching OptionEnd...any sug...