Jump to content

siric

Members
  • Posts

    116
  • Joined

  • Last visited

Everything posted by siric

  1. I did a simple test by setting $row['air_conditioning'] to both Y and N and it works.
  2. Sorry, my question was jumbled. What I was saying that instead of storing a string in the table with the numbed of item numbers indicating how many were ordered, just create a table as follows: product_id, num_ordered All you have to do then is to increment the num_ordered for each particular item when an order is placed. To find out how many of an item were ordered, just to a query on that particular item number. if you post your script and table structure, I can help you better.
  3. Don't know if you use just PHP as a normal redirect will not submit as well. I think that you may have to resort to using JavaScript. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <SCRIPT LANGUAGE="JavaScript"><!-- setTimeout('document.test.submit()',5000); //--></SCRIPT> </head> <body> <form name="test" id="form1" method="post" action="http://www.php.net/search.php"> <p> <input name="pattern" type="text" id="pattern" /> <input name="show" type="hidden" id="show" value="quickref" /> </p> <p><input type="submit" name="next" value="Next" /> </p> </form> </body> </html>
  4. Would you mind posting the code, so that we can get a better idea of what you are attempting?
  5. Good that you got it sorted. Can you mark this thread solved? Thanks
  6. Why would you know create a an entry in the table for each product code and store the amount ordered there?
  7. Place the variable clearing lines at the top of the script <?php //Adding a new user into the database //Clearing variables $register_firstname = $register_lastname = $register_username = $register_email = $register_password_1 = $register_password_2 = ''; $register_firstname = $_POST['register_firstname']; $register_lastname = $_POST['register_lastname']; $register_username = $_POST['register_username']; $register_email = $_POST['register_email']; $register_password_1 = $_POST['register_password_1']; $register_password_2 = $_POST['register_password_2']; if( $register_firstname and $register_lastname and $register_username and $register_email and $register_password_1 and $register_password_2) { if( $register_password_1 == $register_password_2) { $sql="insert into users (first_name, last_name, username, email, password) values (\"$register_firstname\", \"$register_lastname\", \"$register_username\", \"$register_email\", \"$register_password_1\")"; $rs = mysql_query( $sql, $link ); if($rs) { echo("congratulations you have successfully registered"); } else { echo ('error' . mysql_error()); } //Clearing variables $register_firstname = ''; $register_lastname = ''; $register_username = ''; $register_email = ''; $register_password_1 = ''; $register_password_2 = ''; $_POST['register_firstname'] = ''; $_POST['register_lastname'] = ''; $_POST['register_username'] = ''; $_POST['register_email'] = ''; $_POST['register_password_1'] = ''; $_POST['register_password_2'] = ''; } else { echo ("The two passwords do not match. Please retype them"); } } else { echo ("You have not completed all the fields. Please fill in the blank fields"); } ?>
  8. Please explain yourself better.
  9. Hi, I ran the script and it worked perfectly. $url = "http://www.link.com This is a test and hello my name is bob"; $result = xcleaner($url); print $result; function xcleaner($url) { $U = explode(' ', $url); $W =array(); foreach ($U as $k => $u) { $W = explode('.', $u); if (stristr($u,'http') || (count($W) > 1 && $W[1] != "") || (count($W) > 2)) { unset($U[$k]); return implode(' ',$U); } } return implode(' ',$U); } [attachment deleted by admin]
  10. You need to explain yourself a whole lot better than this is you want to get assistance.
  11. $result4 = mysql_query("SELECT petname FROM user_pets WHERE username = '$username' AND breeding = 'yes'"); echo "<b><u>Pets breeding:</u></b><br>"; echo "$result4<br>"; <----------------- WRONG You can't do this. When the data is SELECTED from a table, you need to extract what you want. $result4 = mysql_query("SELECT petname FROM user_pets WHERE username = '$username' AND breeding = 'yes'"); echo "<b><u>Pets breeding:</u></b><br>"; while ($myrow = mysql_fetch_array($result4)) { echo "$myrow['petname']<br/>; }
  12. You need a new table while will include the pic id and a DATETIME field. Once someone downloads a pic, you insert an entry into this table. You can then query this table anytime you want to see pics for a particular period.
  13. Ok, Ran the code and found a few errors and once corrected, the code worked. The change from string to integer should be run against the variables that are set at the top of the script and not the $_POST variables Change $H = (int)$_POST('hits'); $W = (int)$_POST('walks'); ..... to $H = (int)$H; $W = (int)$W; ..... and you do not need to assign the $tournID and $playID variables again in this section as you have already done it in the first section.
  14. try this $qry = "INSERT INTO favorites (username, tutorialid, tutorialname, tutorialauthor) VALUES ('$loiginusername', '$row->id', '$row->name', '$row->fullname')"; Might I also assume that you have spelt $loiginusername incorrectly?
  15. Remember, I said that it depends on how many fields you have. You can try either way to see if it makes a difference in performance. Simply, you 2 choices for a select are With 1 field - Select field from table. - run string function to locate and extract one of multiples values With multiple fields - Select fields from table
  16. echo "<FORM name='emai'" action=$_SERVER['PHP_SELF'] method='post' >";
  17. The question of using one or many fields depends on the number of inputs you have. Also remember that if you use one field, then for every query against the database you have to run some extra processing to get the result extracted. Personally, i would use separate fields for each one. To create a string from submit, you assign the posted variables to a variable in your action script $var1 = $_POST['var1']; $var1 = $_POST['var1']; and to string them together, if you want to use 1 table field $string = $var1.$var2....
  18. There are loads of examples on forms and what the different components do that you can Google. eg http://www.tizag.com/phpT/examples/formvar.php and http://www.phpf1.com/tutorial/php-form.html I assume that you are not sure what to put in the areas that you have the question marks. You must give each form field a name and a value which will be captured once you submit the form. In the case of the selects, you don't really need the option name as the select name will be used. <td><input type="checkbox" name="studied" value="yes" /></td> <td><select name="times"> <option>1</option> <option>2</option> <option>3</option> <option value="4">4</option> </select></td> If the value being displayed in the dropdown box is the value that you want to pass to the action script, you do not even need the value, so the 3rd and 4th option will do the same thing. Once the form is submitted, the script that is called will extract the values by using $studied = $_POST['studies']; $times = $_POST['times']
  19. At first glance, looks ok to me. What exact problems are you having?? Have you tried it??
  20. I just sent it in a message to you. Thank you! The problem jumped out at me once I tried to run it. You cannot do an INSERT...WHERE. That would imply that you already have a row that meets the WHERE criteria in which case you do an UPDATE. It would be UPDATE stats set atBats='$abats', hits = '$hits', walks='$walks', RBI= '$RBI', strkOuts='$strkOuts', singles='$singles', doubles='$doubles', triples='$triples', homeRuns='$homeruns', runsScrd='$runsScrd', fieldersCh='$fieldersCh' where FK_playerID='$FK_playerID' and FK_tourneyID='$FK_tourneyID'; I have just assumed that those are the variable names and if not, you get the drfit.
  21. Send me a copy of the database structure and I will look into it.
  22. Have a look at this thread http://www.phpfreaks.com/forums/index.php/topic,297072.0.html
  23. Is this a local database? If so, I would run something a client like SQLyog or Navicat Lite and run the query in there. This will allow you to identify where you error is occurring and to play around with it until it is right. Even if it is a hosted database, use PhpMyAdmin and do the same thing.
  24. If you intend to add the slash \ after the 34 and 18, you need to escape them. So your query should be INSERT INTO storedata (id, NAME, city, state, phone, zip_code) VALUES ('VZFF-3418-NN??N?', '', 148, '34\\', '', '18\\' ); The first slash lets php know the the next character should be accepted literally and not as a control character.
×
×
  • 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.