php5

Script to create a table and fields in SQL wont work

Warning this is lenghty! attack if you knowledagble. well at least more then a newb beginner like me. This script uses three files as detailed below. It is suppoed to create the database and fields from the form input. It gets to the end and shows my_contacts has been created!. But when i go into phpMyadmin the table has not been create...

php MySQL snytax error

my scrip is supposed to look up contacts in a table and present thm on the screen to then be edited. however this is not this case. I am getting the error Parse error: syntax error, unexpected $end in /home/admin/domains/domain.com.au/public_html/pick_modcontact.php on line 50 NOTE: this is the last line in this script. <? session_star...

Get Token's Name with Reflection API.

I want to find the token's name passed by augment into a function. class Norm { const STR_NORM = 0; const INT_NORM = 0; } function foo($Arg1, $Arg2 = NULL) { getConstName($Arg1); # Should Return STR_NORM; return $Arg1, $Arg2; } echo foo(Norm::STR_NORM); Is there any way to implement getConstName via the PHP Reflectio...

date() is showing December 1969

$sql = "SELECT * FROM news ORDER BY `news_id` DESC LIMIT 1"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_assoc($result); $date = $row['time_posted']; echo "<i> " .date("Y/m/d", $date) . "</i>: "; I used timestamp in mysql. So, what's the problem? ...

php edit database entery script not working.

I have two .php files which show all contacts in a database, then allows the user to choose a contact to be edited. The first script is called pick_modcontact.php where I choose a contact, then posts to the script show_modcontact.php When I click the post button on the form on pick.modcontact.php the browser returns to that file due to ...

Facebook Connect 'next' error

I am trying to experiment with the new facebook authentication system, and I can't getthe login to work. I'm getting the following error message: API Error Code: 100 API Error Description: Invalid parameter Error Message: next is not owned by the application. The url that is being sent to facebook is: http://www.facebook.com/co...

PHP Extract Values From One String Based on a Pattern Defined in Another

I have two strings: $first = '/this/is/a/string'; $second = '/this/:param1/a/:param2'; And I'm trying to get this: $params = array('param1' => 'is', 'param2' => 'string'); But getting from point a to b is proving more than my tired brain can handle at the moment. Anything starting with a ':' in the second string defines a variab...

how to pass php variable value to action attribute of html form

hi, i want to pass php variable value as a action to html form. i am trying as follows, but it is not working. <?php $url='test.php'; ?> <html> <body> <form name="upload" action="<?=$url?>" method="post" > <input type="submit" value="submit"> </form> </body> </html> All this code are in one php file. ...

php + MySQL editing table data.

This question is relating to 2 php scripts. The first script is called pick_modcontact.php where I choose a contact (from a contact book like phone book), then posts to the script show_modcontact.php When I click the submit button on the form on pick.modcontact.php. As a result of submitting the form I am then taken to show_modcontact.ph...

PHP - How to combine / merge multiple pdf's

Hi, I have some pdf documents on a linux server that I want to combine together to form one document using PHP 5? Does anyone know if this can be done? Thanks ...

PHP -- automatic SQL injection protection?

I took over maintenance of a PHP app recently and I'm not super familiar with PHP but some of the things I've been seeing on the site are making me nervous that it could be vulnerable to a SQL injection attack. For example, see how this code for logging into the administrative section works: $password = md5(HASH_SALT . $_POST['logi...

Twitter Oauth home timeline display with php

$hometime= $Twitter->get_statusesHome_timeline(); Fatal error: Uncaught exception 'Exception' with message 'SimpleXMLElement::__construct() expects parameter 1 to be string <?php include 'EpiCurl.php'; include 'EpiOAuth.php'; include 'EpiTwitter.php'; include 'key.php'; $Twitter = new EpiTwitter...

Mysql NOT IN and server load.

Using php / mysql Hi Guys. I am building an application that allows people to download rather large sums of data as rows from a mysql database. The data exceeded 2 million rows so i sharded the data (this all went fine). The data is collated using geocoded latitude/longitude paring and uses a very complex SQL query to gather the query. ...

PHP preg_replace need help with pattern

Exsample preg_replace('/\{[a-zA-Z.,\(\)0-9]+\}/', 'Replaced', 'Lorem ipsum dolor sit {tag1({tag2()})}, consectetur adipiscing elit.'); The result: Lorem ipsum dolor sit {tag1(Replaced)}, consectetur adipiscing elit. Question As you can see "tag2" has been replaced, But i whant to replace "tag1" Do anyone know how i can do this? (I...

Generating Graph with 2 Y Values from Text File

Hi all, I have remade my original post as it was terribly formatted. Basically I would like some advice / tips on how to generate a line graph with 2 Y Axis (temperature and humidity) to display some information from my text file. It is contained in a textfile called temperaturedata.txt I have included a link to one of my posts from t...

back button not leading to the respective tabs

i have a ui jquery tabs and some listings under each tabs .on clicking the back button of these listings the first tab is always selected,not the respective tabs.the javascript history back is being used with the back button but it leads to the first tab always.please give a solution ...

Php preg_replace pattern help

I have this text: Lorem ipsum dolor sit {something.something({print.print(param1,param2)},param2)}, consectetur adipiscing elit. Where i need a pattern that can replace everything but: something.something The text something.something can contain [a-zA-Z.] (I am using preg_replace) Here is a site where you can test the code:...

[PHP] Sorting data in an array

Hi all, I got an array which has 7 types of fruit: $fruits = array( "lemon", "orange", "banana", "apple", "cherry", "apricot", "Blueberry" ); I don't know how to print out the data in a way that the outcome will like this: <A> Apple, Apricot <!--(Note that Apricot is followed by Apple in alphabetic order)--> <B> ...

conditional php help

How can I wrap this entire statement below in a condition? So If the variable $uprice = 0 then I don't want to to display any of the code below <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item- >getWeeeTaxAppliedAmount()): ?> <?php echo $this->helper('checkout')->formatPrice($_item->getCal...

PHP5 getrusage() returning incorrect information?

I'm trying to determine CPU usage of my PHP scripts. I just found this article which details how to find system and user CPU usage time (Section 4). However, when I tried out the examples, I received completely different results. The first example: sleep(3); $data = getrusage(); echo "User time: ". ($data['ru_utime.tv_sec'] + ...