it's suppose to find a name on the database.
<?php
$s = $_POST["lname"];
$x = trim($s);
$exists = false;
$selectedRow = 0;
mysql_connect (localhost,testuser,testuser);
mysql_select_db (testuser);
mysql_query("DROP TABLE myTable");
mysql_query("CREATE DATABASE myDatabase");
mysql_query("USE myDatabase");
mysql_query("CREATE TABLE myTable (firstname VARCHAR(20), " .
"lastname VARCHAR(20), birthdate DATE, dependents INT, ss VARCHAR(11))");
mysql_query("LOAD DATA LOCAL INFILE 'names.txt' INTO TABLE myTable")
or die(mysql_error());
$s = mysql_query("SELECT * FROM myTable ORDER BY lastname");
$rows=mysql_numrows($s);
for($i = 0; $i < $rows; $i++){
$result = trim(mysql_result($s,$i,"lastname"));
if ( strcmp($x, $result) == 0 )
{
$exists = true;
$selectedRow = $i;
}
}
if ($exists == true)
{
$f = mysql_result($s,$selectedRow,"firstname");
$l = mysql_result($s,$selectedRow,"lastname");
$b = mysql_result($s,$selectedRow,"birthdate");
//$d=str_pad(mysql_result($s,$selectedRow,"dependents"), 18, " ");
//$ss=mysql_result($s,$selectedRow,"ss");
print "$f "."$l
Your date of birth is ".$b;
}
else
{
print "$x
Your name is not listed";
}
mysql_query("DROP DATABASE myDatabase") or die(mysql_error());
mysql_close();
?>
Help with page encoding issue and weird characters
I'm trying to write a screen scraper and when I pull out the lines of the html file that I'm interested in and put them in a variable, I end up with a few extra weird characters in my string that I
Image upload - determine folder
I have an upload script that may be accessed from different directories. Problem is, the script is made with "../images/uploads" as the folder place for uploaded images. Which means that if
form problem
below in the form action, i've put "test.php?w=$sw&h=$sh" but when i input the form i get this..test.php?search=example&submit=searchhow do i get all of this together in the
How to ... (FAQs)
... get e-mail notifications
Can't find the problem (no error message)!
OK, here's the deal. This code is really weirdly formatted (sorry!) and hard to understand, so I'm going to try and make it as easy as possible. Here's a breakdown of what the user should do:1. The
Dynamic memory problem
Hey,
filesize() returns 0
I have a socket program that runs in an infinite loop, listening for connections, in this socket I have a method, that is supposed to open a file and write to the file, but I am having issues. Each
problem with GROUP BY and ORDER BY
i usually use this query to display the last 10 entries from a sql table:Code: $query = "SELECT search_time, search_keywords FROM phpbb_popsearch ORDER BY search_time DESC limit 35"; as you
Expandable Post Code
Hi,Hope you can help. Which currently I haven't upgraded to connect to a mysql server, so its all just plain html and php coding. I have a page that displays short news articles of about 25 30 words
Need help PLEASE
ok i have this warning showing upWarning: in_array() [function.in-array]: Wrong datatype for second argument in /home/lalala/public_html/attack.php on line 72the code i use Code: [Select]//same ip