Jump to content

Recommended Posts

What do you have for code? You'd do something like this:

 

<?php
//Database Credentials
$host = "localhost";
$user = "username";
$pass = "password";
$data = "database_name";

//Connect to server, and select database
$con = mysql_connect($host, $user, $pass) or die("unable to connect");
mysql_select_db($data) or die("unable to select database");

//Get data into array
$array_from_database = array();

$sql = "SELECT * FROM table_name";
$rs = mysql_query($sql) or die(mysql_error() . "<br />" . $sql);
while($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {
     $array_from_database[] = $row;
}

print_r($array_from_database);

hmm I did that but it still doesn't work.

 

BTW this is a different code The signup page works now I need the signin page to work

$my = mysql_connect("localhost","nintendo_pudge","*************");
if(!$my)
{
echo "Failed to Connect to MySQL Database<br />";
echo mysql_error();
exit;
}
else
{
}


$con2 = mysql_select_db("nintendo_urlblurusers", $my);

if(!$con2)
{
echo mysql_error();
exit;
}
else
{
}
?>

<?
$username = $_POST['username'];
$password = $_POST['password'];
$username = md5($username);
$password = md5($password);

$my = mysql_connect("localhost","nintendo_pudge","Franz5211-");
if(!$my)
{
echo "Failed to Connect to MySQL Database<br />";
echo mysql_error();
exit;
}
else
{
}


$con2 = mysql_select_db("nintendo_urlblurusers", $my);

if(!$con2)
{
echo mysql_error();
exit;
}
else
{
}

$cuser = mysql_query("Select Username FROM Users2 Where Username='$username'");
if(!$cuser)
{
echo '<div id="redoutput"><br />Username Does Not Exist!<br /><br /></div>';
exit;
}
else
{
}

$apassword = mysql_query("SELECT Password FROM Users2 WHERE Username='$username'");
if(!$apassword)
{
echo '<div id="redoutput"><br />Invalid Username/Password Combination<br /><br /></div>';
exit;
}
else
{
}

if($password == $apassword)
{
echo '<div id="output"><br />Logged In!<br /><br /></div>';
}
else
{
echo '<div id="redoutput"><br />Invalid Username/Password Combination (2)<br /><br /></div>';
}
mysql_close($my);
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.