Jump to content

hr8886

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

hr8886's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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<br>Your date of birth is ".$b; } else { print "$x<br>Your name is not listed"; } mysql_query("DROP DATABASE myDatabase") or die(mysql_error()); mysql_close(); ?>
  2. -Write a stored procedure that accepts an INV_NUMBER, CUS_CODE, and INV_DATE, and inserts them as a new row in the INVOICE table in your "DB" database. Then run the procedure to add one new row. -Create a non-clustered index on the P_PRICE column of the PRODUCT table in your "DB" database and then delete the index you created.
  3. Why won't this php file work correctly ? <?php $s = $_POST["lname"]; $x = file_get_contents("a.txt"); if (strpos($x, $s) !== false) { print($s + " is on the list"); } else { print($s + " is not on the list"); } ?> php is suppose to tell you if a word is on a.text file. the text file has 50 words in it . i did the JavaScript for it but im having trouble with the PHP. the file is just opening and not reading :-[ [attachment deleted by admin]
×
×
  • 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.