php

PHP variable inside a javascript function

Hello every1! I'm attempting to put a php variable inside a javascript function and having no luck, here's what I got <a class="code" href="javascript:void(0);" onclick="javascript:if(window.dd && dd.elements) d.elements.name1.moveTo(<? echo "$xpos"; ?>, <? echo "$ypos"; ?>); return false;"> name1.moveTo(name1.x-20, name1.y+...

How can I load data on a page based on this being added into the URL #a=1380369&i=23007472

On a php page with javascript (jquery) in the urel I would like to have something like this idex.php?var=something*#a=1380369&i=23007472* The page will load photos and have a next and previous link, when this is clicked on it will use ajax to load the new image into the page but I need to also change the URL to add someting like this ...

Can I use the Zend framework without command line access?

Lets say yy only option right now is to work on files from my jump drive that I keep on my keychain. I've got a few computers I can use to code on, but none that I can install anything on or alter in any way. Could I get started and use the 'powerfulness' and functionality of the zend framework by just downloading the files to my jump dr...

How to remove values from an array whilst renumbering numeric keys

I have an array which may contain numeric or associative keys, or both: $x = array('a', 'b', 'c', 'foo' => 'bar', 'd', 'e'); print_r($x); /*( [0] => a [1] => b [2] => c [foo] => bar [3] => d [4] => e )*/ I want to be able to remove an item from the array, renumbering the non-associative keys to keep them sequen...

mysql query adding to a decimal doubles value of the addend for some reason

I am trying to add a value ($credit) to the value of a decimal (9,2 max length) field in a mysql database. The problem is that when I do this, it doubles the $credit and then adds it for some reason. I just want it to add it. The code I am using is: mysql_query("update $table set earnings = earnings +$credit where username = ('$member')...

How to deal with html excerpt?

It introduced a lot of non-closed tags like below: <div> <table>...</table> The </div> is truncated by code like this: (strlen($row['body']) > 200 ? substr($row['body'],0,200) . '...' : $row['body']) And the layout of the whole page is broken,how to deal with it? ...

Weird CodeIgniter Upload Problem

Here's the lowdown. PHP, Codeigniter, LAMP. I've created a fixeee for you all to see my code. http://fixee.org/paste/s8jc04t/ Whenever I have mulitple file uploads (ex. fileupload1, fileupload2, fileupload3, etc.) and I tried to get the upload data from each one correctly, I seem to duplicate the first file data that was uploaded. Can...

Mailing List Data Schema

Hi, My website allows for anonymous sign-up of a mailing list. The same mailing list is also sent out to registered users. The problem is when the anonymous user transitions to a registered user --- I don't want to spam the same email address twice. My user table is as follow: CREATE table users ( user_id integer not null primary k...

How do forums show you unread topics?

I have user discussion forums I coded in php/mysql, I am wanting to know how the big name forums can make it show you which topics have new posts in them, usually by changing an icon image next to the thread without using hardly any resources? ...

PHP+SQLite sqlite_exec and sqlite_query vs mysql_query

I understand that sqlite_exec is for queries that does not return resultset and sqlite_query is for queries that return resultset. However can I use sqlite_query for all kinds of queries just like how mysql_query and are there any sideeffects to this? ...

How to unserialize an ArrayObject

Note: I have tried using unserialize function but it say that first argument should be an string and not an Object and so my question - Q: How can I unserialize an ArrayObject in php, my ArrayObject contains: O:11:"ArrayObject":2:{s:14:"shoppingBasket";a:1:{s:6:"offers";a:2:{i:10;a:8:{s:9:"object_id";s:2:"10";s:6:"family";s:8:"Intern...

How to have a variable in a mail line

okay, here is the code while (!feof($text)) { $name = fgets($text); $number = fgets($text); $carrier = fgets($text); $date = fgets($text); $line = fgets($text); $content = $_POST['message']; $message .= $content; $message .= "\n"; $number = $number; mail("[email protected]", "Event Alert", ...

How do I output these PHP array values?

Using PHP, how do I output/display the values from this array within my web page: http://api.getclicky.com/api/stats/4?site_id=83367&amp;sitekey=e09c6cb0d51d298c&amp;type=clicks&amp;output=php&amp;unserialize ...

PHP Uploads Limit for Scanning?

I read somewhere that the upload limit for php is about 2MBs. Does this still apply if I am asking a user to upload a file to the server to scan through and convert to a string? If so how do I get around this? The application for this is a scanner type deal where users would be able to upload a code file, and this php application would...

loading edit form only if GET var exists in database

What my script currently does: grabs & cleans a $_GET['id'] pulls all pre-existing data from TABLE for that id displays form populated with any pre-existing data SUBMIT sends form data to update script, adds all data to TABLE What I want my script to do: grabs & cleans a $_GET['id'] pulls all possible (id)'s from TABLE (this I know...

PHP: Get n-th item of an associative array

If you have an associative array: Array ( [uid] => Marvelous [status] => 1 [set_later] => Array ( [0] => 1 [1] => 0 ) [op] => Submit [submit] => Submit ) And you want to access the 2nd item, how would you do it? $arr[1] doesn't seem to be working: foreach ($form_state['valu...

(PHP & mySQL) Treat rows as columns

Hi all, I am working on PHP & mySQL based website. I am trying to setup the 'Settings' page in administration panel where I can enter different settings to manage the site. The settings can range upto 100 (or even more) depending upon the requirements. So instead of making 100 columns (and increase if I have to add more columns in future...

Fatal error: Call to private MyObject::__construct() from invalid context

When creating a new object in PHP, I get the following error message: Fatal error: Call to private MyObject::__construct() from invalid context I just create the new object and do not try to call the constructor explicitly. Does anyone know what's going on? ...

mysql_result vs mysql_array_assoc

Is there a performance difference between using mysql_result and mysql_array_assoc to loop through a large SQL select result? ...

Client-side processing vs server-side processing , which is fast?

Which processing is fast Client-side or Server-side? for client side processing browser need to download every JavaScript first and in server side programming everything happens on server without downloading anything to user PC? if for a particular functionality we have solution in both javascript and php/asp then what should be chosen ...