php

Flash upload keeps going after page refresh

I have a rather strange problem, well strange to me. I have a file upload tool that I created in flash (as2). The file uploads images and then writes the image details to a database. However, I seem to have a problem then when I refresh the page, the upload script keeps working. And this seems to cause some issues with writing to the d...

How to display thumbnails with category by category

http://pastie.org/962429 I have the above SQL. There are three categories, webdesign, logos and prints. I want to display them as following html. http://pastie.org/962432 Basically pulling thumbnail image and name from database category by category. I am not really sure how to do it. I will appreciate any inputs or help. Thanks ...

(PHP)how to hold javascript alertbox on screen

when user changes password I want to show message "Successfully changed!" and when user clicks on OK button of alert box I call logout.php and force user to login with new password.But the problem is PHP header() is not waiting for alertbox and directly goes to logout.php. my code- if($count==1) { $sqlchange="UPDATE $tbl_name SET pa...

What are some good ways to write PHP application with modules support?

Hi, I'm starting to write a application in php with one of my friends and was wondering, if you have any advice on how to implement module support into our application. Or is there a way how to automatically load modules written in php by a php application? Or should i just rely on __autoload function? And we don't need plugins that a...

best way of printing data

for example i want to generate html code, using some data from database. here is two ways of printing data <? echo '<li><img src="'.$row['image'].'" /></li>';?> or <? echo "<li><img src='$row[image]' /></li>";?> both of them are working. and if so, why people use the first method, if without spliting the row by . it works fine too. ...

Loading a page using jQuery.

I am using jQuery. My main page is index.php. on load of this page. How do i load another page internally. say a small block in the page ? ...

manipulating radio box selection with javascript

Hi guys, i'm trying to do a poll but i designed it without any radio box in it. So i decided to make the selection being highlighted with a different background color, all is done with jquery. I set the display of the radio box to none so that it wouldn't show, gave each a unique ID. Here's the script. <form action="v_poll.php" method=...

value from one table and inserted to another in the same database??

I have removed the same. found myself a solution. No answer is required thanks ...

extracting multiple fields from a text file using php

Hi, what is the best way of extracting multiple (~40 values) from a text file using php? the data is more or less like: NAMEA valuea NAMEB valueb I'm looking for a proper* approach to extracting this data into a data-structure, because i will need to specify regexs for all of them (all 40). did i...

Mark text in HTML

Hi I have some plain text and html. I need to create a PHP method that will return the same html, but with <span class="marked"> before any instances of the text and </span> after it. Note, that it should support tags in the html (for example if the text is blabla so it should mark when it's bla<b>bla</b> or <a href="http://abc.com"&g...

php preg_replace , I need to replace everything after a dot (e.g 340.38888 > need to get clean 340)

I need to replace everything after a dot . I know that it can be done with regex but I'm still novice and I don't understand the proper syntax so please help me with this . I tried the bellow code but doesn't work : $x = "340.888888"; $pattern = "/*./" $y = preg_replace($pattern, "", $x); print_r($x); thanks , Michael ...

PHP: How to replace quotes

I am using this but it is not working: $replaced = str_replace(''', '"', $text); Any help would be appreciated. ...

Is it possible to encapsulate multiple-lines of html or javascript inside Json format ?

Any example on the net ? ...

mysql_real_escape more than once

I was just wondering whether it makes a difference if I mysql_real_escape data more than once? So if I escaped data in one part of my website, and then again in another part of code. Would this be a problem? Or make a difference? ...

How to count online users on a website

Possible Duplicates: script to tell me who, and how many users, are online Best way to keep track of current online users How should I count the people online on a PHP website at a given time, if they don't have to be logged-in? ...

PHP: How to check for response code?

Hi, I'm a relative PHP newbie implementing a PayPal IPN listener and all seems to be working fine, except I dont really know how to check for a response code. I've tried something ugly with cURL but it doesn't work at all (I'm not understanding cURL). I've tried this piece of code that I grabbed from somewhere on the net: $fp = fsock...

Problem with auto increment primary key (MySQL).

I have 2 tables each using other's primary key as a foreign key. The primary keys for both are set to auto_increment. The problem is, when I try to create and entry into one of the tables, I have no idea what the primary key of the entry is and can't figure out what to put in the other table as a foreign key. What should I do? Do I drop...

Using PHP interfaces in Codeigniter

I am trying to find out how can I used PHP interfaces in my MVC design. I want to make sure that the design enforces an interface so that any new module would follow that. For example: <?php interface BaseAPI { public function postMessage($msg); } class ServiceAPI implements BaseAPI { public function postMessage($msg) { ret...

PHP simplexml and xpath

I have an XML file like this: <?xml version="1.0" encoding="UTF-8"?> <gallery> <album tnPath="tn/" lgPath="imm/" fsPath="iml/" > <img src="001.jpg" /> <img src="002.jpg" /> </album> </gallery> I am reading the file with: $xmlFile = "xml.xml"; $xmlStr = file_get_contents($xmlFile . "?" . time()); $xmlObj = simp...

Is this XML file correct for RSS feeding?

Hi guys I am generating a XML-RSS type file from PHP. The output for example is like this <?xml version="1.0" encoding="iso-8859-1"?> <rss version="2.0"> <channel> <title>Mi web mola</title> <link>http://www.dominio.com/blog.php&lt;/link&gt; <language>es-ES</language> <description>Mallas y eso</description> <gener...