php

MySQL unique id through multiple tables

hello everybody, i wanna build a database-wide unique id. that unique id should be one field of every row in every table of that database. i have different ideas on how to achieve this, and really like to know whats your opinion... First idea is to create one master-table with an auto-increment-field and a trigger in every other table,...

How do you define a PHP include as a string?

I tried: $test = include 'test.php'; But that just included the file normally ...

php variable in html no other way then: <?php echo $var; ?>

hi i work a lot in mixed html and php and most time i just want solid html with a fet php variables in it so my code look like this <tr><td> <input type="hidden" name="type" value="<?php echo $var; ?>" ></td></tr> wich is quite crap isnt there little code something like: <tr><td> <input type="hidden" name="type" value="$$var" ></td><...

PDO: check tags presence in db and then insert

Hi, I'm working with PDO connection for mysql and I'd like to have some opinion on a query I use to check if tags are present on the database, and to add it in the case it isn't. // the tags are allready processed in $tags array $check_stmt = $connection->prepare ("SELECT * FROM tags WHERE tag_name = :tag_name"); $save_stmt = $connect...

Zend_Db/PDO Testing for the Table Storage Engine

Brief background - Im writing a special import manager to be run via cron. The basic operation is: Delete all records from table Load data from a file or a string into the table Not to difficult, however because of the apocolyptic delete at the beginning of this sequence id like to use a transaction so i can rollback if anything goes...

Can't use Xdebug to debug Code Igniter App using Netbeans 6.8 IDE

Hello guys. I can't use Xdebug to debug a application built with Code Igniter, but i can use it to debug any other PHP file as long it doesn't use the same Structure for url solving that Code Igniter uses. Meaning: In a simple PHP file with no Code Igniter, when i use NetBeans debugging the browser goes to: http://localhost:86/index.ph...

cURL not properly downloading images

Hi, I'm having a problem with cURL. I am downloading images and saving them to a folder. The file that cURL creates has the right filesize, which makes me think that the headers are being read properly. But, when I open the file up in my browser or in any picture-viewing application, only a tiny bit at the top appears to actually hav...

passing null values from ajax to phpscript

Hello, I am having some problems with null values Is there a good way of passing the null values from js in a way that they are interpreted the same. This apparently is not the same ajaxNullVar = null; post_var = {'action': 'update_foto','fotoid': fotoid, 'ajaxNullVar': ajaxNullVar }; $.ajax({ url: post_url, ...

How to include from the very root with PHP

Hi all, I'm building a CMS on a SaaS principle. I have my webserver (dynamic dedicated) up and running. It's all going like expected, but now I've come across my templating system, and later on simple things such as filehandling. Logically, each client has an own hostingaccount. All the hostingaccounts will be requesting to the masterda...

Mutliple file upload with jquery, php array problem

I'm trying to make a multi file uploader. I'm using "Multiple File Upload Magic With Unobtrusive Javascript" None of the files upload. I'm pretty sure this is because it's putting the files into a array and I don't have my php set to handle the array (which I don't know how to do). Any help on what I'm doing wrong? Thanks in advance! :...

Expanding PHP Markdown to Accept CSS Classnames

I'm a huge fan of Markdown (using it in nearly all of my PHP projects) but not a fan of its limited output. Much of the rendering is a bit too simple, and doesn't really allow me much control or freedom regardings its layout. For instance, I can insert an image: ![Alt Text](path/to/image.jpg) This is my image! But that will simply be...

PHP command line interface passing in multiple files

I'm familiar with the basic of CLI and $argv array with php. Example: <?php // test.php var_dump($argv); ?> $php test.php datafile.txt 10 100 will produce: array(4) { [0]=> string(8) "test.php" [1]=> string(12) "datafile.txt" [2]=> string(2) "10" [3]=> string(3) "100" } What I'm trying to do is pass all files...

Upload stop working suddenly ! move_uploaded_file problem

I have a script on my server for uploading file. It is working fine before but suddenly it cannot upload files to the server. I did not change the code, I did not change anything related to php setting or directories permission also for the server. I did not change any thing in the webserver (apache). I created a small script to isolate ...

Is PHP the only choice re: massive and rapid uptake of a re-deployable, extensible web application?

My own answer to this question is YES, but I'd like to hear from others. Put another way the question could be: Would the success of 1-click-install WordPress (not WordPress.com, which is SaaS) be possible if it weren't written in PHP, all other things being equal? The critical associated requirements I believe support PHP are: hosti...

Saving "Tags" - Quickest Way

I want to save tags related to a discussion post. The same as the 'tags' that Stack Overflow uses. What is the best way to do this? I was thinking of saving them in the 'discussion' table as a single comma separated string, but I'm not sure if this is the 'fastest' way assuming there will be lots and lots of rows in the discussion tab...

Drupal-6: Why can't a post be referenced?

I am making nodes programmatically. One node field is a nid reference to a node of type Meet. I have set these attributes to a real node of type Meet. However, when I run this node object through node_validate(), I get an error: Meet: this post can't be referenced. Why does this happen? Here is the node object: stdClass Object ( ...

PHP script to find domain name age

I am trying to write a script (in PHP) that find a domain age (creation date and maybe if possible, last update and expiration date as well). I want the script to return something like: 2009,2009,2010 if creation date is 2009, update date is 2009, and expiration is 2010 (an array) help? (This is NOT a homework question so please provid...

performance of eclipse and zend debugger

Hi, I've recently moved my development from linux to windows 7 with the purchase of a new laptop. I have noticed that there are some problems, with my once working Lucene searches. My Searches are not returning results that they were when running on linux, and there are some issues with other code, which I am working through debugging....

How to make my code more secure

Hello, I've made a voting on comments like the one this website has(something similar), and I'm slightly concerned about possible http request misuse. You'll know what I mean after I show you the questionable code: $.ajax({ type: 'POST', url: 'http://localhost/comments/vote_down/' + post_id }); Now its still on localhost but it wi...

Modify hyperlinks with PHP

I'm using a regular expression to turn URLs in blog comments into clickable hyperlinks. However, i also want to do the opposite: Since i allow certain html tags (but not <a>), if somebody types in a hyperlink, i'd like to change it from: <a href="http://www.example.com"&gt;My Link</a> into My Link: http://www.example.com where the ...