Jump to content


Need some help with MySQL!


1 reply to this topic

#1 Zycron

    Young Padawan

  • Members
  • Pip
  • 3 posts

Posted 25 January 2006 - 09:40 PM

Hey, I'm trying to use this script off http://interviewmyass.co.uk ...

<?php
//first of all we need to start the mysql connection
$dbserver = "localhost"; //almost always localhost
$dbuser = "zycron_test";
$dbpassword = "pass";
$dbname = "zycron_test";

$connect = mysql_connect($dbserver,$dbuser,$dbpassword);
mysql_select_db($dbname);

$sql = "SELECT * FROM `users` WHERE `username` = '$_POST['UID']' AND `password` = '$_POST['PWD']'";
$query = mysql_query($sql,$connect);

$count_rows = mysql_num_rows($query);

if($count_rows == 1)
{
  //then this user is valid
  $result_array = mysql_fetch_assoc($query);
  echo "WELCOME TO THE SITE $result_array['username']!";
}
?>

that works fine (afaik), but the problem is I really don't know how to build the db. (I can create and add users to a db, but the rows & columns I don't fully get)
So, if somone could provide me with a screenshot of how I could make this script work (maybe if you could structure the db for me and show that?) any help is appreciated! thanks

p.s. sorry if this is really stupid, but I don't know how to do it..
I attached a ss of my current setup.. I'm positive it's wrong, but I tried

edit: attachment wouldn't show up.. so here's the pic: http://cheatreactor.net/misc/mysql.JPG

Edited by Zycron, 25 January 2006 - 09:45 PM.


#2 fiv3isaliv3

    Young Padawan

  • Members
  • Pip
  • 258 posts
  • Gender:Male

Posted 27 January 2006 - 10:30 AM

View PostZycron, on Jan 26 2006, 02:40 AM, said:

Hey, I'm trying to use this script off http://interviewmyass.co.uk ...

<?php
//first of all we need to start the mysql connection
$dbserver = "localhost"; //almost always localhost
$dbuser = "zycron_test";
$dbpassword = "pass";
$dbname = "zycron_test";

$connect = mysql_connect($dbserver,$dbuser,$dbpassword);
mysql_select_db($dbname);

$sql = "SELECT * FROM `users` WHERE `username` = '$_POST['UID']' AND `password` = '$_POST['PWD']'";
$query = mysql_query($sql,$connect);

$count_rows = mysql_num_rows($query);

if($count_rows == 1)
{
  //then this user is valid
  $result_array = mysql_fetch_assoc($query);
  echo "WELCOME TO THE SITE $result_array['username']!";
}
?>

that works fine (afaik), but the problem is I really don't know how to build the db. (I can create and add users to a db, but the rows & columns I don't fully get)
So, if somone could provide me with a screenshot of how I could make this script work (maybe if you could structure the db for me and show that?) any help is appreciated! thanks

p.s. sorry if this is really stupid, but I don't know how to do it..
I attached a ss of my current setup.. I'm positive it's wrong, but I tried

edit: attachment wouldn't show up.. so here's the pic: http://cheatreactor.net/misc/mysql.JPG

read up on some mysql tutorials. i'd also recommend installing phpmyadmin to manage your database (if you haven't already).





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users