Jump to content

Hillary

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

About Hillary

  • Birthday 10/31/1986

Contact Methods

  • AIM
    HILL4RY

Profile Information

  • Gender
    Female
  • Location
    New Jersey, USA

Hillary's Achievements

Member

Member (2/5)

0

Reputation

  1. where would i put the 'Replace into table' code if i want to replace existing information in a table that still receives new information? this is not my table but i'm trying to help someone else and i dont have the code or the answer? if you can understand my question can you please help? THANKS!! let me know if you need any more information.
  2. at the end of each string running through my query, Pr replaces the last 2 characters... why? IE: helPr worPr
  3. yes sir. <?php include('stylesR2R.css') ?> <html> <body> <?php include ("dbinit.php"); ?> <font size="12" face="arial">Search Results.</font><br> <font face="arial"> <a href="runnersDirectory.php">Runners Directory.</a><br> <a href="index.php">Find a Runner.</a><br> <br> <?php // Bring me the data!!! $firstName = mysql_real_escape_string($_GET['firstName']); $lastName = mysql_real_escape_string($_GET['lastName']); $age = mysql_real_escape_string($_GET['age']); $sex = mysql_real_escape_string($_GET['sex']); $raceName = mysql_real_escape_string($_GET['raceName']); $distance = mysql_real_escape_string($_GET['distance']); $city = mysql_real_escape_string($_GET['city']); $state = mysql_real_escape_string($_GET['state']); $date = mysql_real_escape_string($_GET['date']); $time = mysql_real_escape_string($_GET['time']); $place = mysql_real_escape_string($_GET['place']); $divPlace = mysql_real_escape_string($_GET['divPlace']); $pace = mysql_real_escape_string($_GET['pace']); $query = "SELECT * FROM records WHERE firstName LIKE \'$firstName%'\ OR lastName LIKE \'$lastName%'\ OR age LIKE \'$age%'\ OR sex LIKE \'$sex%'\ OR raceName LIKE \'$raceName%'\ OR distance LIKE \'$distance%'\ OR city LIKE \'$city%'\ OR state LIKE \'$state%'\ OR date LIKE \'$date%'\ OR time LIKE \'$time%'\ OR place LIKE \'$place%'\ OR divPlace LIKE \'$divPlace%'\ OR pace LIKE \'$pace%'"; $result = mysql_query($query, $db) or die(mysql_error().": $query"); $runners = mysql_fetch_assoc($result); ?> <?php if ($runners) { ?> <?php include('recordsTable.php'); ?> <?php }else{ echo "The runner you have searched for is not listed in this directory."; }?> <br><br><?php include('footerR2R.html') ?> </body> </html>
  4. i'm not sure what you mean crayon voilent. <?php include('stylesR2R.css') ?> <html> <body> <?php include ("dbinit.php"); ?> <font size="12" face="arial">Input Results.</font><br> <font face="arial"> <a href="runnersDirectory.php">Runners Directory.</a><br> <a href="index.php">Find a Runner.</a><br><br><br><br> <?php // put the data in the table... you do this when youre told!! $sql="INSERT INTO records (firstName, lastName, age, sex, raceName, distance, city, state, date, time, place, divPlace, pace) VALUES ('$_POST[firstName]', '$_POST[lastName]', '$_POST[age]', '$_POST[sex]', '$_POST[raceName]', '$_POST[distance]', '$_POST[city]', '$_POST[state]', '$_POST[date]', '$_POST[time]', '$_POST[place]', '$_POST[divPlace]', '$_POST[pace]')"; if (!mysql_query($sql, $db)) { die('FAIL!: ' . mysql_error()); } echo "Success! 1 New record has been added."; mysql_close($db); ?></font> <br><br><br><br><br> <?php include('footerR2R.html') ?> </body> </html> this is the file i made to input the information... each field is empty until someone fills it in and posts it at which time its sent to its appropriate variable in a table i created in phpMyadmin with MySQL. CREATE TABLE records ( id int PRIMARY KEY, firstName VARCHAR(25)NOT NULL, lastName VARCHAR(25)NOT NULL, age VARCHAR(3)NOT NULL, sex VARCHAR(1)NOT NULL, raceName VARCHAR(50)NOT NULL, distance VARCHAR(8)NOT NULL, city VARCHAR(15)NOT NULL, state VARCHAR(11)NOT NULL, date VARCHAR(8)NOT NULL, time VARCHAR(8)NOT NULL, place VARCHAR(6)NOT NULL, divPlace VARCHAR(6)NOT NULL, pace VARCHAR(10)NOT NULL ) INSERT INTO records VALUES ( '0', 'Wayne', 'Kursh', '00', 'M', 'Demo', '000000', 'Montchanin', 'Delaware', '00/00/00', '00:00:00', '10,000', '1', '00.00' ) retrieving the information is where i am having trouble. before i inserted all the \'s and %'s it kind of worked it would only retrieve the first name that matched the search but i am wondering how i can make this so that it will retrieve everyone in my database with a name matching the search criteria. if i search for Larry... only one Larry was displayed but there are 3 Larry's in total. i am very confused? thank you for putting up with me... i'm sorry for any confusion.
  5. thanks guys that was a great help, however... my new error is this: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\ OR lastName LIKE '%' \ OR age LIKE '%' \ OR sex LIKE '%' \ ' at line 2: SELECT * FROM records WHERE firstName LIKE 'Larry%' \ OR lastName LIKE '%' \ OR age LIKE '%' \ OR sex LIKE '%' \ OR raceName LIKE '%' \ OR distance LIKE '%' \ OR city LIKE '%' \ OR state LIKE '%' \ OR date LIKE '%' \ OR time LIKE '%' \ OR place LIKE '%' \ OR divPlace LIKE '%' \ OR pace LIKE '%' if at any time you'd like to send me to the MySQL boards i will not be mad. <?php include('stylesR2R.css') ?> <html> <body> <?php include ("dbinit.php"); ?> <font size="12" face="arial">Search Results.</font><br> <font face="arial"> <a href="runnersDirectory.php">Runners Directory.</a><br> <a href="index.php">Find a Runner.</a><br> <br> <?php // Bring me the data!!! $firstName = mysql_real_escape_string($_GET['firstName']); $lastName = mysql_real_escape_string($_GET['lastName']); $age = mysql_real_escape_string($_GET['age']); $sex = mysql_real_escape_string($_GET['sex']); $raceName = mysql_real_escape_string($_GET['raceName']); $distance = mysql_real_escape_string($_GET['distance']); $city = mysql_real_escape_string($_GET['city']); $state = mysql_real_escape_string($_GET['state']); $date = mysql_real_escape_string($_GET['date']); $time = mysql_real_escape_string($_GET['time']); $place = mysql_real_escape_string($_GET['place']); $divPlace = mysql_real_escape_string($_GET['divPlace']); $pace = mysql_real_escape_string($_GET['pace']); $query = "SELECT * FROM records WHERE firstName LIKE '$firstName%' \ OR lastName LIKE '$lastName%' \ OR age LIKE '$age%' \ OR sex LIKE '$sex%' \ OR raceName LIKE '$raceName%' \ OR distance LIKE '$distance%' \ OR city LIKE '$city%' \ OR state LIKE '$state%' \ OR date LIKE '$date%' \ OR time LIKE '$time%' \ OR place LIKE '$place%' \ OR divPlace LIKE '$divPlace%' \ OR pace LIKE '$pace%'"; $result = mysql_query($query, $db) or die(mysql_error().": $query"); $runners = mysql_fetch_assoc($result); ?> <?php if ($runners) { ?> <?php include('recordsTable.php'); ?> <?php }else{ echo "The runner you have searched for is not listed in this directory."; }?> <br><br><?php include('footerR2R.html') ?> </body> </html> does that mean that i have to fill in all fields when searching for something in the data base and if it does how can i make it so that you dont have to require all fields?... sorry. i'm very new to this. thanks again
  6. Parse error: syntax error, unexpected T_VARIABLE in C:\Inetpub\wwwroot\StudentWeb\WIS-220-B1N01-SPRING2009\student1546\races2run\selectRecords.php on line 28 <?php include('stylesR2R.css') ?> <html> <body> <?php include ("dbinit.php"); ?> <font size="12" face="arial">Search Results.</font><br> <font face="arial"> <a href="runnersDirectory.php">Runners Directory.</a><br> <a href="index.php">Find a Runner.</a><br> <br> <?php // Bring me the data!!! $firstName = mysql_real_escape_string($_GET['firstName']); $lastName = mysql_real_escape_string($_GET['lastName']); $age = mysql_real_escape_string($_GET['age']); $sex = mysql_real_escape_string($_GET['sex']); $raceName = mysql_real_escape_string($_GET['raceName']); $distance = mysql_real_escape_string($_GET['distance']); $city = mysql_real_escape_string($_GET['city']); $state = mysql_real_escape_string($_GET['state']); $date = mysql_real_escape_string($_GET['date']); $time = mysql_real_escape_string($_GET['time']); $place = mysql_real_escape_string($_GET['place']); $divPlace = mysql_real_escape_string($_GET['divPlace']); $pace = mysql_real_escape_string($_GET['pace']); $query = "SELECT * FROM records WHERE firstName LIKE "$firstName%" //THIS IS LINE 28!!! OR lastName LIKE "$lastName%" OR age LIKE "$age%" OR sex LIKE "$sex%" OR raceName LIKE "$raceName%" OR distance LIKE "$distance%" OR city LIKE "$city%" OR state LIKE "$state%" OR date LIKE "$date%" OR time LIKE "$time%" OR place LIKE "$place%" OR divPlace LIKE "$divPlace%" OR pace LIKE "$pace%""; $result = mysql_query($query, $db) or die(mysql_error().": $query"); $runners = mysql_fetch_assoc($result); ?> <?php if ($runners) { ?> <?php include('recordsTable.php'); ?> <?php }else{ echo "The runner you have searched for is not listed in this directory."; }?> <br><br><?php include('footerR2R.html') ?> </body> </html> can any one help me figure out what is wrong? also, it only does this when i add the '%' sign to each VAR. from my knowledge the '%' sign is needed to be able to search partials in a database but retrieve a complete string of information? is that wrong? or should i post this is the MySQL forums? PLEASE PLEASE PLEASE HELP!! thank you much.
  7. I'm making a pace calculator... well, trying to. how would I label each option's distance? make them each their own variable and label them by the value number? What else do i have to do? I'm so confused!!!!!! :-\ <html> <body> <?php //paceCalculator $speed = S $distance = D $time = T if(S) { if($operator == '/') { echo $distance / $time; ?> <form method="POST" action="paceCalculator.php"> <select name="D"> <option value="1">1 mile<option> <option value="2">2K<option> <option value="3">3K<option> <option value="4">2 miles<option> <option value="5">5K<option> <option value="6">8K<option> <option value="7">5 miles<option> <option value="8">10K<option> <option value="9">12K<option> <option value="10">15K<option> <option value="11">10 miles<option> <option value="12">20K<option> <option value="13">Half Marathon<option> <option value="14">25K<option> <option value="15">30K<option> <option value="16">20 miles<option> <option value="17">40K<option> <option value="18">Marathon<option> <option selected="selected" ></option> </select> <form method="POST" action="paceCalculator.php"> <input type="text" name="T" size="10"> <input type="submit" value="Calculate"> </form> <?php } printf " Your speed is "$speed"."; ?> </body> </html>
  8. before i posted the last reply i tried inserting % in multiple different locations to be able to search using only an initial... still every time though, it never fails.... i search K hillary is displayed i search Kevin errol is displayed i just dont get it. there is a pattern though. anything listed in the table under the entry Errol doesnt work, they all result in Errol. is that weird? i think it is... I'm going to read up on the EX2 mysql_query thing now.... you have been very helpful. i really appreciate it.
  9. ok i did what you said... i changed AND to OR... when i search for a contact in the directory, sometimes it shows me the right one, sometimes it doesnt. how would i go about making it display all matches? if i type in my last name it returns me as the result but not my mom or dad... why not all 3 of us? heres my page... check it out let me know if you can diagnose it? http://eno.wilmu.edu/WIS-220-B1N01-SPRING2009/student1546/HHwis220/GETform.php do you see what i mean? i cant search by just an initial, but i can search by full name, some full name searches result in the wrong data retrieved but complete info searches are always right... <?php include('style.css') ?> <html> <body> <center> <?php include('img_header.php') ?> </center> <?php include ("dbinit.php"); ?> <font size="12" face="arial">Search Results.</font><br> <font face="arial"> <a href="entries.php">Go to the Directory.</a><br> <a href="DBform.php">Submit a Contact.</a><br> <a href="GETform.php">Find a Contact.</a><br> <br> <table> <?php // Bring me the data!!! $firstName = mysql_real_escape_string($_GET['firstName']); $lastName = mysql_real_escape_string($_GET['lastName']); $email= mysql_real_escape_string($_GET['email']); $phone= mysql_real_escape_string($_GET['phone']); $query = "SELECT * FROM phonelist WHERE firstName LIKE '$firstName' OR lastName LIKE '$lastName' OR email LIKE '$email' OR phone LIKE '$phone'"; $result = mysql_query($query, $db) or die(mysql_error().": $query"); $contacts = mysql_fetch_assoc($result); if (isset($contacts)) { ?> <center> <?php include('dsptbl.php') ?> </center> <?php } else { ?> <p>The contact you have searched for is not listed in this Directory.</p> <?php }; ?> <center><?php include('footer.php') ?></center> </body> </html> Thanks again!!
  10. i'm not sure what i'm doing wrong? can anyone help me? <?php include('style.css') ?> <html> <body> <center><?php include('img_header.php') ?></center> <h5><?php include ("dbinit.php"); ?></h5> <font size="12" face="arial">Search Results.</font><br> <font face="arial"> <a href="entries.php">Go to the Directory.</a><br> <a href="DBform.php">Submit a Contact.</a><br> <a href="GETform.php">Find a Contact.</a><br> <br> <table> <?php if (isset($_GET['phonelist'])) { $query = sprintf("SELECT * FROM phonelist WHERE firstName = '%%', WHERE lastName = '%%', WHERE email = '%%', WHERE phone = '%%'"); mysql_real_escape_string($_GET['phonelist']); $result = mysql_query($query, $db); $contacts = mysql_fetch_assoc($query); } if (isset($contacts)) { ?> <?php include('dsptbl.php') ?> <?php } else { ?> <p>The contact you have searched for is not listed in this Directory.</p> <?php }; ?> <center><?php include('footer.php') ?></center> </body> </html> let me know if you need any other info from me.
  11. how do i make all the info in one single table. right now each piece of data is placed into its own table. <html> <body> <?php include ("dbinit.php"); ?><br> <h1>Directory</h1> <br><?php $entries = mysql_query('select * from phonelist', $db); if ($entries){ while ($contacts = mysql_fetch_assoc($entries)){?> <table border="1"> <tr bgcolor="#9ACD32"> <th>First Name</th> <th>Last Name</th> <th>E-mail</th> <th>Phone Number</th> </tr> <tr> <td><?php echo $contacts['firstName']?></td> <td><?php echo $contacts['lastName']?></td> <td width="300"><?php echo $contacts['email']?></td> <td><?php echo $contacts['phone']?></td></tr> </table><br> <?php } }else{?> <p>No contacts found.</p> <?php } ?><br><br><br> <a href="DBform.html">Submit new user information!!</a> ?> </body> </html> can any of you help me at all?
  12. ok so i modified this code (select.php) from above now i receive ERROR message: Notice: Undefined variable: contacts in C:\Inetpub\wwwroot\StudentWeb\WIS-220-B1N01-SPRING2009\student1546\HHwis220\select.php on line 10 Line 10 is if ('$contacts') { how can i make this work? what do i need to fix? <?php include ("dbinit.php"); ?><br> <?php if (isset($_GET['phonelist'])) { $query = sprintf("select * from phonelist where id=%d", mysql_real_escape_string($_GET['id'])); $result = mysql_query($query, $db); $contacts = mysql_fetch_assoc($result); } if ($contacts) { ?> <?php echo $result['firstName'] ?> <?php echo $result['lastName'] ?> <?php echo $result['email'] ?> <?php echo $result['phone'] ?> <?php include('entries.php') ?> <?php } else { ?> <p>The contact you have searched for is not listed in this Directory.</p> <?php } ?>
  13. i want to be able to select certain data from the table. i made this code(select.php) it runs the database check but no other info is displayed. how to i pull info from my table? select.php <?php include ("dbinit.php"); ?><br> <?php $result = mysql_query("SELECT * FROM phonelist WHERE firstName='%'"); $result = mysql_query("SELECT * FROM phonelist WHERE lastName='%'"); $result = mysql_query("SELECT * FROM phonelist WHERE email='%'"); $result = mysql_query("SELECT * FROM phonelist WHERE phone='%'"); while ($contacts = mysql_fetch_array($result)){ echo "$contacts[firstName] $contacts[lastName] $contacts[email] $contacts[phone]<br />"; } ?> All my other codes: HTML form to submit new data: <html> <body> <form action="insert.php" method="POST"> <table> <tr> <td colspan="2"><h2>Submit new Contact Information.</h2></td> </tr> <tr> <td>First Name:</td> <td><input type="text" name="firstName" size="40" /></td><br> </tr> <tr> <td>Last Name:</td> <td><input type="text" name="lastName" size="40" /></td><br> </tr> <tr> <td>E-Mail:</td> <td><input type="text" name="email" size="40"/></td><br> </tr> <tr> <td>Phone Number:</td> <td><input type="text" name="phone" size="40"/></td><br> </tr> <tr> <td colspan="2"><input type="submit" value="Submit new Contact." /></td> </tr> </table> </form> <a href="entries.php">Return to the Directory.</a> </body> </html> insert.php Verifies the new addition. <html> <body> <?php $db = mysql_connect("localhost", "student1546", "--------"); if ($db){ echo "Mission Accomplished"; }else{ echo "Fail: "; echo mysql_error(); } mysql_select_db("student1546", $db); ?> <br><br> <?php $sql="INSERT INTO phonelist (firstName, lastName, email, phone) VALUES ('$_POST[firstName]', '$_POST[lastName]', '$_POST[email]', '$_POST[phone]')"; if (!mysql_query($sql, $db)) { die('FAIL!: ' . mysql_error()); } echo "1 New record added"; mysql_close($db); ?> <br><br><a href="entries.php">Return to the directory.</a> <br><a href="DBform.html">Submit another contact.</a> </body> </html> entries.php displays the Directory. <html> <body> <?php include ("dbinit.php"); ?><br> <h1>Directory</h1> <br><?php $entries = mysql_query('select * from phonelist', $db); if ($entries){ while ($contacts = mysql_fetch_assoc($entries)){?> <li><?php echo $contacts['firstName']?> <?php echo $contacts['lastName']?> <?php echo $contacts['email']?> <?php echo $contacts['phone']?><br> <?php } }else{?></li> <p>No entries found.</p> <?php } ?><br><br><br> <a href="DBform.html">Submit new user information!!</a> </body> </html> GETform.php the form used to retrieve information. <html> <body> <br> <form action="select.php" method="GET"> <table> <tr> <td colspan="2"><h2>Find a Contact</h2></td> </tr> <tr> <td>First Name:</td> <td><input type="text" name="firstName" size="40" /></td><br> </tr> <tr> <td>Last Name:</td> <td><input type="text" name="lastName" size="40" /></td><br> </tr> <tr> <td>E-Mail:</td> <td><input type="text" name="email" size="40"/></td><br> </tr> <tr> <td>Phone Number:</td> <td><input type="text" name="phone" size="40"/></td><br> </tr> <tr> <td colspan="2"><input type="submit" value="Find a Contact." /></td> </tr> </table> </form> <a href="entries.php">Return to the Directory.</a> </body> </html> phpmyadmin: my table == phonelist CREATE TABLE phonelist( ID int primary key AUTO_INCREMENT, firstName varchar(15), lastName varchar(25), email varchar(35), phone varchar(12), post text );
  14. Yes i'm using MySQL. the table "phonelist" is held in phpmyadmin. Here's the code: "entries.php" <html> <body> <?php include ("dbinit.php"); ?><br> <h1>Directory</h1> <br><?php $entries = mysql_query('select * from phonelist', $db); if ($entries){ while ($contacts = mysql_fetch_assoc($entries)){?> <li><?php echo $contacts['firstName']?> <?php echo $contacts['lastName']?> <?php echo $contacts['email']?> <?php echo $contacts['phone']?><br> <?php } }else{?></li> <p>No entries found.</p> <?php } ?><br><br><br> <a href="DBform.html">Submit new user information!!</a> </body> </html> "insert.php" <html> <body> <?php $db = mysql_connect("localhost", "student1546", "zx9U0JPo"); if ($db){ echo "Mission Accomplished"; }else{ echo "Fail: "; echo mysql_error(); } mysql_select_db("student1546", $db); ?> <br><br> <?php $sql="INSERT INTO phonelist (firstName, lastName, email, phone) VALUES ('$_POST[firstName]', '$_POST[lastName]', '$_POST[email]', '$_POST[phone]')"; if (!mysql_query($sql, $db)) { die('FAIL!: ' . mysql_error()); } echo "1 New record added"; mysql_close($db); ?> <br><br><a href="entries.php">Return to the directory.</a> <br><a href="DBform.html">Submit another contact.</a> </body> </html> "DBform.html" <html> <body> <form action="insert.php" method="POST"> <table> <tr> <td colspan="2"><h2>Submit new Contact Information.</h2></td> </tr> <tr> <td>First Name:</td> <td><input type="text" name="firstName" size="40" /></td><br> </tr> <tr> <td>Last Name:</td> <td><input type="text" name="lastName" size="40" /></td><br> </tr> <tr> <td>E-Mail:</td> <td><input type="text" name="email" size="40"/></td><br> </tr> <tr> <td>Phone Number:</td> <td><input type="text" name="phone" size="40"/></td><br> </tr> <tr> <td colspan="2"><input type="submit" value="Submit new Contact." /></td> </tr> </table> </form> <a href="entries.php">Return to the Directory.</a> </body> </html> "phonelist" CREATE TABLE phonelist( ID int primary key AUTO_INCREMENT, firstName varchar(15), lastName varchar(25), email varchar(35), phone varchar(12), post text )
  15. i have just created my first database. http://eno.wilmu.edu/WIS-220-B1N01-SPRING2009/student1546/HHwis220/DBform.html i am wondering how i can stop people from adding blanks or re adding info that already exists. the database isn't very secure, nor does it have a nice interface but its my first so its alright for now. any suggestions on how i can make it better?
×
×
  • 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.