php

MySql using primary index instead of multiple column one!

Ok so I've a SQL query here: SELECT a.id,... FROM article AS a WHERE a.type=1 AND a.id=3765 ORDER BY a.datetime DESC LIMIT 1 I wanted to get exact article by country and id and created for that index with two columns type and id. Id is also primary key. I used the EXPLAIN keyword to see which index is used and instead of the multiple...

What JSON does this CF code return?

Trying to implement the excellent jQuery bidirectional infite scroll as explained here: http://www.bennadel.com/blog/1803-Creating-A-Bidirectional-Infinite-Scroll-Page-With-jQuery-And-ColdFusion.htm For the server-side, which returns JSON, the example is in ColdFusion. Trying to implement it in PHP. I need to find out what the format ...

Is it a good idea for a web developer to know a general-purpose language?

My focus is on html,PHP,mysql, javascript, css, ajax because that's what many websites need. I am still new to the web developing scene(only 5months) so I am busy learning all those topics. My question is whether or not to add a general purpose language, such as Python or Java, to the list. I only played a little with Python so I don't...

Get last Inserted 'Id' while doing multiple entry to mysql in codeigniter

In my form, there are values to be inserted to multiple tables. After inserting to the first table, i have to insert the other values, along with the 'id' of the entry to first table as reference. What is the best way to do this? Is there any codeigniter specific way? ...

Changing order of fields in Drupal's content type

I am using Drigg on Drupal 6.17. Drigg has a content type called as "Scoop". I try to change the labels and order of fields. Normally, this is done in Content Management > Content Types > Manage Fields . But some fields that are shown in Create Content screen are not shown in Manage Fields screen. The screenshot of Manage Fields is her...

Search specific wordpress MU tables MySQL

I have a blog built that is grabbing information from another set of tables in the MU Database. I need to now be able to also search that database. Does anyone have that MySQL query needed to make a clean search? ...

what is heavier on load time: css or php requests?

I'm using a cms (Wordpress) and have a gaggle of external stylesheets I'm loading on each page, though some of these stylesheets are page specific. Overall I'm getting bad scores from Yslow and Page Speed so I'm considering adding some php conditionals to tell the browser to load only the page specific css files as necessary. However, ...

Allowed memory size error

Hi, I have programmed one hand and tossed it on my host's server but get the error here Fatal error: Allowed memory size of 536870912 byte exhausted (tried to allocate 4294967296 bytes) This is my code <?php require 'opsatning/top.php'; ?> <!--[if IE]> <style> .arrow { top: 100%; }; </style> <![endif]--> <div id="content_indhold"> <?...

Creating FTP user dynamically

I need to create FTP users via a C# software, which is run Client-Side, I have no idea where to start or how to do that, I am not even sure if this is possible as this may require to be logged as root? My other option would be to call a PHP script via the C# software, which could call a system() script? This function needs to work on L...

Returning php from database and rendering the code

Im managing my web content a DB. When you hit a certian page, a query is made to the db to return the content for that page. Usualy I just store static html as a string and when it's returned from the db and placed into the webpage, it renders correctly. But now, some of the content actually contains php and when returned, the php is dis...

first thing i do in my php function is define an array why is undefined later in the function?

Hi. I have a long function with many if statements and such. The first thing i do in my function is this: $text = file($read_text_file); The $text array contain all text in the site therefor I need this array to be available in my entire function and I though I would accomplice this by defining the variable first thing in the function, ...

Remove all the whitespace after ',' and make first letter uppercase in CSV with PHP

I'm having a CSV like this. john,joy, anna, Lucy Bravo,boy I want to remove whitespace after ',' if it exist. And also make the first letter after ',' to be capital letter, if its not capital already. That is it should be like this: John,Joy,Anna,Lucy Bravo,Boy Only the whitespace after the ',' should go. I tried myself. But all fa...

Impossible to show errors with PHP under IIS7.5

The server is : Win 2008 R2 Php version is 5.2 if I remember correctly. (has been installed along with wordpress & mysql with WPI). I did install wordpress along with arras-theme. On some pages I do have 500 errors. Problem is, can't really debug and fix the error as it's 500, no errors are showing (no fatal/warning/notice or nothing). ...

php cms and custom template

I want to create a site using a cms, but I want to use my own look and feel. I want to be able to upload downloadable content such as mp3 files with a flash player. I also want users to sign up and login. I want to be able to track and log downloads and uploads done by users. Any suggestions? ...

Tricky SQL for a smart search

I am using a form through a PHP CMS system, that defines custom fields and such. One of the custom fields allows for an input field which does a smart search. What this means is that when you start typing, it shows the records that match, quite similar to google suggest. The smartsearch input field relies on a stored mysql search, and ...

How can I compare MySQL Versions in PHP?

Okay, so I'm getting my MySQL Version like so: preg_replace('#[^0-9\.]#', '', mysql_get_server_info()); Which gives me a number like: 5.1.36 That's all good. What I need to do, is compare that version with another version. I was about to attempt to write my function to compare them, when I thought of version_compare(). However, upon ...

executing php script in console

Hey, i'm trying to execute a php in the console, but each time i run it: php myscript.php it only outputs the content of the file, it dowsn't run it. output: <? echo 'test'; ?> instead of: test What's wrong? I have php installed under c:/program files/php and the environment variable is set. Thanks, Dave ...

Is it bad to have a long name for an associative array in PHP?

I have a function which must return one dimensional associate array, like $user_info[$index]=value where $index is a string which consist of user_id full_name photo_file_name for example, my associative array could look like $user_info['user-123456789~~Bill Gates~~bill_gates.png']=$value. I need user_id, full_name and photo for anot...

which is best?? muliple table or single table??

HI I am still confused that whether I need to use multiple table in a single database or single table in single database?? I do have near about 30 columns for one record. ...

Adding mcrypt to Plesk

Hello, I am running Plesk v8.2.0 and I have a program that needs mcrypt module installed but I cant find any relevent infromation on how to get mcrypt setup on Plesk. It is on a Unix based server. Does anyone have any ideas on how to set this up? Any infromation would be greatly appreciated ...