Wednesday 15 August 2012

php - Code working on Local but not working on Server -



php - Code working on Local but not working on Server -

i trying fetch info form , send database phpmyadmin.the code working on local not working when uploaded on server. have used localhost hostname connect database on server since m using (linux)cpanel.

the code follows:

<?php if(isset($_post['name'])) { $seniorstar=mysql_connect("localhost","username","password"); if(!$seniorstar) { die("cannot connect:".mysql_error()); } $name=$_post['name']; $testimony=$_post['testimony']; mysql_select_db("seniorstarsdb",$seniorstar); $sql="insert testimonial (name,testimony) values ('$name','$testimony')"; $result=mysql_query($sql,$seniorstar); mysql_close($seniorstar); header('location: thank-you.html'); } ?>

the info beingness fetched form not beingness inserted database.please help m new php getting executed till give thanks page info not beingness inserted..

try replace mysql_connect("localhost","username","password"); mysql_connect("127.0.0.1","username","password");

you can find details here.

php mysql

No comments:

Post a Comment