can't post a reply message in .php

Reply

Join Date: Apr 2007
Posts: 40
Reputation: rapperhuj is an unknown quantity at this point 
Solved Threads: 0
rapperhuj rapperhuj is offline Offline
Light Poster

can't post a reply message in .php

 
0
  #1
Feb 2nd, 2009
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
  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. ?>
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 988
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 128
ardav's Avatar
ardav ardav is offline Offline
Posting Shark

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

 
0
  #2
Feb 2nd, 2009
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?
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 40
Reputation: rapperhuj is an unknown quantity at this point 
Solved Threads: 0
rapperhuj rapperhuj is offline Offline
Light Poster

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

 
0
  #3
Feb 2nd, 2009
how to do it?
can u just give me some simple codes and where should i save my php files?
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 988
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 128
ardav's Avatar
ardav ardav is offline Offline
Posting Shark

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

 
0
  #4
Feb 2nd, 2009
You can put your files anywhere in your local server as long they have acces to the connection string:

  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:

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

then carry on creating your querystring and query the database.
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 40
Reputation: rapperhuj is an unknown quantity at this point 
Solved Threads: 0
rapperhuj rapperhuj is offline Offline
Light Poster

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

 
0
  #5
Feb 2nd, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 988
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 128
ardav's Avatar
ardav ardav is offline Offline
Posting Shark

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

 
0
  #6
Feb 2nd, 2009
Can you get a php file to show in your browser at all? Without any MySQL I mean. Just something easy like:

  1. echo "Hello World!";
Last edited by ardav; Feb 2nd, 2009 at 8:18 pm.
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC