php

checked the php.ini file "extension=php_pdo_mysql.dll" enabled but still error

I've checked the php.ini file the extensions are enabled: extension=php_pdf.dll extension=php_pdo.dll extension=php_pdo_firebird.dll extension=php_pdo_mssql.dll extension=php_pdo_mysql.dll but still when i try to open the page it gives the error 500 | Internal Server Error | PropelException Unable to open PDO connection [wrapped: cou...

function.require-once is giving error in my wamp server.

Im trying to run something like this: <a href="login.php?logout=1" id="logout">logout</a> <div id="main"> <?php require_once('getPhotos.php') ; ?> <div id="response" class="hidden" /> </div><!-- end main--> But Im getting this error. Warning: require_once(1) [function.require-once]: failed to open stream: No such fi...

Converting fractions to html entities

We've got some fraction information stored in the database, e.g. ¾ ½ Short of doing a search and replace, are there any inbuilt PHP functions that will automatically convert these to proper html entities? ...

How to tell apart SimpleXML objects representing element and attribute?

I need to print arbitrary SimpleXML objects in a specific manner, with special handling of attribute nodes. The problem is that SimpleXML elements and attributes seem to use exactly the same class, attribute node even pretends to support attributes() method, and SimpleXML hides its internals, so there doesn't seem to be any way to tell ...

How to create my own function with { } in PHP

I want to create my own function loop(): loop($x,$y){ //do something } it should work like for, foreach operators: $y=count($array); for($x=0; $x<$y; $x++){ //do something } How to create functions like this with { } in PHP? (NOT a regular function) ...

OOP concepts in PHP with forms

I know how to create classes and objects, but I want to know how to integrate FORMS with OOP concepts in PHP. ...

PHP webserver connect to C# program on same server -- What am I looking for?

So I have a webserver in which user can remotely control an external electronic board which due to certain conditions force me to put a desktop program using C# as the middle-man. What is the magic keyword I'm looking for? At first I thought of socket but every socket searches involve server-client over TCP... it's the same machine so t...

Best way to chop a signature off an email body

Hello, I am parsing out some emails. Mobile Mail, iPhone and I assume iPod touch append a signature as a separate boundary, making it simple to remove. Not all mail clients do, and just use '--' as a signature delimiter. I need to chop off the '--' from a string, but only the last occurrence of it. Sample copy hello, this is some e...

Using XDebug in UEStudio for PHP debugging

I've just downloaded the latest version of UEStudio 09 and am trying out the integrated XDebug features. I've got xdebug installed, and have verified that via my php_info(). I've written a very basic script to test it out: 1: <?php 2: $x = 5; 3: $y = $x + 1; 4: $z = 10; 5: while ($z--) { 6: echo $x, $y, "<br />\n"; 7: } I'...

Display database contents? PHP / MySQL

So I have a chatroom type of database where the text that a user inserts gets stored into a databse as their username in one field and their message in the other. I want to have my page output the database info, so that people can see each others messages. How do I do this? Also, is it possible to make a for loop that checks to see if ...

mysqli why does this happens?

I have two subsequent mysqli statements, and the second returns: Fatal error: Call to a member function bind_param() on a non-object in ... Why this happens? Does this means that I need to open two different connection? Is there any way to avoid this (I love keeping the SQL connection details in one file)? Here the code: $db = ne...

Connecting to MySQL database with PHP

I have this little function do connect to a MySQL database: function connectSugarCRM() { $connectorSugarCRM = mysql_connect ("localhost", "123", "123") or die ("Connection failed"); mysql_select_db("sugar5") or die ("Failed attempt to connect to database"); return $connectorSugarCRM; } And then, to run a query, I'm doi...

PHP: How can I get rid of commas inside double quotes in a multiple column row?

I need a PHP solution to get rid of commas inside double quotes. I can't seem to figure out a solution using preg_replace. I'm inserting data into a database from a text file that is coma delimited. Certain columns from the text file contain multiple words that are surrounded in double quotes. Theses double quotes have comas inside, so...

Empty database in MySQL and PHP?

Is it possible to empty an entire database by connecting to it with PHP and giving a command? ...

uploading a file via ajax with php

I would like to know if it is possible to upload a binary file via ajax and php, and have a link to download it. I would like to avoid refreshing the entire page, as with a standard html form. So far I have been using forms to get information, such as radio and text boxes, and using javascript to override the default behavior. Is a simil...

Clear data in MySQL table with PHP?

How do I clear all the entries from just one table in MySQL with PHP? ...

Converting byte-stream into numeric data-type

Let's say I have a byte-stream in which I know the location of a 64-bit value (a 64-bit nonce). The byte-order is Little-Endian. As PHP's integer data-type is limited to 32-bit (at least on 32-bit operating systems) how would I convert the byte-sequence into a PHP numeric representation (float would be sufficient I think)? $serverChalle...

What's the best way to normalize "time" in PHP?

I'm looking for a way to turn user input into normalized data fit for calculation. The input is some length of time, and is coming from Twitter, so it's string only. Ideally I'd love these results: an hour and a half --> 01:30 27.52 --> 00:28 5:24 --> 05:24 Is this is a particularly difficult thing to do? I...

MySQL Query to create a "bump-system" for a forum I am making

Hello, I'm having trouble forming a MySQL query that performs the following action: Select all threadIDs from the threads table ordering by the timestamp (in descending order) of the most recent post (largest timestamp) with threadID equal to the threadID of each thread. So basically I want to go through the threads and have MySQL check...

Which Linux distro is best for running in a virtual machine, for programming research?

I'd like to learn LAMP development for my own personal edification. I tried setting up Ubuntu 8.10 "Hardy Heron" in Microsoft VPC, but I can't get the video to work above 800x600. Played with xorg.conf a million times but no joy. Can anyone recommend a good distro to work with that plays well with VPC? Any guidance on getting started...