Monday, June 23, 2008

I will soon have a MySQL table with about 1-000-000-000 entrys- how long would it take to query and return a result?

(if each entry was 20 characters long)

storing password as a hashed code is common. i need some general efficient idea or some code for a two way hashing php function- to store passwords in a mySQL db. thanks.

I just want to get the first record.

I just started developing PHP. I m trying to build an address book application for practice.
<?php
if (isset($_POST[ submit ]))
{
$valid_form = true;

if ($_POST[ UName ] == "")
{
$usernameerror = "Please enter a valid username";
$valid_form = false;
}
else
{
$usernameerror = ;
$Name = $_POST[ UName ];
}
if ($_POST[ Password ] == "")
{
$passworderror = "Please enter a valid password";
$valid_form = false;
}
else
{
$passworderror = ;
$Pword = $_POST[ password ];
}
if ($valid_form == true){
$host = "localhost";
$user = "root";
$password = "mysql";
$dbname = "addressbook";
$cxn = mysqli_connect ($host-$user-$password-$dbname) or die
("Cannot connect to database at this time!");
$query = "SELECT * from Login where UName= $Name ";
$results = mysqli_query($cxn- $query);
$row = mysqli_fetch_array($results- MYSQL_MYSQL_ASSOC);
if ($row[ UName ] == $Name AND $row[ Paword ] == $Pword)
{
echo "Logged in!";
}
else
{
$invalid = "Invalid username/password combination. Pl
The MYSQL_MYSQL_ASSOC is just MYSQL_ASSOC. It got messed up when I was pasting it in!

the query below does NOT sort date properly either by asc (the default) or desc:

"select Title- date_format(Date- %d %M- %Y ) as Date from Table1 order by Date";

i wish to have things like: June 30- June 15- May 24 etc- to show latest articles first.

what to do?

zank you.
fps_dean: thanks for input; the date is set in mySQL as 0000-00-00 (Year- month- day) and then i format it using the date_format function. My problem is with sorting- it does not show the latest articles first.

I can code XHTML/CSS very well. I ve used PHP to an extent; I can read through it and usually follow what is going on. I can make small edits to open source software on my own. But thats all.

How fast would you say it would take me to learn PHP to the point where I could write my own simple scripts that interacted with a MySQL database? What is the best way to learn?

No comments: