Web design question

Okay, I'm rebumping this. I have set up a database with a username, password, and web link. Now I need a script that says, take the username and password entered in this form, find the corresponding link in the database and open it in a new window. I can't find ANYTHING to point me in the right direction on how to do this, please help.
 
kiwi said:
I need a tutorial to tell me how to set up PHP to do that. Any good books you can recommend?
Can you show what your script looks like now?

I dunno. Im no genius with PHP/SQL. I mostly hack my way through. However, I found PHP/SQL for Dummies to be quite helpful on the basics...
 
fly said:
Can you show what your script looks like now?

I dunno. Im no genius with PHP/SQL. I mostly hack my way through. However, I found PHP/SQL for Dummies to be quite helpful on the basics...

See, the thing is, I don't have one yet. I have no idea how to set up PHP, so I need a good source to learn it. I'm going to go to the library tonight and see what kind of books I can find.
 
kiwi said:
See, the thing is, I don't have one yet. I have no idea how to set up PHP, so I need a good source to learn it. I'm going to go to the library tonight and see what kind of books I can find.


Go to your local Barnes & Noble. They have great IT sections, and you can grab a Starbucks while reading their books.
 
kiwi said:
Too bad I don't drink coffee. :p


:rolleyes:

Fucking mormons.


(They have other drinks, too. And food. And hot college chicks working on papers who are stressed and looking for a quick lesbian pick-me-up while taking pics on camera phones.)
 
Perhaps this will help you get started atleast. Or give you some terms to search for. I just typed this up real quick like and haven't checked syntax or anything.

This would be the code to run when the form is submitted.

Code:
<?php
// Connect to database server. Replace info with the info you have. (SERVER will most likely be "localhost");
$conn = mysql_connect(SERVER, USERNAME, PASSWORD) or die("Unable to connect to database server. ".mysql_error());

// Select database. Replace DATABASE with the name of your database.
mysql_select_db(DATABASE, $conn) or die("Failed to select database.");

// Write the SQL-query to fetch the data
// $_GET[] is an array that contains the data sent via the form. If you use "POST" as method you just use $_POST[] instead.
// So if you have an input field with an id of "username" you would use $_GET["username"] to retrieve that value.
$sql = "SELECT some_id FROM some_table WHERE username = '".mysql_escape_string($_GET["username"])."' AND password = '".mysql_escape_string($_GET["password"])."'";

// Run the query
$res = mysql_query($sql) or die("Query failed:<br />".$sql."<br />".mysql_error());

// Put result in $row
$row = mysql_fetch_array($res);

// Redirect user to correct page.
header("Location:some_page.php?some_id=".$row["some_id"]);
?>
 
I Robert I said:
Perhaps this will help you get started atleast. Or give you some terms to search for. I just typed this up real quick like and haven't checked syntax or anything.

This would be the code to run when the form is submitted.

Thanks! :heart: