Jump to content

weebulgirl

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by weebulgirl

  1. Don't know about any training videos.. I taught myself PHP off of w3schools.com one summer. Then, I took PHP and SQL courses at a community college. Mostly what I learned in the PHP course was just regulations - properly formatted code and such. I highly recommend that site for PHP - they also have good info on many other web languages. w3schools also has an SQL section, but it doesn't really help with query design and such, just with what commands you can use. Good luck!
  2. Hi all, hopefully the subject is not extremely vague. I am trying to code a php/mysql page as a library sort of application. Database design is: table library id | title | author | isbn | copies | owner table libstatus record | id | borrower | checkout | checkin The id in table library is auto_increment and is used in the id column for libstatus. Record in libstatus is also auto_increment, primary key. So, I know I could do something like: foreach (allbooks as book) { if (count(select record from libstatus where id = book) > (select copies from library where id=book)) echo "book is not available"; } (sorry for the bad psuedocode) But I would really like to do some sort of a query that returns all books that are currently checked out, without having to cycle through. It's been a while since I've worked with SQL.. anybody know what to do?
  3. Hi, I just got a new laptop installed with Windows Vista Ultimate. I have installed IIS7, PHP5, and MySQL5. When I try to execute code such as: The site simply displays a blank page. Any ideas what is going on here? I can't tell if it is a problem with IIS, PHP, or MySQL, or some combination of that. The page worked fine on my previous computer which was XP. Any help is really appreciated as I will lose access to my old computer in a few days.
  4. Hi all! I've been working on an website which, I admit, is quite ambitious. Especially seeing as though I am teaching myself PHP as I go. (So if I sound like a n00b... well, I am. -to PHP that is, I do know Java.) So, my problem is this: I am trying to make a very basic search engine. It's supposed to search a text file line-by-line for the search term (one per line), and tell the user if the term was in the file. I tried making a function for this, but it turns out that it only reports back positively if the user was searching for the very last line, not any of the others. Here's my code (basically, I edited out some extra stuff): <?php include("header.php"); function checkdb($search) { $file = fopen("data.txt", "r"); $match=false; $current = "whatever"; while(!feof($file)) { $current = fgets($file); if(substr_compare($search, $current, 0) == 0) { $match = true; } } return $match; } echo("<div align=\"center\">"); echo("<b>Search!</b><br>"); echo("<form action=\"search.php\" method=\"get\">"); echo("Enter your term here: <input type=\"text\" name=\"searchterm\">"); echo("<input type=\"submit\" value=\"Search\"></form></div><br><br><br>"); $search = $_GET["searchterm"]; $found = false; if ($search == "") { echo("<title>Search</title>"); } else { echo("<title>Search Results</title> $found = checkdb($search); if ($found == true) { echo("<br>Congrats, ".$search." is in our database!"); } else { echo("<br>Sorry, ".$search." is not in our database."); } } ?> Also, the format of the file data.txt is: phrase1 phrase2 etc, etc. Does anyone know what the problem is?? Thanks so much!
×
×
  • 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.