php

PHP & MySQL preview button question.

How would you go about creating a preview button for a form using PHP & MySQL. ...

need export query rather than creating file for mysqldump without triggers.. See description

I have code as $db_name = "db"; $outputfile = "/somewhere"; $new_db_name = 'newdb'; $cmd = 'mysqldump --skip-triggers %s > %s 2>&1'; $cmd = sprintf($cmd, escapeshellarg($db_name), escapeshellcmd($output_file)); exec($cmd, $output, $ret); if ($ret !=0 ) { //log error message in $output } Then to import: $cmd = 'mysql --database...

apache error log for rewrite rule

Hi, i am getting following error in apache log File does not exist: D:/wamp/www/script/products, referer: http://localhost/script/products/category/product-123.html whenever following url http://localhost/script/products/category/product-123.html is parsed through this rewrite rule RewriteRule ^products/([~A-Za-z0-9-"]+)/([~A-Za-z0-9...

One-to-many relationship in the same table in zend

I have groupTable(group_id,group_name,group_date,group_parent_id) in face each group have many group child. I create groupModel and I want to begin coding is this right code to handle? protected $_name = 'group'; protected $_dependentTables = array('Model_group'); protected $_referenceMap = array('Model_group' => array('col...

PHP and writing clean code

Hello Im trying to find best practices to write PHP. I just wonder is this a bad habit. For example, processing variables. $var = 1 $var = doSomething($var); $var = doSomething2($var); $var = doSomething3($var); It looks a bit awful. Here is a example of a real code that I just did: $this->rSum = explode(",", $this->options["rSu...

is the code given in description is executable in Windows system?

is the code given is executable in Windows system? as it seems to be Linux commands echo 'create database foo2' | mysql -uroot mysqldump --skip-triggers -uroot foo | mysql -uroot foo2 EDITED I am executing the following code but I am not getting what I expect.. <?php mysql_connect('localhost','root','********'); echo 'c...

Getting "open_basedir restriction in effect" in spite of adding the correct entry.

I am trying to create a shared hosting scenario, using open_basedir option of php. I am doing this by adding the following to apache2.conf <VirtualHost *:80> ServerName lt1.example.net DocumentRoot /home/akshat/example/tmpblogs/tb1/ php_admin_value open_basedir /home/akshat/example/tmpblogs/tb1/ </VirtualHost> <VirtualHost ...

Easiest way to choose a percentage of an amount of rows from a MySQL table?

I have a script that has a GET variable: $_GET['percentage'] I have a MySQL table of data. Now lets say that there are 100 rows of data in this table. In pseudo-code: SELECT data FROM table Now would it be possible to select $_GET['percentage'] of random data from table? For example (again in pseudo-code): $_GET['percentage'] = 10...

Opensource framwork for email marketing

Hi, Anyone knows about some free open source php library or framework to implement following services independently. Services: Email marketing Online Survey shopping cart blogging ...

Druapl & Regular PHP Integration

I'm building a new website which has one core application and many content pages. Content pages are mostly dynamic and I require a way to manage this dynamic content on a regular basis. The core application's main functionality is a 3 step process or reading user data (input page), reading data from MySQL (product page) and submitting an...

Getting a parse error when trying to send email using Zend Mail? Why?

Hi guys for some weird reason I'm unable to send email using zend mail :( - I keep getting the following error: Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING in /home/fltdata/domains/fltdata.com/public_html/admin/g-app/includes/mailer.php on line 77 Below is my code: if($_POST): $fields = array('to', 'cc',...

second time auto login to twitter using oauth php

Any can tell me how to second time auto connect with twitter from my site. I did... the following CODE if(empty($outh_key_db)){ $token=$_SESSION['oauth_token'] ; $outh_secr_db=$_SESSION['oauth_token_secret']; $con = mysql_connect("localhost","rathin","xxxxxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); ...

nginx_http_push_module and databases

i am a newbie of nginx , and i am using nginx as a comet server by nginx_http_push_module i have two question: 1,how can i save the messages which recieved by nginx_http_push_module into databases ? 2,how can i get listeners list of a channel ? thanks~ ...

How to add values in multidimensional array?

I have a array like the bellow. Array ( [1] => Array ( [TotalPosts] => 46 [AgentSchemeNumber] => 11 [AgentName] => Vaiji ) [2] => Array ( [TotalPosts] => 3 [AgentSchemeNumber] => 22 [AgentName] => Vaiji ...

form not identifying the new input fields generated through a javascript

Hi, I am developing a site in php. i have some issues with my form i have to more than one software packages at a time. so i have used javascript to append file and a dropdown to my html. i have called ajs function to add the new input fields each time when i click a link. and its displaying correctly. but its not identifying in ...

php smarty is there a way to log who logs in to the site?

I guess if it is possible, that it will be some crazy convoluted way, but my client has asked me to try to create a log file of people who log in to the site. Is there a way to do this? I don't know php/smarty so well, I'm more of a layout person. Thanks. ...

Facebook: Unable to get users' birthday

Hello All, I have been trying hard for the last 5 hours or so to get the facebook users' birthday through facebook connect but I have not managed to do so. The same code worked previously and still works on other sites made earlier (old ones) but does not seem to work again. Here is the code: require_once ('./connect/facebook.php'); $...

Problem getting response from server using cURL, file_get_contents, etc

I am trying to get the response from a server, which is now not giving any response. I tried file_get_contents(), cURL, and tried getting the headers, but apparently the server is not responding. There are no headers returned or any response of any kind. Also, this happens when I try from my web server - it works fine in my local machine...

undefined offset error in php

I don't know why but the code below is working when I have a different query: $result = mysql_query("SELECT * FROM student WHERE IDNO='".$_GET['id']."'") ?> <?php while ( $row = mysql_fetch_array($result) ) { ?> <?php list($year,$month,$day)=explode("-", $row['BIRTHDAY']); ?> <tr> <td width="30" height="35"><font si...

Password security; Is this safe?

I asked a question yesterday about password safety... I am new at security... I am using a mysql db, and need to store users passwords there. I have been told in answers that hashing and THEN saving the HASHED value of the password is the correct way of doing this. So basically I want to verify with you guys this is correct now. It i...