My SQL/PHP - phpmyadmin

This is a discussion on "My SQL/PHP - phpmyadmin" within the Databases section. This forum, and the thread "My SQL/PHP - phpmyadmin are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices




Reply
 
LinkBack (1) Thread Tools
  1 links from elsewhere to this Post. Click to view. #1  
Old Jun 14th, 2006, 00:35
New Member
Join Date: Jun 2006
Location: Birmingham
Age: 29
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
My SQL/PHP - phpmyadmin

Hi I know nothing about Mysql or PHP, all i know is that my domain company provides me with an sql database (currently utilised by a phpbb forum i setup) and phpmyadmin.
I want to set up the option to register for my visitors in order for them to have profile pages on my site and have the ability to upload images etc.
Basically all the comforts phpbb offers at the moment. I want to set up a database, i really cant get a grasp of it though and dont want to delete the phpbb forums until i am confident its replacement can be implimented almost straight away.
I am sure i have made a database in phpmyadmin before but wasnt sure how to interract with it, how to make text boxes on my web pages to gather new user info?

I'm sorry if my post doesnt make much sense but having read up on mysql, php and a wasted effort of learning how to build a microsoft access database - only to find it had no relevence to serverside scripting, i'm confused to say the least.

Any help would be very appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jun 14th, 2006, 00:38
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: My SQL/PHP - phpmyadmin

What you need to learn is php/mysql basics.
http://www.w3schools.com/php/php_mysql_intro.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jun 14th, 2006, 04:48
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: My SQL/PHP - phpmyadmin

Quote:
I want to set up a database, i really cant get a grasp of it though and dont want to delete the phpbb forums until i am confident its replacement can be implimented almost straight away.
Do NOT delete your phpbb forums .... until you've learn to write the code that replaces it, tested it thoroughly, and taken a backup of the old data just in case. By that time, you will have probably learnt enough about PHP and MySQL to import the old data into you new system if you wish!

You've got what will probably be a major learning task ahead of you, and quite some coding too. Learn from web pages such as the ones that Sypher gave to you, books (PHP, MySQL), etc.

If you're really serious, then there are PHP courses and MySQL courses around that will help you get started, help you through the initial trial and tribulations without you having to spend hours scratching you head over each new issue / roadblock you find, and help you to write reliable, secure, easily enhancable and maintainable code.

Declaration of interest - I'm presenting the courses that I've just given the link to ... but I choose to teach MySQL and PHP because they're great products that I believe in!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jun 14th, 2006, 13:17
New Member
Join Date: Jun 2006
Location: Birmingham
Age: 29
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: My SQL/PHP - phpmyadmin

Thanks for your help, I'm afraid after reading Syphers reply I deleted the PHPBB forum, replaced it with a db I made on phpmyadmin as i followed along the instructions from w3schools.com, I am serious about learning php/mysql but as i'm currently unemployed (hence i can dedicate so much time to my website) I certainly cant afford any courses at the moment.
My other concern would be that as i'm accustomed to creating webpages through WYSIWYG programs in a drag and drop manner, it could be argued i'm not 100% on HTML either, but now i find myself with a well presented webpage which i never thought possible and php/mysql seems the logical next hurdle to jump!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Jun 14th, 2006, 14:30
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: My SQL/PHP - phpmyadmin

damn sorry about that
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Jun 14th, 2006, 14:47
New Member
Join Date: Jun 2006
Location: Birmingham
Age: 29
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: My SQL/PHP - phpmyadmin

lol no probs, u never said to delete it, i just took what i thought was the logical next step. I have to say its all more difficult than i thought it was going to be, I'm guessing i creat a form for the visitor to provide their information and then i create a script so that when a submit button is pushed it then enters that information into a table.

Question. How many tables can a database hold? Or is that more of a question of how much webspace i have?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Jun 14th, 2006, 15:53
New Member
Join Date: Jun 2006
Location: Birmingham
Age: 29
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: My SQL/PHP - phpmyadmin

Using myphpadmin I have done the following under database name 'test'

Table Person has been created.
SQL query:CREATE TABLE `Person` ( `FirstName` VARCHAR( 15 ) NOT NULL ,
`LastName` VARCHAR( 15 ) NOT NULL ,
`Age` INT NOT NULL
) ENGINE = MYISAM ;


now i've added the form to a webpage on my server using the following code

<form action="insert_db.php" method="POST">Enter your Firstname: <input type="text" name="firstname" />Enter your Lastname: <input type="text" name="lastname" />Enter your Age: <input type="text" name="age" /><input type="submit" /></form>

Where insert_db.php, should i ammend this to the database name I am using?

On the furstname, lastname and age fields are the first letters case sensitive?

Then to show the form the route to the table i use the following?

$con = mysql_connect("localhost","###username###","###pas sword###");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("my_db", $con);$sql="INSERT INTO person(firstname,lastname,age)VALUES('$_POST[firstname]','$_POST[lastname]','$_POST[age]')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }echo "Success!";

Please feel free to show me any errors

Last edited by sypher; Jun 14th, 2006 at 19:13.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Jun 14th, 2006, 19:14
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: My SQL/PHP - phpmyadmin

Dont post ur user name and password otherwise people can messup your databases.
It can fit in as many tables as you want.

Ill make a simple form to show you how its done, just gotta finish some work of first.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Jun 14th, 2006, 20:45
New Member
Join Date: Jun 2006
Location: Birmingham
Age: 29
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: My SQL/PHP - phpmyadmin

Ok Thanks, the username and password are false
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Jun 15th, 2006, 00:36
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: My SQL/PHP - phpmyadmin

PHP: Select all

<?php 
//Database Variables
$dbhost 'localhost';
$dbusername 'username';
$dbpasswd 'password';
$database_name 'database_name';

@
$link mysql_pconnect($dbhost$dbusername$dbpasswd);
if (!
$link) {
   die(
'Not connected : ' mysql_error());
}

// make database_name the current db
@$db_selected mysql_select_db($database_name$link);
if (!
$db_selected) {
   die (
'Can\'t use database : ' mysql_error());
}
// Check to see if form as been submitted if so post results
if (isset($_POST['submit'])) {
    
    
// Get the information
    
$firstname=trim($_POST['firstname']);
    
$lastname=trim($_POST['lastname']);
    
$age=$_POST['age'];
    
    
// Check to see if any fields havent been entered and if so show error
    
if (!$firstname|!$lastname|!$age) {
        echo 
'<b>You must fill in all information!</b><br />';
        exit;
        } else {
            
// Capitalise Info
            
$firstame=ucfirst($firstame);
            
$lastname=ucfirst($lastname);
            
            
// Insert all info into database_table table
            
$query "INSERT INTO ##db-table## (firstname, lastname, age) VALUES ('$firstname','$lastname','$age')";
                
mysql_query($query);
                
                
mysql_close();
                echo 
'<p /><p /><b>Your information has been successfully added!</b><br />';
                exit;
                }
            } else {
                
//Show Form
    
?>
    <form action="insert_db.php" method="POST">Enter your Firstname: <input type="text" name="firstname" />Enter your Lastname: <input type="text" name="lastname" />Enter your Age: <input type="text" name="age" /><input type="submit" /></form>
<?php 
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Jun 15th, 2006, 00:37
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: My SQL/PHP - phpmyadmin

Setup a table and replace ##db-table## on the script with the table name you have setup.

Replace the user auth settings at the top with your own.
In your table make 3 fields,
firstname lastname age

Save the file as insert_db.php
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Jun 15th, 2006, 14:44
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: My SQL/PHP - phpmyadmin

"PHP and MySQL for Dynamic Web Sites" (2d edition!) by Larry Ullman is excellent for a beginner. He stays active on a website, too, with corrections, errata, downloadable scripts to save some typing, and a forum where he will actually answer questions. Unlike a lot of books, the scripts have been proofread thoroughly and actually work. Any problems will show up on his site.

He doesn't use PHP MyAdmin but it's such an intuitive interface that it's really unnecessary.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
sqlphp, phpmyadmin

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://webforumz.com/databases/6916-my-sql-php-phpmyadmin.htm
Posted By For Type Date
ÀÏÎÐÒ: phpmyadmin This thread Refback Nov 29th, 2006 10:14

Similar Threads
Thread Thread Starter Forum Replies Last Post
phpMyAdmin geyids Databases 8 Aug 11th, 2007 07:03
phpmyadmin ... site down? Accurax Webforumz Cafe 5 May 10th, 2007 18:43
phpmyadmin ktsirig PHP Forum 1 Sep 30th, 2005 10:06
phpmyadmin help needed blatant3 PHP Forum 1 Nov 4th, 2004 08:48


All times are GMT. The time now is 02:11.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved