php

How do I display PHP code instead of displaying output?

I have a string variable which also has some PHP code in it. The code in the string var is getting run whenever I am displaying the string with echo. Is there anything (function) which can escape the meaning of PHP code while I use it with string? Please help? ...

How to display all images when a link is clicked by using JQuery, PHP & MySQL?

I have this script that displays ten images or less by default but when a user clicks the <a> tag link it displays all the users images. Is there a way I can display all the users images by having them slide down when a user clicks on the link <a> link instead of refreshing the page using JQuery or PHP? Here is the php code. if(isset...

in array sql query

I have the following inside a foreach loop (displaying my various videos), I'm trying to display some alternate text for the top three voted videos. What on earth am I doing wrong (a lot clearly)... $sql = "SELECT video_id FROM videos WHERE displayable='y' ORDER BY votes desc LIMIT 0,3"; $result = mysql_query($sql); $row = @mysql_fetch_...

why doesn't $this in PHP always refer to the current class?

I'm a Java developer who has turned to the dark side over the last couple of weeks as I've been trying to write some code in PHP for the first time ever. Most stuff seems familiar, methods become functions, . becomes ->, variables have a $ in front and you never have any idea what type they are, I get it, but I'm totally stumped by the ...

ls -ltr using PHP exec()

as the problem states.. when i do exec("ls -ltr > output.txt 2>&1",$result,$status); its different from the normal output. An extra column gets added. something like -rw-r--r-- 1 apache apache 211 Jul 1 15:52 withoutsudo.txt -rw-r--r-- 1 apache apache 0 Jul 1 15:53 withsudo.txt where as when executed from the comma...

The inner depths of PHP

I've been studying Visibility issue in PHP (public, private, protected) and wondered how is this sort of "dom-building" is implemented in PHP? I mean there should be some kind of algorithm that PHP uses to go through all your classes and establish relations between them. Not sure if it is called "dom-building" though, but I think the sam...

Light-weight Database for storing user preferences of widgets

Hey all, I'm looking for a database that I can distribute with a web application, that will store user preferences for various widgets. A good example is the kind of database design that apple uses to store information about its widgets. So the weather widget stores location, while the notes widget stores notes. I think I'm looking f...

Drupal: Loading AJAX content in Drupal

hi, I've recently been told to use Panels to dynamically load content into different sections with Drupal. However, I've just realized that there is an easy way to do it, I've added this jQuery code to all menu items: $('.menu a').click(function(){ $('#content').load($(this).attr('href') + " #content"); return false; //to avoid...

saving html tags and and reproducing properly

hi , i am using mysql db and php code. i store value like this in db <u><strike><i><b>Opinion</b></i></strike></u> that is with some editor. so how do i display it so that, it takes all the tags given to it.??? ...

Running my own OpenID identity server/service (php)

i need to provide openid service to users on my domain. They all have unique subdomains such as: abc.example.com and i want them to use abc.example.com as their openid identity... I read this - https://www.myopenid.com/help#own%5Fdomain - but it looks like its for (a) ONE user and (b) I need to have an existing myopenid/similar account....

What is the best way of uploading 1,600,000 rows of data into mysql database ?

This might sound dumb but yeah i need a effective way of doing this. Am using php at the moment and man it is slow. Any pointers please. Cheers. ...

Storing encrypted personal information - common sense?

Hi everybody, We're in the middle of developing a e-commerce application that will be used by our customers on a pay-monthly-plan. We have thought a bit about offering encryption of all personal data that is stored in the database, to make our application a notch safer to the final consumers. The encryption would be handled completely ...

how to use Jquery AJAX in Joomla Components?

i m developing site in Joomla, meanwhile i stuck in a problem,please help me in below problem here is my folder structure for component htdocs/Joomla/administrator/component/com_test/test.php,controller.php models/test.php controllers/test.php ...

Automatically adding width and height attributes to <img> tags with a PHP function

What I want is a function I can run on user input that will intelligently find and add the width and height attributes to any <img> tag in a blob of HTML so as to avoid page-reflowing issues while images load. I am writing the posting script for a PHP forum, where a user's input is sanitised and generally made nicer before writing it to...

1 domain 2 websites

There are 2 different websites in 2 directories ..path/siteA/ and ..path/siteB/ . I need to load one of them on domain example.com depending on their country they are visiting from. It can't be www.example.com/siteA it must be www.example.com . Is it posible? Edit: found the solution. ...

PHP flow logic problem

Hi guys, I have a bit of a problem with my PHP code, I am assigning values to variables in different states of the flow depending on what I receive, but for some reason it keeps getting stuck at one point, here is the code. if (isset($session)) { //if the user is in the database if ($row == 1) { $from = $_GET['from'];...

Website image compression

Hello, I am currently working on a website which needs images to be uploaded. I have seen some standard image uploading tools which work well, but I am looking for one that compresses on the client side before the upload has been done. I have looked at a view, but none seem to suit. Can anyone recommend a web based client side image co...

How can I determine the column type with PDO?

Hello folks. I need a way to determine the type of a database column (varchar/numeric/date/...) when reading from the DB with PDO. When fetching values from the DB, PDO produces only string values, regardless of the actual type of the table column. Is there any non driver specific way to get this information? I know that there are SQL...

How to restore old session when user accidentally closes the browser?

Hello, I am planning to create a online examination sytem in PHP. What steps could I take to restore old session, if user has accidentally closed the window? Suppose he has already answered 49 questions out of 50 and suddenly there is power cut off (and there is no UPS) or he accidentally closes the window (even by mistake, if he click...

Would any configuration or INNODB principle cause the following MYSQL update to not necessarilly perform all updates?

<?php $query = 'SELECT id FROM transaction_table'; $result = db_query($query); while($row = db_fetch_array($result)) { //do some processing db_query('UPDATE transaction_table SET updated = "1" WHERE id = "%s"',$row['id']); } ?> Every time this script run, it only updates a few random rows (8-25 on ...