php

PHP: unexpected T_VARIABLE error

Okay, I know this is a common enough question, but all the solutions I've found thus far have involved a missing semi-colon or curly brace, both of which I know is not the case for me. I have a class that works FINE with this variable assignment: session.php: <?php class session { ... var $host = 'localhost'; ... ...

PHP can't iterate through too high or too low

[Disclaimer: I am new to PHP, and I am just learning, so please no flamers, it really hinders the learning process when one is trying to learn, thank you.] The code below runs, the only problem is that it does not tell the user when the number is too high or too low, I am doing something wrong, but I can't see the error? <?php //St...

Case In-sensitive query in php

Hello! I try to make a registration form. When user post the fields, i check USER_NAME. If exist then no inster the row to MYSQL. After post: $check = "SELECT name FROM test WHERE name='".$_POST['user_name']."'; $result = mysql_query($check) or die (mysql_error()); $numrows = mysql_num_rows($resutl); if ($numrow != 0){ ech...

Mac OS X 10.5 Apache and Subversion upgrade alternatives

I've found myself down a rabbit hole and would like advice. It looks like Mac OS X 10.5.8 comes bundled with a pre-configured version of Apache 2.2.11 (located in /usr/sbin), PHP 5.2.10 (located in /usr/bin) and subversion 1.4.4 (located in /usr/bin). I have installed MAMP for MySQL 5.0.41 (located in /Applications/MAMP/...) which come...

Programmer trying to figure out a self project using PHP

I have just finished teaching myself a bit about PHP and now I am looking for a self-project to do. Does anyone have any ideas regarding a project that can use the extent of what PHP is primarily used for, ie. including database functionality, or perhaps a more complicated project learning about advanced PHP? I'd rather not create a blog...

resetting form with javascript won't work...

Here is my main page code: <form><iframe name="iframe_pic" src="iframe.html"></iframe></form> Here is my iframe.html: <script type="text/javascript"> function reset_imageform(){ f = document.getElementById("pic_form"); f.src=f.src; } </script> </head> <body><form name="pic_form" id="pic_form" enctype="multipart/fo...

Multi-Tier in PHP..the right way??

I have a specific question, that could use a general answer... When building Multi-Tier applications in PHP, does everything have to be done in the Business Logic layer, or can any layer do work... Example, Lets say I'm building an application that shows user information (from the database) on the presentation layer. Should I use the bus...

help with form target, it popups in a blank page instead of the div I chose.

I have set the target of the "pic_form" to a div (pic_target). The form (pic_form) and the div (pic_target) are both inside the same iframe (iframe_pic). Whatever I set the target to of the "pic_form", a new page pops up and there is my php script (imageUpload.php) output... WHY? Here is my main page code: <form><iframe name="i...

Helper script/tool for "one a day" reminders applications

I am looking for a helper tool/ script that can be used to power an application that presents some randomized content periodically eg once per day. Example applications are "One a Day Bridal Prep", "Daily Quotations", "Daily Programming Tips" etc etc It is simple enough to code one up myself but I am wondering if I don't need to reinvent...

Select ISO 8601 Timestamp from MySQL Database

Hello, I am currently using PHP/MySQL and the jQuery timeago plugin. Basically, I need to pull my timestamp from the database and convert it to ISO 8601 format. Like this 2008-07-17T09:24:17Z Currently, my timestamps are in the database in this format: 0000-00-00 00:00:00 I have tried using timeago with my currently formatted time...

How to pull out the values of ticked checkboxes using PHP?

while ($row= mysql_fetch_array($result, MYSQL_ASSOC)) { $id=$row[id]; $html=<<<html <tr><td> <input style="float:left" type="checkbox" name="mycheckbox" value="$id"> <span style="float:left">$row[content]</span> <span style="color:black;float:right">$row[submitter]</span></td></tr> html; echo $html; } Since the HTML code is g...

safe place to save code

Where is the most secure place to store sensitive code on a server (ex, authorization php, contact scripts, sensitive or protected javascript)? You guys/girls got any tips or tricks on how to protect that kind of stuff? ...

Massive API/Framework mashup issue (oAuth, Facebook, Twitter, Code Igniter)

Hi all, I'm having (many, but for now,) one problem with a project I'm working on. It is a PHP project run on Code Igniter It is a Facebook app that wants to use oAuth Twitter authorization CodeIgniter by default clears the $_GET array because it uses the URI for controlling MVC stuff. You can turn this off to access the GET array, ...

CodeIgniter: post variable not being read

I have a controller user with a method login For some reason, when I call: $this->post I get an error Undefined property: User::$post While, this works fine: print_r($_POST); ...

PHP regular expression replace?

I want to split alpha-numeric (with space) and non-alpha-numeric by comma in a string. I tried with this... $str = "This is !@#$%^&"; preg_replace("/([a-z0-9_\s])([^a-z0-9_])/i", "$1, $2", $str); But I got this result... This, is, !@#$%^& How can I fix the search pattarn to get this result? This is, !@#$%^& Thanks. ...

What's a good URL shortening script?

What's a good URL shortening script that does the following things? It is customizable (HTML and CSS) Users can create accounts Users can delete shortened URLs There is a bookmarklet Users can set privacy codes Some sort of API (so Twitter clients could use it, etc.) Thanks a document.write(Math.random()*Math.pow(10,18)); :) ...

Can't connect to mysql using Bitnami lamp stack through php

Ok, this will be a long question. I'm trying to get something up and running on my university account. We have a public_html folder that we can use as web space to host anything we want there. I've installed Bitnami lamp stack in the public_html folder (probably not the best idea, security-wise, but I'm only going to test this applica...

PHP - Doctrine saving to more than one table

Hi, I have a table that is related to another. Is it possible to use the auto incremented Id of table one as the foreign key of table two in one statement, rather than using lastInsertId and performing a separate save on each table? Any advice appreciated. Thanks. ...

How do I remove parts of a sentence?

Hello! You are with Andy. Good job! Hello! You are with Naruto-san. Good job! Hello! You are with DragonFang. Good job! Hello! You are with Adam Chan. Good job! Hello! You are with Dude. Good job! Hello! You are with Signore. Good job! Hello! You are with Athena. Good job! Hello! You are with EL NwithJA. Good job! Hello! You are...

Creating a file upload template in Doctrine ORM

Hey all. I'm using Doctrine 1.2 as my ORM for a Zend Framework Project. I have defined the following Model for a File. File: columns: id: primary: true type: integer(4) unsigned: true code: type: string(255) unique: true notblank: true p...