php

Php payment solutions?

I am creating a php/mysql application for a university project and I am looking for any possible solution to allow users to buy from my site . ...

php - how to shorten a string outputed?

im using php if i have an uknown length of a string being outputted how can i limit it to only 16 characters to be outputted? ...

Why won't mysql_real_escape_string() work?

I'm trying to write someting into the DB using PHP but if I try to use mysql_real_escape_string() I don't get any errors but nothing gets saved into the DB and I don't know why =/ specially because I did the same on another PHP file and it worked perfectly... <?php if(isset($_POST['reporte'])) $falla = $_POST['reporte']; else ...

Display mysql join/union results differently based on table

Hello, I need to generate a list of activity from multiple tables in order of the date they were entered into the tables, but when i spit them out (with php), i want each result to look specific to a design that i have for each table. ie...i have the tables: listings, photos, comments -the results from listings should be designed...

Ruby addict looking for PHP subexpressions in strings

Assume color = "orange"; Ruby: puts("My favorite color is #{color.downcase() + 'ish'} -- at least for now."); PHP: print("My favorite color is {strtolower( $color ) + 'ish'} -- at least for now."); The PHP version does not work like I would like it to. I'm not looking for any language wars, I just want to know if anyone knows of a...

AJAX Call to PHP script gives me 500 Internal Server Error??

Hi I make an AJAX request like so using JQuery: $.ajax({ type: "GET", url: "getvideo.php", data: 'videoid=' + vid, I use firebug to tell me whats going on and it tells me a 500 internal server error has occurred? wtf Here is part of the script concerned: $videoid = $_GET['videoid']; $get = new youtubeAPI(); $get...

PHP support for Google App Engine?

Does anyone have any idea as to when the Google App engine will support PHP? ...

Getting the name of a child class in PHP

Lets say I'm building a base class which will be extended upon by the children class. So a base class is called Base and children can be Child1, Child2, etc. In the base class's constructor, how can i get the value of Child1/Child2? This is all using PHP ...

Can I stop CakePHP fetching all rows for a query?

Hi, I'm using CakePHP with $modelName->find(...) calls to select quite a number of rows (could be hundreds) Normally, in PHP/MySQL of course this wouldn't be a problem, as you fetch them in a while loop. But, CakePHP loads all rows in to an array which exhausts the memory limit. Is there a way to use the $modelName->find(...) construc...

PHP exec() will not execute shell command when executed via browser

I have a certain PHP script that calls exec() to execute a command to convert a PDF to JPG. This command works fine in bash. To preempt your initial troubleshooting guesses, note the following: safe_mode = Off Permission on the directory containing the PDF and the script is set to 777, and this directory is also where the JPG is bein...

Learning PHP and web-programming for intermediate programmers

Hi. I would like to know some good resources (book or website) on learning PHP for those who are already familiar with programming. Many of the tutorials I've been finding are for people who never programmed before and take way to long to go through to even learn basic language constructs. The optimal resource would not assume previous ...

How do I select mysql database in php?

I have this code: if(!mysql_connect($host,$user,$passwd)){ die("Hoops, error! ".mysql_error()); } ...no error from here. if(!mysql_select_db($db,$connect)){ $create_db = "CREATE DATABASE {$db}"; mysql_query($create_db,$connect...

PHP Pass File Handle to user so that file downloads & saves to their machine

Hello all, I am downloading a file from another server. I wish to push this file to my users rather than saving it to my server. In other words, pass them the file handle so it just passes through my server and saves to their machine. How can I do this? I have this so far: $handle = fopen($_GET['fileURL'], 'r'); $filename = stream_ge...

PHP live updating

I was wondering if there is a way to use php to return the values from a search without having to reload the whole webpage or using iframes or anything like that. I've tried searching for it but I always end up with AJAX and I was wondering if there is a PHP way for it... ...

Steps in implementing hashtable in PHP and Mysql

Hi, I am new to programming language and I am using PHP and mysql. I got an assignment to do a hashtables in php. What I need to do is, store items that a user collected and then display it. After do some research over the internet, I will do the following steps when implement the hashtable, please correct me if I am wrong: Set up the ...

Should I always verify if an object is NULL ?

Hello, I have a object built through a factory containing my parameters read from the url. From this object, I can get the language parameter $language = $my_parameters->getLanguage(); $language is NULL if it isn't been set. $language may also be invalid ( $language->isValid() returns false ). So, to build my page, I need som...

What is the best way to clean a string for placement in a URL, like the question name on SO?

I'm looking to create a URL string like the one SO uses for the links to the questions. I am not looking at rewriting the url (mod_rewrite). I am looking at generating the link on the page. Example: The question name is: Is it better to use ob_get_contents() or $text .= ‘test’; The URL ends up being: http://stackoverflow.com/questio...

Questions about Php and Mysql Hash Table

I am a new php and mysql programmer. I am handling quite large amount of data, and in future it will grow slowly, thus I am using hash table. I have couple of questions: Does mysql have hash table built in function? If yes, how to use that? After couple of days doing research about hash table. I briefly know what hash table is but I ju...

Want to display the current date/time

Hi I'm using php and sql through odbc to write a program and i hav got abit stuck in a part where i want to display the current date/time in the format date('Y-m-d H:i:s) but it only displays the gmt time. I want to add 8hours to it.Can any of you b able to help me.Thank you so much ...

Calling a function from a string in C#

I know in php you are able to make a call like: $function_name = 'hello'; $function_name(); function hello() { echo 'hello'; } Is this possible in .Net? ...