943,749 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 658
  • PHP RSS
Feb 2nd, 2009
0

can't post a reply message in .php

Expand Post »
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 Syntax (Toggle Plain Text)
  1. <?php
  2.  
  3. $sName = $_POST['engrSName'];
  4. $sAdd = $_POST['engrAdd'];
  5. $sPCode = $_POST['engrPCode'];
  6. $sLline = $_POST['engrLline'];
  7. $sMob = $_POST['engrMno'];
  8. $sAge = $_POST['engrAge'];
  9. $sBday = $_POST['engrYear'];
  10. $sUname = $_POST['engrUName'];
  11. $sPword = $_POST['engrPName'];
  12. $sEmail = $_POST['engrEmail'];
  13.  
  14. mysql_connect("localhost","admin","charmander") or die('Error: ' . mysql_error());
  15. mysql_select_db("sycom_dbase") or die('Error: ' . mysql_error());
  16.  
  17. 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.")");
  18.  
  19. echo "Database Updated...";
  20.  
  21.  
  22. ?>
Similar Threads
Reputation Points: 7
Solved Threads: 0
Light Poster
rapperhuj is offline Offline
40 posts
since Apr 2007
Feb 2nd, 2009
0

Re: can't post a reply message in .php

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?
Sponsor
Featured Poster
Reputation Points: 1048
Solved Threads: 946
Sarcastic Poster
ardav is offline Offline
6,678 posts
since Oct 2006
Feb 2nd, 2009
0

Re: can't post a reply message in .php

how to do it?
can u just give me some simple codes and where should i save my php files?
Reputation Points: 7
Solved Threads: 0
Light Poster
rapperhuj is offline Offline
40 posts
since Apr 2007
Feb 2nd, 2009
0

Re: can't post a reply message in .php

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

PHP Syntax (Toggle Plain Text)
  1. mysql_connect("localhost","admin","charmander") or die('Error: ' . mysql_error());
  2. 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)
  1. include("includes/db.inc.php");

then carry on creating your querystring and query the database.
Sponsor
Featured Poster
Reputation Points: 1048
Solved Threads: 946
Sarcastic Poster
ardav is offline Offline
6,678 posts
since Oct 2006
Feb 2nd, 2009
0

Re: can't post a reply message in .php

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?
Reputation Points: 7
Solved Threads: 0
Light Poster
rapperhuj is offline Offline
40 posts
since Apr 2007
Feb 2nd, 2009
0

Re: can't post a reply message in .php

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)
  1. echo "Hello World!";
Last edited by ardav; Feb 2nd, 2009 at 8:18 pm.
Sponsor
Featured Poster
Reputation Points: 1048
Solved Threads: 946
Sarcastic Poster
ardav is offline Offline
6,678 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: PHP Captcha Problem -- Please help me
Next Thread in PHP Forum Timeline: problems with php include





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC