php

What php html tokenizer's can I use?

I need to process html submitted in my web application and don't want to munge the whole thing with regular expressions. What tokenizer approach and/or software should I take? ...

ReWriteRule Apache, php

Hello, I want to be able to redirect the user when they type in http://example.com/user/user-name to http://example.com/user/user-name, which displays user details This is what I am using but it gives me errors Options +FollowSymLinks RewriteEngine On RewriteRule ^.*$ /user/ [R] The error which firefox gives is Redirect Loop ...

php & mysql subscribe to search/matching queries

I have a real estate website that has several categories. And i want the users to be able to subscribe via email to a certain list of offers, they can either be offers from a category ... or offers from a search list. How can i store they're subscription the best way in mysql ... and also how do i go about and do the notification. The ...

PHP: Strange Array Problem - Where is my value?

I have an array ($form) which retreives some information from $_POST: $form = $_POST['game']; Now I want to work with the values in this array, but I somehow fail. For debugging I used these commands (in the exact same order, with no extra lines inbetween): print_r($form); echo '#' . $form['System_ID'] . "#"; and as returned outpu...

sql insert and update question

I have a form which to insert data into a database. This form takes the content of the fields, and then displays the result page showing the entered information in context. There is a link on this page to edit the user info, which go back to the previous form. Obviously, I do not want duplicate records inserted. Is there an easy way to u...

com_create_guid() is not defined : retruns fatal error

Hi I am using PHP 5 on my dedicated linux server 5.2.6 (cli) (built: May 7 2008 01:11:22) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies but com_create_guid function is not working to me it's returning this error message Fatal error: Call to undefined function com...

ASP.Net MVC or Zend Framework. What is your opinion.

I am looking to start a new project and I am trying to decide which framework to go with. I have been using ASP.Net for a while and enjoy it. My first introduction to web applications was with PHP and I still love it. The project should be a medium sized project maintained by 1 or 2 developers with a potential to grow. The only pros and ...

How do I do a search on my website

I wanted to add a search feature on a website that would allow users to search the whole website. The site has around 20 tables and i wanted the search to search through all 20 tables. Any one can point me into what sort of mysql queries I need to build? ...

Replace Local Links, Keep External Links

Hi guys, I have an API call that essentially returns the HTML of a hosted wiki application page. I'm then doing some substr, str_replace and preg_replace kung-fu to format it as per my sites style guides. I do one set of calls to format my left nav (changing a link to pageX to my wikiParse?page=pageX type of thing). I can safely do thi...

Best-practices for processing errors from database in codeigniter

I have a table with a unique key (date + userid) in my webapp database. When i try to insert record with existing date and userid, i'm getting error "dupicate key in table". I turn on database debug in application config, because i need use mysql error number and message. And now i need processing this error. I can use hard coded constan...

Looking for a better method of checking a variable repeatedly.

I recently created a site that simply has a variable and checks it against various possible values and gives an appropriate response. The program goes through using a lot of else if statements. I'm sure there is a better method of doing this, but not sure what to use. I'm still learning PHP really. Here's the source code to give you a ...

Writing PHP Code to a File

Hi all, I am wondering if it is possible to write php code to a file. For example: fwrite($handle, "<?php $var = $var2 ?>"); I would like it produce the exact string in the file and not the eval'ed code. Is this possible? I am currently getting the following output (where $var = 1 and $var2 = 2): <?php 1 = 2 ?> Whereas I want t...

How do I offer an Ajax POST response to the user as a download?

I'm trying to include a vCard export function in an existing page full of account information. The ugly methods would involve 1, submitting a form to the same page, processing it and re-rendering the whole page, or 2, a GET targeting an iframe on the page. I'd really like to avoid both of those, but I may have to use #2 to achieve the ...

PHP Login System problem... Sending errors from page to page...

Hi, I have a login form in every page of a website so the user can login from everywhere. I have a login.php file that I refer to it from the form (using 'action'). I use $_SERVER['HTTP_REFERER'] to redirect the user to the same page he logged in from when he succesfully log in or when he logs out. But if there was a problem logging ...

PHP file_get_contents($url) slow performance

My web page uses Google charts to produce five graphs. If the graphs are not already cached, I have the following line of code that retrieves the image. $image = file_get_contents("http://chart.apis.google.com/chart?".$query); When that code is executed in a loop, it takes 10 seconds to get each image. But, if I change the code as to...

Best way to query calendar events?

Hi, I'm creating a calendar that displays a timetable of events for a month. Each day has several parameters that determine if more events can be scheduled for this day (how many staff are available, how many times are available etc). My database is set up using three tables: Regular Schedule - this is used to create an array for eac...

Processing a string in PHP

Hi, I need a way of sorting a string I have in PHP, the string is formatted like the one below, but is much bigger. { 1, 3, 1, 2, }, { 2, 3, 2, 1, }, { 3, 3, 2, 2, }, { 1, 2, 3, 1, }, What I would need it to do is turn each set of numbers that is in the brackets into an array. So in this case there would be four arrays with four value...

How to use php function without load source file ?

I would like to use my function, for example DebugR(), but I don't want to use a require or include (with include_path) to load the function file that contains the source. I know I could use an autoload, but this action must be generic in my php configuration. I think I must create a PHP extension, but is there another way? ...

PHP: how to get only the words between a parenthesis () and clear everything else

Hi, I have an array with some info.. for example: "(writer) &" or "with (additional dialogue)". I want to clean this so I only get the text between the parenthesis () and clear everything else result: "writer" or "additional dialogue" how can I do this?? Thanks!! ...

How could I do the same thing using asp.net and jquery instead of php?

The author in this screencast is using jquery to submit data to a database using php. The link is here: http://blog.themeforest.net/tutorials/jquery-for-absolute-beginners-day-13/ How could I do the same thing using asp.net and sql server 2005? ...