PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 31st, 2012, 08:44 AM
phpnewbie1212 phpnewbie1212 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 3 phpnewbie1212 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 m 41 sec
Reputation Power: 0
Php files to mysql

New Members

4 posts
0 warning points


Posted 15 December 2012 - 02:57 PM

Hello All, I am new to this forum and new to PHP. In Flash i am building a login system for my website. To do this I need to create a php file for Flash to connect to the mysql database. Now, i am a complete novice to php and i am struggling to find the right code for my php file.
Mysql database is called "example" and my table is called users.

My php file is below: Can you please take a close look. I know it's probably full of errors but i have only just started learning php. Can you please highlight the errors for me and if i am missing something can you please tell me.
PHP Code:
<?php 
//Declare variables
//connect
$id $_POST['id'];
$email $_Post['email'];
$username $_POST['username']; 
$password $_POST['password'];
$age $_POST['age'];
$country $_POST['location'];
$gender $_POST['gender'];
 
//connects to database
$link mysql_connect("localhost""example""password") or die (mysql_error());
mysql_select_db("example_users") or die(mysql_error());
 
 
//collects data from table
$data mysql_query("SELECT * FROM users WHERE col_username='$username' AND col_password='$password'");
if (
mysql_num_rows($data) == 0) {
  echo 
"systemResult=The login detail dont much our records";
}
else {
  while (
$row mysql_fetch_assoc($data)) {
    
$userbio $row["name"];
    echo 
"systemResult=$userbio";
  }
}

// escape username and password for use in SQL
 
$user mysql_real_escape_string($user);
 
$pwd mysql_real_escape_string($pwd);
 
$sql "SELECT * FROM users WHERE
 user='" 
$user "' AND password='" $pwd "'"
 
// more code
 
mysql_close($con);
}
?>

Last edited by E-Oreo : December 31st, 2012 at 11:03 AM.

Reply With Quote
  #2  
Old December 31st, 2012, 11:58 AM
requinix's Avatar
requinix requinix is offline
Still alive
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,867 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 5 Days 6 h 11 m 57 sec
Reputation Power: 8977
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
I, for one, love it when people copy a post from another forum (including some non-post content) and paste it somewhere else. I love it even more when the original thread looks like it's been answered already. Even more when that all happened a couple weeks earlier.
Comments on this post
ptr2void agrees: SEO Bot or Clueless Copy/Paster looking for someone to just fix his code?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Php files to mysql

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap