php5

match a word from a sentence in MYSQL using regex

How can I match a word in a sentence from a column using regex? I tried: "select * from table where column regex '/\b".$text."\b/i'" but that didn't work. Thanks in advance. ...

Convert querystring to int in PHP

Working on my first PHP site (I'm mainly an ASP programmer), and I need to convert a querystring variable into a number I can then use to query a database. What's the best way to convert to a usable int (I tried intval() already but I keep getting 0 as a result) and also validate it (AKA no single quotes, blah blah) in PHP? Thanks in ad...

PHP: is it possible to use php to get the MAC address?

I'm wondering how can i get the MAC Address using PHP. I look over the manual and i don't see any function to work on this as of now. Any suggestions or ideas would be much appreciated. Thanks! ...

PHP: Get CPU usage of ImageMagick/GraphicsMagick

In PHP, is there a way I can capture what the CPU usage is of each ImagaMagick/GraphicsMagick method I execute? Memory usage would be nice, too. Basically, I'm trying to benchmark how much resources each library uses in my application. Failed attempt: exec('convert a.jpg a.png'); $result = array(); // Loop until process is detected ...

PHP 5 : Function eregi()

Hi, I m using PHP5 with Xampp server After successful installation of OSCommerce2.2 there are some warnings appear as below Deprecated: Function eregi() is deprecated in D:\xampp\htdocs\oscomm\catalog\includes\classes\language.php How ever this was never occur before .. ...

PHP strtotime and MySQL UNIX_TIMESTAMP return different integer

echo strtotime('2010-09-11 12:15:01'); Returns: 1284207301 SELECT UNIX_TIMESTAMP('2010-09-11 12:15:01') Returns: 1284200101 Why the difference? ...

Zend_Mail sent email is treated as SPAM

Please tell me what I am doing wrong. I am sending an email using the Zend_Mail class like this: $message = <<<STR You have a new invoice! Sign in to your clientarea to see it. Best regards, Company name STR; $mail = new Zend_Mail(); $mail->setBodyText($message); $mail->setFrom('[email protected]', 'Company.com'); $mail->addTo('cl...

Array multi insert uname and email check

I have an array I want to check whether the username and Email values exists in database, if it does not exist insert the username and email values in the database. Using Multi insert since there are around 80000 inserts to be preformed. $arr1 = Array ( [0] => Array ( [Username] => uname1, [Email] => email1 ) [1] => Arr...

PHP - How to check URLS for 404/Timeout?

Hi, Here is my structure: MYSQL: Table: toys ---> Column: id, URL. How do I get my PHP script to check all of those URLs to see if they are alive or have page 404's? Try not to echo or diplay the results on page. I will need to to record in MYSQL with a extra column "checks". Results will be in this format: http://asdasd.adas --- up ...

Write to file in PHP?

Well actually, I already know how to write a file, but how do I write data to a file where the newest data added is at the top? I know how to do this, but the newest information is at the bottom. By the way, just to clarify, I do need all of the data to be displayed, not just the newest one. Thanks. ...

PHP - Passing db value to a $_POST - value wrong

Hi, I'm having problems with my code - when I run it, it seem to only pass through the ID information for the last record rather than the one in the row I am trying to list and have a button for. The code for the page is the following (Sorry if there is heaps there - I'm only very new to this): <?php require_once('Connections/Demand.php...

PHP code not executing

$sql1=mysql_query("SELECT * FROM Persons", $con); echo "<table border="3"> <tr> <th>Name</th> <th>Age</th> </tr>"; while($info=mysql_fetch_array($sql1)) { echo "<tr>"; echo "<td>" . $info['fname'] . "</td>"; echo "<td>" . $info['age'] . "</td>"; echo "</tr>"; } echo "</ta...

Static method can access caller object, bug or feature?

I was working on my application and discovered strange behaviour of methods that called statically but not defined as static that extends same class. Eventually this methods can access and alter caller protected variables and methods. Here is example of my code: <?php class object { private $version; protected $alteredBy = 'no...

How to get value from Combo Box PHP?

Hi there! I am using PHP 5 to create a query page for a MySQL database with 2 tables "students" and "teachers". I have created a combo box which can allow users to view and select the 2 tables from the combo box via a "submit" button after selecting from the combo box. However the problem with the script is that I want to verify if the ...

How to delete data from database when session dont exists - PHP

I'm developing a chat module for my application... 1) I'm opening a window for users to chat, is there way that when users close the chat window, I can update status of that record...i mean event for the closed browser ? 2) I know that default session time is 24mins, so after 24mins of inactivity, user will be kicked out from the s...

How to find the next numeric index of an existing array?

I'm looking for a simple way to obtain the next numerical index of an array for a new element that would have been chosen by PHP as well. Example 1: $array = array(); $array[] = 'new index'; This would be 0 for this case. Example 1a: $array = array(100 => 'prefill 1'); unset($x[100]); $x[] = 'new index'; This would be 101 for thi...

file_get_contents get file from string not working

File I'm trying to save is from this url; http://m.assetbar.com/achewood/autaux?b=M%5ea11f09b8576e606bcb5038dfdb92fb821&amp;u=http%3A%2F%2Fachewood.com%2Fcomic.php%3Fdate%3D09102010 This does not work (only with this url): file_get_contents($string) But this works just fine: file_get_contents('http://m.assetbar.com/achewood/autaux?b=M...

how to get value of text box in other page without textbox id?

i put text box in one page and i not take id and name for that and i want get value of text box in other page how to get value of text box without id and name? hope someone help ...

can we give capital letter and underscore in pdo named placeholder.

Hi, Can we give capital letter and underscore in PDO named place holder. Below Is my query: insert into product_pepe (Type_Class, ID_Alias, Sort_order_Position, DaysBeforeReminder, DaysForNxtVaccination, IsSitemapple_IsSitemappable, NoFollowUpVaccinations, NoOfReminders_NoOfReminders, NoVaccinationsInPacket, RRP_RRP, ...

Another PHP require_once issue

Possible Duplicate: require_once () or die() not working I try to include a file with require_once and i get: Warning: require_once(1) [function.require-once]: failed to open stream: No such file or directory in /var/www/phpscrape/index.php on line 3 Fatal error: require_once() [function.require]: Failed opening required '1'...