Hi, I'm creating a movies website, IMDB.com like.. I'm really new to PHP and programming at all but I have some books and StackOverflow of course :)
I have already done lot of the work, but now I have more than 600 lines of code (PHO only) per page and more than 20 database tables only for storing and geting the movie data (many-to-many...
Since PHP's call_user_method and call_user_method_array are marked deprecated I'm wondering what alternative is recommended?
One way would be to use call_user_func, because by giving an array with an object and a method name as the first argument does the same like the deprecated functions. Since this function is not marked deprecated I...
I'm new to Drupal 6.10 CMS and PHP too. I'm creating my website with drupal and I have found a module called Webform I like it, it's pretty easy to create forms with different types of fields and file uploading. The one thing that i can't figure out is how to add Rich Text before all fields. Something like introduction to the form. This...
Are constructor methods in interfaces bad?
...
Hi There
I've write a web-application in PHP which has 30 tables+views. From time to time my application doesn't work and think this is related to the mysql db.
Unfortunately I can't see the errors from the browser on that server because php.ini says so. Also when I try to connect to mysql db using phpMyAdmin the connection fails wh...
I have this code:
$rows = array();
$res = mysql_query($someQuery);
if(!mysql_errno())
while($row = mysql_fetch_assoc($res))
$rows[] = $row;
some query is an arbitrary query that I write in to a form. The mysql_errno catches the case when I write a mysql query with errors in it. But, I just discovered that when I do a "Del...
I am reusing a curl function from a long time ago that is now acting differently than I remember. In this particular case, I'm authenticating a user's Twitter credentials. Here's the code as it stands now:
$cred = $_POST['twitter_username'].':'.$_POST['twitter_password'];
$url = "http://twitter.com/account/verify_credentials.json";
$c...
I am doing some maintenance work on an older system that is running PHP 4 and talks to a MS SQL2000 database via FreeTDS. I know, it already sounds somewhat scary!
A lot of the code used unsafe string-concatenation for generating SQL queries. I have done some work to try and filter the input to make things safer but it is giving me a ...
I have some data that won't printf....
echo works, but not printf
There is data in the string, also simplexml_load_string won't parse the string.
There is some binary or invisible character that I cannot see and can't get the ordinal value for that is causing printf to fail as well as most other string functions in PHP.
Clearly this ...
Dear Abby,
I've been working on a PHP website which utilizes a MySQL database (using PDO). I would just like to know it is secure before I go ahead and release it to the public. It is a free, non-profit website so I don't really plan on making money from it and therefore I would rather not invest hundreds or thousands of dollars for a s...
Hi,
I have installed a xampp (apache + mysql + php) stack on a portable volume (truecrypt volume on a usb drive) that I use on different linux machines, for webapp development.
This volume is formatted in ext3, so I run into permissions problems as I can't be the same user on each machine. For example I tried to check the git status of...
compact() and extract() are functions in PHP I find tremendously handy. compact() takes a list of names in the symbol table and creates a hashtable with just their values. extract does the opposite. e.g.,
$foo = 'what';
$bar = 'ever';
$a = compact('foo', 'bar');
$a['foo']
# what
$a['baz'] = 'another'
extract(a)
$baz
# another
Is th...
In a lot of languages with simple OO capability (PHP 4), or misunderstood OO capabilities (Javascript, C using function pointers, etc.), you'll end up with a function naming convention that uses leading underscores to to indicate privilege level.
//ex.
function _myPrivateFunction(){
}
While individual teams are always going to come...
I have the (mis)fortune of having a large project source-base in which I am working primarily on PHP and JavaScript. I have to have the full project area as the project root in Eclipse, but unfortunately this includes several directories that drive the validation built into WST/DLTK/etc. nuts.
I have tried disabling all validators in th...
I need to generate an editable xml file to supply content to a flash website.
I am generating my file with a html form, and htmlspecialchars e.g.:
$currentItem = htmlspecialchars(stripslashes($currentItem));
This is to prevent xml entries which would produce the error "XML Parsing Error: not well-formed", such as
<entry title=...
Is there anyway in Javascript to compare values from one array and see if it is in another array? Similar to PHP's in_array function?
...
Ive been trying to display formatted content blocks from a xml file with no luck. Ive been using simplexml_load_file and other varients which Im now seeing cannot deal with the xhtml tags within the called tag ... eg.
//php contents
<?php $xml=simplexml_load_file("file.xml");
echo ($xml->entry); ?>
//xml contents
<entry>
<p>This...
Hi Friends,
I have created a page in PHP, in that i need to load a dropdown2 corresponding to the value of dropdown1 without refreshing the page. The values for those dropdown's are from the database.
I dont want to refresh the page for every click, Please guide me regarding this..
...
Hi,
I have seen many PHP function on how to generate a <ul><li> tag but my array input is quite complicated I guess. It is an array returned from a custom function called xml2assoc
My question is how can I convert the returned xml2assoc array result to a <ul><li> formatted HTML code using PHP.
Thanks.
$tree = array(
0 => array(
...
I have got a problem with two tables:
CREATE TABLE IF NOT EXISTS `addresses` (
`adr_id` int(11) NOT NULL auto_increment,
`per_id` int(11) NOT NULL,
`adr_street` varchar(50) NOT NULL,
`adr_houseno` int(11) default NULL,
`adr_housenoadd` varchar(10) default NULL,
`adr_postalcode` varchar(25) NOT NULL,
`adr_city` varc...