php

HTML anchoring PHP echo values

Hello guys, I am trying to anchor an echo value. My code is as follows; while ($row = mysql_fetch_assoc($result)){ echo $row(['links']; } I would like to anchor the value of echo $row['links'] in HTML. Thanks guys. ...

RegEx Backreferences

Having the following regular expression: ([a-z])([0-9])\1 It matches a5a, is there any way for it to also match a5b, a5c, a5d and so on? EDIT: Okay, I understand that I could just use ([a-z])([0-9])([a-z]) but I've a very long and complicated regular expression (matching sub-sub-sub-...-domains or matching an IPv4 address) that wou...

Solutions for the potential lack of permission to mkdir() from within a php install script.

Alright, so I have a problem. I need to create a folder to store compiled templates in php. I have an install script that tries to mkdir() an appropriate directory (compiled_templates). Invariably it returns this warning. Warning: mkdir() [function.mkdir]: Permission denied in /home/tchalvak/sites/quotesite/quotes/install.php on line...

jQuery, php and Ajax issue: Can't make dynamic link load dynamic content

There's a great tutorial on IBM's website which walked me through a simple search/results list using jQuery,PHP and Ajax. I was able to make it work and it's really cool. One problem. I want the results to be hyperlinks and I can't get any java script to run on the results. Here is the script I have (includes what was in the tuto...

Fastest way to convert string like id=1&type=2 into array in PHP?

I need to change it into : $arr['id']=1; $arr['type']=2; ...

Mysqldump create empty sql file? [php & mysql on Windows]

Hi all, I tried to dump a database: <?php $dbhost = "localhost"; $dbuser = "XXXX"; $dbpass = "XXXXXXXX"; $dbname = 'testdb'; $list = shell_exec ("C:\wamp\bin\mysql\mysql5.1.33\bin\mysqldump.exe $dbname --user=$dbuser--password=$dbpass > dumpfile.sql"); ?> I tried both specified full path to mysqldump.exe or just use mysqldump, it s...

Making cookies with php and perl

I am trying to set a cookie using PHP, so it's the same as the one output by the Perl code below: my %auth; $auth{'username'} = $username; $auth{'password'} = $password; my $wholesaleauth = $co->cookie ( -name=>'wholesaleauth', -value=>\%auth, -expires=>'+1h', -path=>'/' ); Now I do not know perl and all and do not want to change ...

PHP and MySQL problems

I'm trying to count how many times a certain article has been graded for example how many times have users_articles_id 3 been graded by my members. I'm also trying to count the points for a certain article for example users_articles_id 3 is related to the ratings database by its ratings_id the rating points should be a total of 13. I...

Eliminating the need for "controller" in the filename of a Zend Framework controller

How do I eliminate the need for the "Controller" suffix in the filename of a Zend Framework controller? It just gets tiresome to keep typing that suffix in when creating controllers, and meanwhile the file is already in a controllers folder so it's superfluous. For instance, by default the homepage on a site goes to "controllers/IndexCo...

generating personal image to use as signature

i want to make a personal image, that shows the last 3 items from the user (so he can use as forum signature, but it cant be a dynamic image like user?id=1 because most forums blocks that) im planning to use GD, thats not a problem but: - to update the image as data is inserted, do i just put a "update image" in the insert script or ther...

using sqlite with php and sqlite-programs

Hi, I'm trying to use sqlite with php. I used some tutorial: $db = sqlite_open("db.sqlite"); sqlite_query($db , "CREATE TABLE foo (id INTEGER PRIMARY KEY, name CHAR(255))"); sqlite_query($db, "INSERT INTO foo (name) VALUES ('Ilia')"); sqlite_query($db, "INSERT INTO foo (name) VALUES ('Ilia2')"); sqlite_query($db, "INSERT INTO foo (na...

RegEx: \w - "_" + "-" in UTF-8

I need a regular expression that matches UTF-8 letters and digits, the dash sign (-) but doesn't match underscores (_), I tried these silly attempts without success: ([\w-^_])+ ([\w^_]-?)+ (\w[^_]-?)+ The \w is shorthand for [A-Za-z0-9_], but it also matches UTF-8 chars if I have the u modifier set. Can anyone help me out with this ...

Including $variable in MySQL

Here are my failed attempts to include a PHP variable in a MySQL expression. Replacing the variable with a 1 results in the results being printed. Any help will be appreciated. $query = " SELECT name FROM teams WHERE id = '$shooterID'"; $shooters = mysql_query($query) or die(mysql_error()); $i = 0; while($shooter = mysql_fetch_arr...

How to run database class methods inside other classes?

I am new to using classes in PHP, I just realized, in most of my class methods, I need to do some mysql queries. I have another class that handles my connection and queries but how should I go about calling that class from other classes? Doesn't this kind of defeat the purpose of using classes if all my classes rely on my DB class? ...

How to split the array keyword value separated by commas in PHP?

Hello! I have an array in $_POST: Array ( [tags] => Javascript,PHP,Java,C++,Python) How can i convert this Array into Array like this: Array ( [tag1] => Javascript [tag2] => PHP [tag3] => Java [tag4] => C++ [tag5] => Python) I guess i need to use regexp to remove the commas and do split in "foreach as".. But i'm so newbie in PHP....

Remove One Time Login System in Drupal Froget Password

How to remove one time login system in Druapl ? I don't want to do this system when I click forget password. I want to generate new password and send to user. ...

Setting a variable like this $config['business']

I was looking at some source code, specifically for Paypal IPN, and I noticed the author sets two variables in this format: $config['business'] and $config['different_text'] Is there a special reason other than the obvious organization for declaring my variables this way or is this Paypal settings? ...

Don't understand serialize()

I'm looking at this function: serialize() for PHP and I don't really understand what is it's function. Can someone provide a simple example with output? ...

PHP ORMs: Doctrine vs. Propel

Hi, I'm starting a new project with symfony which is readily integrated with Doctrine and Propel, but I of course need to make a choice.... I was wondering if more experienced people out there have general pros and/or cons for going with either of these two? Thanks a lot. EDIT: Thanks for the all the responses, useful stuff. There's n...

Regex - Unicode Properties Reference and Examples

I feel lost with the Regex Unicode Properties presented by RegexBuddy, I cannot distinguish between any of the Number properties and the Math symbol property only seems to match + but not -, *, /, ^ for instance. Is there any documentation / reference with examples on regular expressions Unicode properties? ...