tosicky Posted March 13, 2009 Report Share Posted March 13, 2009 (edited) I'm having problem connecting to database on wampserver.already i av set the username and password but each time i click on submit button it takes me to a blank page and the details entered on the form are not inserted in database. Any solution please Edited March 13, 2009 by tosicky Quote Link to comment Share on other sites More sharing options...
falkencreative Posted March 13, 2009 Report Share Posted March 13, 2009 What code are you using to connect to the database and save the information? Are you getting any errors? Quote Link to comment Share on other sites More sharing options...
tosicky Posted March 13, 2009 Author Report Share Posted March 13, 2009 Here is the code. <?php $username="tosicky"; $password="physic"; $db="e-banking"; $host="localhost"; $cid=mysql_connect("localhost","tosicky","physic"); if (!cid){ echo("error:" .mysql_error()."\n");} ?> <? If ($_SERVER['REQUEST_METHOD'] == "POST") { $surname=$_POST['s_name']; $firstname=$_POST['f_name']; $sql="INSERT INTO registration"; $sql= $sql . "(s_name,f_name) VALUES"; $sql=$sql."('$surname','$firstname')"; $result=mysql_db_query($db,"$sql",$cid); if(!$result){ echo("error:" . mysql_error() . "\n$sql\n");} echo("new link added\n");} mysql_close($cid); ?> Quote Link to comment Share on other sites More sharing options...
jlhaslip Posted March 13, 2009 Report Share Posted March 13, 2009 Have you started the WAMP server? (see their documentation) Are you getting any errors output at all? Is error reoprting set on? (use ini_set()) Echo the query you are using and use phpmyadmin (or equal) to see if the Query is working? How are you confirming the lack of data in the DB? Is "localhost" the server name? Lots of things could be going wrong, but having those things checked will be a good start. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.