Jump to content

veronika

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Everything posted by veronika

  1. Im not understading the last 2 sections of the assignment: -Modify the script so that it retrieves the values entered by the visitor -Modify the SELECT statement created within the script so that it includes a WHERE clause which will test to make sure that the category column is equal to the value entered by the visitor I ccreated the HTML which containes and input box for the customers to enter a expense. If Im understanding right the .php is supposed to pick up all the entered expenses from the .html and diplay them in a table. Im not understanding the last two steps....PLEASE HELP!
  2. THANKS that worked...I appreciate the help ~nika
  3. THANKS Dennis 1986... I am very new to PHP so Im not quite understanding a lot of it. But anyways I am now getting the follwing error: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\solution09.php on line 15 line 15 has: while ($row= mysql_fetch_array ($result)) What does that error mean?
  4. Hey guys, can someone please help me. I have the following assignments: Assignment #9: Report Generation In this assignment you will create a pair of Web documents - a form and a script - which will display a list of expenditures from our homebudget database. Submission will only require one page - the script. Name your script solution09.php. Within the script, construct a SELECT statement which will query the "expenses" table for all of the family's purchases. Process the resulting recordset with a while loop which will create a separate line for each expense. (NOTE: You can use line-break tags.) On each line, display the category, date, and amount of the expense. (NOTE: How would you modify the table, now that you are beginning to use it? Would you add a "payee" column? How about an "expenseID" column? Discuss these possibilities on the boards, and relate your recommended additions back to the concept of "scope creep", which we have mentioned a few times.) On the HTML form, provide the visitor with an input box he/she may use to enter an expense category. Name the form solution09.html Modify your script so that it retrieves the value entered by the visitor. Modify the SELECT statement created within your script so that it includes a WHERE clause which will test to make sure that the category column is equal to the value entered by the visitor. And I have this script: I keep getting an error in line 18 but i don't know whet the problem is. I know that script is not completer but im trying to understand what this error is and get it out the way... any help is greatly appreciated: <?php $connection=mysql_connect ("localhost", "spike", "9sj7En4"); if (!$connection) { die ('Could not Connect: '. mysql_error()); } mysql_select_db ("My_DB", $connection); $result = mysql_query ("SELECT * FROM Expenses"); echo "<table border='3'> <tr> <th>Category</th> <th>Date</th> <th>Dollar Amount</th> </tr>"; while ($row=mysql_fetch_array ($result)) { echo "<tr>" echo "<td>" .$row ['Category'] ."</td>" ; echo "<td>" .$row ['Date'] ." </td>"; echo "<td>" .$row ['Dollar Amount'] . " </td>"; echo "</tr>"; } echo "</table>"; mysql_close ($connection); ?> <HTML> <HEAD> <TITLE>Solution09</TITLE> </HEAD> <BODY> <h1>Report Generation</h1> </BODY> </HEAD> </HTML>
  5. That line is all in one...for some reason when i post it here it separated. Now, I named the file solution08 .php Do you think the part has something to do with it? It won't let me post the error...sorry
  6. yes...they're both saved under the document root of my web server
  7. When I submit my .html form to talk to my .php i get awebpage not found error message. Can someone please look at the script and let me know what is missing/wrong. I've checked like over and over again and I can't seem to get it. HTML: <HTML> <HEAD> <TITLE>Assignment: Lab #8</TITLE> </HEAD> <BODY> <H1>Records added to Estimates</H1> <FORM METHOD="POST" ACTION="solution08 .php"> <TABLE CELLSPACING = 8 CELLPADDING = 10 > <TR> <TD VALIGN = TOP> <P><strong>BUDGET:</strong><BR> <INPUT TYPE = "text" NAME = "budget" SIZE=15 MAXLENGTH=15></P> <TD VALIGN = TOP> <P><STRONG>CATEGORY (Select One):</STRONG><BR> <select> <option>Credit Card</option> <option>Check</option> <option>Cash</option> </select> </P> </TD> </TR> <TR> <TD VALIGN = TOP COLSPAN = 2 ALIGN = LEFT> <P><Strong>DESCRIPTION</strong>:<BR> <TEXTAREA NAME = "description" COLS=35 ROWS=5 WRAP=virtual></TEXTAREA></P> <P><INPUT TYPE = "submit" NAME = "submit" VALUE ="Add Record"></P> </TD> </TR> </TABLE> </FORM> </BODY> </HTML> .PHP: <? if ((!$_POST['budget']) || (!$_POST['category']) || (!$_POST['description'])) { header( "Location: solution08 .html"); exit; } $dbhost = 'localhost'; $dbuser = 'spike'; $dbpwd = '9sj7En4'; $conn=mysql_connect($dbhost,$dbuser,$dbpws) or die (mysql_error()); $dbname = 'homebudget'; $table_name = 'estimates'; mysql_select_db($dbname); $budget = mysql_escape_string (!$_POST['budget']); $category = mysql_escape_string (!$_POST['category']); $description = mysql_escape_string (!$_POST['description']); $sql = "INSERT INTO $table_name (budget, category, description) VALUES ('$budget', '$category', '$description')"; $result = mysql_query($sql, $connection) or die(mysql_error()); ?> <HTML> <HEAD> <TITLE>Assignment: Lab #8</TITLE> </HEAD> <BODY> <H1>Added Record <? echo "$table_name"; ?></H1> <TABLE CELLSPACING=5 CELLPADDING=5> <TR> <TD VALIGN=TOP> <P><STRONG>Budget:</STRONG><BR> <? echo "$budget";?></P> <P><STRONG>Category:</STRONG><BR> <? echo "$category"; ?></P> </TD> <TR> <TD VALIGN=TOP COLSPAN=2 ALIGN=CENTER> <P><STRONG>Description:</STRONG><BR> <? echo stripslashes("$description"); ?></P> <P><a href = "solution08 .html">Add Another</a></P> </TD> </TR> </TABLE> </BODY> </HTML>
  8. Not offended here!!! I know this is wrong and Im just trying to get some guidance and trying to understand what work and why?THANKS for the help!!! <?php $sql="CREATE database hombudget"; $connection= mysql_connect ("localhost","spike", "9sj7En4") or die (mysql_error()); $result=mysqlquery ($sql, $connection) or die (mysql_error()); mysql_select_db("homebudget", $connection) $tbl= "CREATE TABLE estimate ( Category varchar (10), Description varchar (30), Budget int )";// i don't know what you mean by a primary key? what it that? $slq = " DROP DATABASE IF EXIST 'homebudget' CREATE TABLE 'expenses' ( Category varchar (10), espenseData DATE, expenditure INT )";//do I need to remover the ; what is the purpose of that? just wondering because my book examples have them $result=mysql_query ($sql, $connection)//isn't this the $result variable? or die (mysql_error()); if ($results) { $msg = "<P>Database Homebudget has been created </P>"; } ?> <HTML> <HEAD> <TITLE>Homebudget Database</TITLE> </HEAD> <BODY> <?php echo $msg; ?> </BODY> </HTML>
  9. Okay I KNOW that there is something wrong with this script. I ran it to tested and got nothing on the display page. Can someone please take a look at it and point out errors? I'm still trying to get this whole PHP stuff so please explain it as basic as possible. <?php $sql="CREATE database hombudget"; $connection= @mysql_connect ("localhost","spike", "9sj7En4") or die (mysql_error()); $result=@mysqlquery ($sql, $connection) or die (mysql_error()); mysql_select_db("homebudget", $connection) $tbl= "CREATE TABLE 'estimate' ( Category varchar (10), Description varchar (30), Budget int )"; $slq = " DROP DATABASE IF EXIST 'homebudget' CREATE TABLE 'expenses' ( Category varchar (10), espenseData DATE, expenditure INT )"; $result=mysql_query (4sql, $connection) or die (mysql_error()); if ($results) { $msg = "</P>Database Homebudgethas been created </P>"; } ?> <HTML> <HEAD> <TITLE>Homebudget Database</TITLE> </HEAD> <BODY> <?php echo "$msg"; ?> </BODY> </HTML> This is what my im trying to accomplish: Grant spike user all permissions on everything controlled by the DBMS. • Create a database named "homebudget". • Within that database, create two tables: o The first table should be named "estimates". Give it three fields:  VARCHAR of length 10 named "category"  VARCHAR of length 30 named "description"  INT named "budget" o The second table should be named "expenses". Give it three fields:  VARCHAR of length 10 named "category"  DATE named "expenseDate"  INT named "expenditure" • Create a script file named solutionA.php. Within that script, connect to your DBMS using the "script" identity. Select the "homebudget" database, then obtain a listing of the tables.
  10. Okay...I've been racking my brain for the past couple of hours and I can seem to figure this script out. Can someone please help me get "unstuck" from where I'm at? :'( This is my task: Use the command-line interface to create a new user named "script" for your database. Grant that user all permissions on everything controlled by the DBMS. Create a database named "homebudget". Within that database, create two tables: The first table should be named "estimates". Give it three fields: VARCHAR of length 10 named "category" VARCHAR of length 30 named "description" INT named "budget" The second table should be named "expenses". Give it three fields: VARCHAR of length 10 named "category" DATE named "expenseDate" INT named "expenditure" Create a script file named solutionA.php. Within that script, connect to your DBMS using the "script" identity. Select the "homebudget" database, then obtain a listing of the tables. Here is my script: <? $sql= "CREATE database homebudget"; $connection = @mysql_connect ("localhost", "spike", "password") or die (mysql_error()); $result =@mysqlquery($sql, $connetion)or die (mysql_erro()); mysql_select_db("homebudget", $connection) $tbl= "CREATE TABLE estimate ( Category varchar(10), Description varchar(30), Budget int )"; I'm stuck trying to figure out the tables, do I just start another variable for the second talbe? and I m not really understanding what needs to be in the .php file. any help is greatly appreciated!!! ~nika
  11. I tried what you gave me and got : Can't create database 'homebudget'; database exists What does that mean? I'm still trying to understand the "PHP" language. Does this have to do with the fact that my scrip doesn't have the script for the tables?
  12. Okay, below is what I'm trying to accomplish. I keep getting an error saying: Parse error: parse error in C:\wamp\www\solutionA.php on line 21. That's the echo "$msg" in the HTML portion. I'm also trying to figure how to write in the tables in the php file. If someone can help me out or point me to a good source I'd really apreciate it. TASK:Use the command-line interface to create a new user named "script" for your database. Grant that user all permissions on everything controlled by the DBMS. Create a database named "homebudget". Within that database, create two tables: The first table should be named "estimates". Give it three fields: VARCHAR of length 10 named "category" VARCHAR of length 30 named "description" INT named "budget" The second table should be named "expenses". Give it three fields: VARCHAR of length 10 named "category" DATE named "expenseDate" INT named "expenditure" Create a script file named solutionA.php. Within that script, connect to your DBMS using the "script" identity. Select the "homebudget" database, then obtain a listing of the tables. MY SCRIPT: <?php //variable to hold the query to issue, creates new database $sql = "CREATE database homebudget"; //connection information $connection = mysql_connect ("localhost", "script", "9sj7En4") or die (mysql_error()); //mysql_query() funtion $result= mysqlquery ($sql, $connection) or die (mysql_erro()); //test value of $result if ($result){ $msg="<P>Database HomeBudget has been created!</P>; } ?> //HTML portion <HTML> <HEAD> <TITLE>HomeBudget Database</TITLE> </HEAD> <BODY> <?php echo "$msg"; ?> this is where i keep getting an error </BODY> </HTML>
  13. Okay...as I posted last week I'm new with the whole PHP thing. I need help wuth the following, any help is greatly appreciated. I will be loading what I script for review here: • Use the command-line interface to create a new user named "script" for your database. Grant that user all permissions on everything controlled by the DBMS. • Create a database named "homebudget". • Within that database, create two tables: o The first table should be named "estimates". Give it three fields:  VARCHAR of length 10 named "category"  VARCHAR of length 30 named "description"  INT named "budget" o The second table should be named "expenses". Give it three fields:  VARCHAR of length 10 named "category"  DATE named "expenseDate"  INT named "expenditure" • Create a script file named solution07.php. Within that script, connect to your DBMS using the "script" identity. Select the "homebudget" database, then obtain a listing of the tables. • Use the file-creation techniques we learned in previous classes to save the results of your queries into a file named solutionA.txt. • Submit both solutionA.php and solutionA.txt.
  14. wildteen88---THANK YOU SOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO MUCH, I feel like an idiot!!! thanks for the help. ~nika
  15. Ok...so I installed this WAMP server to do my PHP class. I am now having trouble with it. The book gives me step by step on how to install MySQL, Apache, and PHP but the problem is that I was told to just download WAMP and not seperatly. Now my assignment is requesting me to start MySQL Monitor from the command line and I cannot get it to work. Can someone offer some help on how to open this MySQL Monitor?
  16. Heyyyyyyyyyyyyyyy.....thanks worked, thanks. I met up with my teacher today and she was impressed. I told her I got help from here and she allowed me to use any source needed because she knows how bad the book is. I appreciate ALL of your time and help. You are a life saver. I would appreciate your help in fute assignments, I have another 5 weeks left for this class:)
  17. Okay,so i think I got the HTML part. No please don't assume I know how to do anything I am so lost it's not even funny. Okay, please take a look at my HTML file: <HTML> <HEAD> <TITLE>Solutio06.html</TITLE> </HEAD> <BODY> <P><strong>Please enter your account number and balance: </strong></P> <FORM METHOD="GET" ACTION="solution06.php"> <br /> Client's account number: <input type="text" name="account number" /> <br /> Client's balance: <input type="text" name="balance" /> <br> <input type = "submit" Name= "submit" value= "submit" /> </FORM> </BODY> </HTML> I tested it out but when it went to the php file I got the follwing error: Notice: Undefined index: account in C:\wamp\www\solution06.php on line 5 Notice: Undefined index: balance in C:\wamp\www\solution06.php on line 6 This is the text file that will display the output results. Account number is and balance is so basically I can see that there is something wrong with lines: $account = $_POST['account']; $balance= $_POST['balance']; and of course i have no clue what is can possible be. Thank You SOOOOOOOOOOOOOOOOOOOOOOOOOOO MUCH for taking the time to help me out.
  18. I guess I need something more basic. All that is too confusing, this is the fist time I've ever used PHP. I don't get it. I know that I need to have 3 separate scripts that will some how talk to each other. Let me first start with the .txt file, this is what I think it should look like(PLEASE let me know if it's wrong): <HTML> <HEAD> <TITLE>My Title Here</TITLE> </HEAD> <BODY> <P>This is the textfile that will display the results</P> <P>Account number is [ACCT]and balance is [bAL]</P> </BODY> </HTML> as you can see, I need this explained as if one were talking to a 7 year old . Again, thanks for the help!! I do appreciate it.
  19. Sound good, doesn't hurt to try. Thanks for the help.
  20. Im using the Book PHP6 fast & easy web development. We are reviewing chapter 9 and 10 (Using your file system & Uploading files to your Web site). I can tell youthat he bookhas a lot of errors to it. The assignment is what I posted. The instructor handed us the assignment she didn't take it from the book. I don't know what else i can give you that can help you. All I know is that I have to turn in 3 separate post, .txt, .html, and .php and have them all interact with each other. Thanks for the help!
  21. I've been taking this PHP class for 7 weeks now and I am so lost. The book doesn't do a good job explaining the workload and I am in desperate need of some good help. I'm going to post my assignment below and hopefully get some guidance. I'm not looking for the answers but for a better understanding of what I'm supposed to do and some guidance that will make this classa little more enjoyable. Any help isgreatly appreciated The purpose of this web application is to provide the head of the household with a report on the status of the family checking account. The application will simulate the process of looking up the account balance from the database, then it will place that balance in a predefined location within the web page. Create an ordinary text file named solution06.txt. In that file, enter the text required to create a web page which will display information about the balance contained in a family's account. NOTE: This text will eventually be inserted into the XHTML portion of your PHP script, so include HTML tags to format the text in an appropriate way. However, do not include the header tags - treat the text in this document as the body of the page, rather than the entire thing. Within the web page, use the special text string [ACCT] to mark the place where the account number will be included in the text. Use the special string [bAL] to mark the place where the balance will be displayed. Create an input form named solution06.html which will ask the visitor (the head of the family) to enter an account number (really a string). Within the script, assign a value to a variable named $balance. Note that instruction will eventually be replaced with an instruction to read information from a database. Within the script, add instructions which will open the text file you have created for the web page and read its contents into a variable named $pageBody. Use the str_replace() function to replace the special strings [ACCT] and [bAL] with the appropriate pieces of information. Display the resulting web page
×
×
  • 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.