php

calling function on hyperlink onclick event in php

Hi there, can anybody help me here please? I am using AJAX for pagination in my application. So I am generating hyperlinks with for loop. as follow: for($t=1; $t<=$hf; $t++) { if($t == $_GET['pageno']) { echo $t." "; } else { echo "<a id ='$t' href='javascript:void(0)' onclick='open_page('ajaxinfo....

Best method for URI Routing this in CodeIgniter?

Hi folks! So, here's an example on Forrst, a CodeIgniter website: http://forrst.com/posts/PHP_Nano_Framework_WIP_Just_throwing_some_ideas_o-mU8 Look at that nice URL. You've got the root site, then posts, then the post title and a short extract. This is pretty cool for user experience. However, my CodeIgniter site's URLs just plain s...

Enable PHP to read .css and .js files while keeping their original Content-Type

Hi all, I would like to configure apache php5 in a way that .css and .js files will be inspected by php their content type will remain as default (that is respectively "text/css" and "application/x-javascript") I need this because both CSS and JS files are using global PHP vars. This allows me from a single PHP file to control both ...

Php mail(), how to get undelivered address list ?

Hi, I'm getting single emails, for each undelivered address that mail() send couldn't reach. Since this can be a painfull process, to keep copy pasting every single address, I'm wondering if it's possible to access a LOG or something ? Some notes: - I've got this app running on a GoDaddy server (I know it sucks); Thanks for your atenti...

Lots of 'If statement', or a redundant mysql query?

Hey all, $url = mysql_real_escape_string($_POST['url']); $shoutcast_url = mysql_real_escape_string($_POST['shoutcast_url']); $site_name = mysql_real_escape_string($_POST['site_name']); $site_subtitle = mysql_real_escape_string($_POST['site_subtitle']); $email_suffix = mysql_real_escape_string($_POST['email_suffix']); $logo_name = mysql_...

HTML to printable format

Currently using a HTML to PDF converter written in PHP to attach a printable readonly page to an email. This can be a little temperamental at the best of times, producing strange results. I was wondering if there was perhaps a better option to achieve this end result? (Granted the end PDF is not entirely "un-editable", but it does the...

make array object in for loop with horizontal view

<?php $xml = simplexml_load_file('http://www.google.com/ig/api?weather=London'); $information = $xml->xpath("/xml_api_reply/weather/forecast_information"); $current = $xml->xpath("/xml_api_reply/weather/current_conditions"); $forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions"); ?> <html> ...

How can I reduce the loop structure in the following code?

$a=array(array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0), array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0)); $rest=array(array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),ar...

$_GET variable cannot identify the first array element.

$_GET variable cannot identify the first array element.: I have passed an array in url which looks like this http://www.example.com/form.php?action=buy_now&amp;ft=prf&amp;Arrayproducts_id[]=431&amp;products_id[]=432&amp;Arraycart[]=1&amp;cart[]=3&amp;Arrayid[]=431&amp;id[]=432 but when i print the array "products_id" and "cart" by...

mysqli prepared statements and mysqli_real_escape_string

I'm currently using the mysqli php extension. Traditionally I have used mysqli_real_escape_string to escape user input. However I am looking at changing over the code (hopefully in as few steps as possible) to use prepared statements. I want to be clear on this - provided I use prepared statements to bind all of my variables, can I be...

using includes cross domain that contain php code - failing

I have a series of web sites all hosted on the same server with different domains. I want to host some common PHP scrips and then be able to call these from the other domains. Im am a bit fresh with my php so pls excuse code attempts - I have tried iterations of the following which may try and help you understand what I am aiming for! ...

Increment value on new row

Given this table design in a web application: CREATE TABLE `invoice` ( `invoice_nr` int(10) unsigned NOT NULL AUTO_INCREMENT, `revision` int(10) unsigned NOT NULL DEFAULT '1', PRIMARY KEY (`invoice_nr`,`revision`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci What's the most handy and reliable way to insert a new ...

How to find 1 X 15 array from 3 X 15 array?

Im trying to create 1 X 15 dimension unique array from 3 X 15 array. I am not able to achieve this .Please help me on this . Thanks in advance. The 3 X 15 array was Array[(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3)] ...

How to echo a variable from the function

How to echo a variable from the function? This is an example code. function test() { $foo = 'foo'; //the variable } test(); //executing the function echo $foo; // no results in printing it out ...

PHP Login System with Sessions

Hi. Im using sessions for login systems in PHP. In all login examples, people directly uses "session_start()" function. But im confused about this. ============================================= On localhost, I have that files; http://localhost/app1/page1.php http://localhost/app1/page2.php http://localhost/app2/page2.php ==========...

Why is my MySQL query so slow?

Background: entities tables currently has 14,111 records articles table currently has 5211 records I am trying to find all articles that are active (completed) and have the entity 'google' # Finding articles that have the entity google takes: # 4 ms SELECT `Article`.`id` FROM `articles_entities` AS `ArticlesEntity` LEFT JOIN `entities...

Invoking a URL and retrieving the rendered HTML page in Phing

Hi all, So this is my dilemma - I am using the excellent codeigniter-simpletest library by Eric Barnes (http://github.com/ericbarnes/codeigniter-simpletest). Its perfect for my purposes, as it adds an endpoint onto the test deployment of my CodeIgniter application, from which I have a dashboard to run all my unit tests and view the resu...

Get threads linked to tags

I have 3 tables in my MySQL database : the Threads table (id, title) the Tags table (id, name) the pivot table ThreadTags (tagID, threadID) Let's admit I already have the tag IDs in array $tagIDs, now I want to have all threads linked to ALL those tags. My current solution is something like that : $stmt = 'SELECT id, title FROM Th...

What is the meaning of the '?', '()', and ':' symbols in PHP?

I've finally remembered what to ask. I never really got what : and ? do when a variable is being defined like this: $ip = ($_SERVER['HTTP_X_FORWARD_FOR']) ? $_SERVER['HTTP_X_FORWARD_FOR'] : $_SERVER['REMOTE_ADDR']; As you can see there is ? and : and ( ) Could anyone give me a brief detail about why and how they are used for? Thanks...

JQuery ajax function works but can't return the variable correctly

Hi all, I have a function runAjax that functions correctly. Unfortunately I am struggling to return the value I get from the ajax query. The ajax function assigns the returned value inside "contents" or "error" xml tags to the variable "result". If I alert the result variable inside the ajax function it alerts the correct value (i....