| | |
can't post a reply message in .php
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2007
Posts: 40
Reputation:
Solved Threads: 0
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
(im NEWBIE here)
Here's my sample code
PHP Syntax (Toggle Plain Text)
<?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..."; ?>
You can put your files anywhere in your local server as long they have acces to the connection string:
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:
then carry on creating your querystring and query the database.
PHP Syntax (Toggle Plain Text)
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:
PHP Syntax (Toggle Plain Text)
include("includes/db.inc.php");
then carry on creating your querystring and query the database.
Happy Humbugging Christmas
Can you get a php file to show in your browser at all? Without any MySQL I mean. Just something easy like:
PHP Syntax (Toggle Plain Text)
echo "Hello World!";
Last edited by ardav; Feb 2nd, 2009 at 8:18 pm.
Happy Humbugging Christmas
![]() |
Similar Threads
- PHP Sendmail Tutorial (PHP)
- PHP Form Validation ??? (PHP)
- PHP e-mail SMTP error ??? (PHP)
- PHP E-mail setting ??? (PHP)
- Error Message: Cannot find server; page cannot be displayed (Viruses, Spyware and other Nasties)
- Php newsletter error (PHP)
- Hello Help I'm Wired PhP (PHP)
- error message when shutting down, startup page stuck to http://dr-search4u.com/ind... (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: PHP Captcha Problem -- Please help me
- Next Thread: problems with php include
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array back beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email error file files filter folder form forms function functions gc_maxlifetime google host href htaccess html image include insert integration ip java javascript joomla limit link login loop mail memmory memory menu mlm mod_rewrite multiple mysql navigation oop parse parsing paypal pdf php problem query radio random recursion regex remote script search server sessions sms snippet soap source space sql structure syntax system table thesishelp tutorial update upload url validation validator variable video web xml youtube






