php

Remember select menu option choice

As the title says, How would I do this? So lets say if the user left message empty but selected a correct topic, I want that topic to be selected after the page has refreshed My code right now: if (count($_POST) > 0) { if (strlen($_POST['topic']) < 1) $errorMsg = "Please select a topic."; else if (strlen($_POST['message'...

Interactive php

Hi I looking for interactive php appliaction like linqpad for c# where i can test code snippets. Thanks in advice ...

Get anchor tag text using javascript

I don't know if it is possible! Maybe my thought is also wrong. I want to invoke a search corresponding to all links in my Wordpress blog. I am using an Ajax call for my other search in this site. How can I retrieve a linking text from hypertext tag in html. eg: <a href='www.example.com'>demo</a>.here i want to get 'demo' as input. ...

Hudson and PHP project release management

I'd like to ask about real life experiences with release management of PHP projects over Hudson CI server. Our projects are separated into subprojects: frontends, framework, libraries. Everything is stored in our SVN as project of its own. Different frontends may depend on different versions of framework which itself depends on differen...

Read a file backwards line by line using fseek

How do I read a file backwards line by line using fseek? code can be helpful. must be cross platform and pure php. many thanks in advance regards Jera ...

Joining 2 mysql queries

I have two tables which I need to select all rows from where the userid is $userid then sort them. I tried to use join but I couldn't even really get started on how to get it right. Can anybody point me in the right direction as to how to make these into 1 query? $result1 = mysql_query("SELECT * FROM paypal_sub_info WHERE ...

undefined offset notice when looping through arrays in php

I have this code that loops through a list and post it in an option tag. But I get an undefined offset notice everytime I try to run it. <?php $datearray=array('Jan','Feb','Mar'); ?> <?php for($d=0;$d<=sizeof($datearray);$d++){ ?> <select title="mm" name="month" id="month" class=""> <option><?php echo $da...

Show item of the day

Hi, I am looking to create a function that gets me a random item from a mySQL table, but let's me keep the returned as the "item of the day". In other words, the item that was "the item of the day" yesterday should not be shown again until all other items have been shown as item of the day. Any suggestions on how to do this in an eleg...

How to list subfolders of local area network shares if non-latin characters are in computer name?

I have a php script which lists workgroups/domains, computers in workgroups/domains and shares on computers. The apache is running under specific credentials (so not Local System), so it has access on LAN. Listing subfolders of the shares is working partially: only with latin characters. For example if I have a computer named ABC and a...

Php Match words code not working on php 5.1.6

Hello, i have piece of code that works fine on my local test server but on live server for some reason it does not. Php version on live server is 5.1.6. $subject = 'random words to check'; $terms = explode(' ', 'word1 word2 check'); $wordIndex = array_flip(preg_split('/\P{L}+/u', mb_strtolower($subject), -1, PREG_SPLIT_NO_EMPTY)); fo...

How/Why use PHP classes on a simple page

I want to create a simple PHP website containing quite a number of pages. The content of the pages will be editable by the admin(s) of the website using a simple online html text editor. There should also be members, managed by the admin. (No self-registration) There is also a members section with login. Obviously this is not complica...

Question on PHP cookies

I came across the snippet below: setcookie('foo', 'v1', time() + 60*60*24, '/'); setcookie('foo', 'v2'); What is the effect of setting 2 cookies with same name but different values? Is it common in practice? Where is it used? ...

optimal way to prepend a file in php

how do I do this. the file can get very big, so good performance is necessary code is helpful. this is what i have so far function prepend($string, $filename) { $context = stream_context_create (); $fp = fopen($filename,'r',1,$context); $tmpname = md5($string); file_put_contents($tmpname,$string); file_put_co...

Trouble Escaping Apostrophe in PHP CSV Upload with fgetcsv()

Hello, I am uploading email addresses from a CSV file, via fgetcsv(), into a MySQL database. The problem that I am running into is that I cannot escape email addresses containing an apostrophe (or single quote). So, O'[email protected] will not become O\'[email protected] I know that this is supposed to happen, however I have been unable to f...

displaying specific records of a user without using WHERE

i have a problem with my coding. when i put 'where' in my query, it does not show anything. but when i do not put 'where' it display all the records. all i want is that, it will display the records of the current user that logged in.. please help me with this. what will be the code for these? anyone? :( it will be a big help. thanks....

http status code 200

Can any one please let me know the exact meaning of http status code 200. Because, i have uploaded the file to a particular folder (NewsToday) having protocol HTTPS, but it does not post that file into that folder, instead shows an error status code 200. Why? What i did the mistake i did? ...

Wordpress motion theme

Right now I'm trying to modify the motion theme for Wordpress. As of now I'm not sure if it's the theme are the wordpress app that is highlighting my tables on a mouseover. I was wondering if anybody had any idea how to remove the table highlighting mouse over feature in a wordpress app using the Motion theme. ...

Is it bad practise to write to $_POST ?

If this is file_1.php <?php $_POST["test_message"] = "Hello, world"; header("Location: http://localhost/file_2.php"); ?> and this is file_2.php <html> <head> </head> <body> <?php if (!(isset($_POST["test_message"]))) echo "Test message is not set"; else echo $_POST["test_message"]; ?> </body> </html> ...

printf function in PHP

I'm from a C background and understand basics of printf function. I came across the follwing code <?php printf('%4$d %2$s code for %3$3.2f %1$s', "hours", "coders", 9, 99); ?> which prints: 99 coders code for 9.00 hours Can anyone help me in understanding the call to the printf function. ...

displaying specific records of a uses

guys please check my codes in displaying record.. <?php include("db.php"); $username=$_POST['username']; $email=$_POST['email']; $query="SELECT * FROM members where username = '$username'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); ?> <br /> <p></p> Welcome back! Your details below: <br /><br /> ...