i used phpmyadmin software then i create a database named sycom_dbase, but the problem i can execute it. but there is no output? and error messages.. any comments suggestions. why did it happens. where should i save all my php files.. www? i save it in www folder but it didn't still connect to the database i guess. any connectors needed? please help thnks..
(im NEWBIE here)
Here's my sample code

<?php

$sName = $_POST['engrSName'];
$sAdd = $_POST['engrAdd'];
$sPCode = $_POST['engrPCode'];
$sLline = $_POST['engrLline'];
$sMob = $_POST['engrMno'];
$sAge = $_POST['engrAge'];
$sBday = $_POST['engrYear'];
$sUname = $_POST['engrUName'];
$sPword = $_POST['engrPName'];
$sEmail = $_POST['engrEmail'];

mysql_connect("localhost","admin","charmander") or die('Error: ' . mysql_error());
mysql_select_db("sycom_dbase") or die('Error: ' . mysql_error());

mysql_query("INSERT INTO sycom_accountuser (sycom_Name, sycom_Address, sycom_PostalCode, sycom_Landline, sycom_Mobile, sycom_Age, sycom_Birthday, sycom_Username, sycom_Password, sycom_Email) VALUES(".$sName.",".$sAdd.",".$sPCode.",".$sLline.",".$sMob.",".$sAge.",".$sBday.",".$sUname.",".$sPword.",".$sEmail.")");

echo "Database Updated...";


?>
Member Avatar for diafol

Sorry mate, you're not making much sense. What exactly is the problem. What errors do you get? Have you tried accessing the DB with a very simple query?

how to do it?
can u just give me some simple codes and where should i save my php files?

Member Avatar for diafol

You can put your files anywhere in your local server as long they have acces to the connection string:

mysql_connect("localhost","admin","charmander") or die('Error: ' . mysql_error());
mysql_select_db("sycom_dbase") or die('Error: ' . mysql_error());

As a rule, you'd create a connection include file:

/includes/db.inc.php

You'd place this code into the file and then include this file in all your db-using "normal php files". A simple way to do this would be:

e.g. for files in your document root:

include("includes/db.inc.php");

then carry on creating your querystring and query the database.

other solutions sir.. after i included your suggestions it doesn't execute the test php file and the database..

i use phpmyadmin and created a database... if theres anything i configure first?

Member Avatar for diafol

Can you get a php file to show in your browser at all? Without any MySQL I mean. Just something easy like:

echo "Hello World!";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.