<?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?
For the life of me I can not find any help(tutorial) or script.. on how to create a working "user-inputed" search field that would search the working website and a Mysql database. I m trying to build a "Real Estate" website and incorporate a search function that would be able to search through the listings that I would add to the database. I ve spent the last two days looking at everything I could find on the web but- I got nothing that seems to work.. If anyone knows what I m attempting to do and could offer some help.. I ll take it.
Thanks- John.
profile?
Similar to myspace- blackplanet.com/migente.com- facebook- etc.
Thank you. I have a business idea which is why I m asking. I m pretty good with MySQL- PHP- etc.
Also- I have Visual Basic 2008...
Just not sure where to start.
Thank you.
My code is as follows- it doesn t work- can you tell me why?
function simplewhile($select- $from) {
$query = mysql_query("
SELECT $select FROM $from
") or die(mysql_error());
$result = $query;
}
simplewhile(timeslot- timeslots);
while ($row = mysql_fetch_array($result)) {
echo <option> .$row[0]. </option> ;
}
trying to select the row "timeslot" from the table "timeslots". Will be repeating this code in the function- so- don t want to keep copying and pasting code. Is there a better way to do this (i.e. oop)- or can you fix my function?
the first two answers don t fix my function- am I calling it correctly?
simplewhile(timeslot- timeslots);
No comments:
Post a Comment