Jump to content

WatsonN

Members
  • Posts

    227
  • Joined

  • Last visited

Everything posted by WatsonN

  1. Try changing while ($data = mysql_fetch_assoc($check)) to while ($data = mysql_fetch_array($check)) on line 17 edit: I realize I was the one to give you the wrong one, sorry
  2. For the 'My Account' this is the form you would want: <form name="login" id="login" method="post" action=""> <table width="400" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="52%" align="center"><p>Surname</p></td> <td width="48%"><p> <input name="surname" type="text" class="lowercase" id="surname" size="40" /> </p></td> </tr> <tr> <td align="center"><p>Order Number</p></td> <td><p> <input name="on" type="text" class="lowercase" id="on" size="20" /> </p></td> </tr> <tr> <td height="36" align="center"><p>Date</p></td> <td><p> <input name="date" type="text" class="lowercase" id="date" size="10"/> <span class="credit">example: 010111</span></p></td> </tr> <tr> <td><p> </p></td> <td><p> <input name="button" type="submit" id="button" value="Submit" onclick="makeURL();" /> </p></td> </tr> </table> </form> You can set the action to go to something like post.php or submit it to the current page (action="") From there you could do a lookup in the DB $orderNum = mysql_real_escape_string($_POST['on']); $surname = mysql_real_escape_string($_POST['surname']); $check = mysql_query("SELECT * FROM table_name WHERE on = '{$OrderNum}' & `surname` = '{$surname}'")or die(mysql_error()); //Gives error if non-existent $check2 = mysql_num_rows($check); if ($check2 == 0) { echo "Incorrect Order Number or Surname, please try again."; die; } From there on you can get all the information from the DB using the information you just gathered and start your while loop. <edit>fixed minor error in form</edit>
  3. You have the right idea. Your login and payment can be just like they are now. Just one question: are you trying to allow everyone but someone with the username or password you have there? if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) { To achive this all the form data can be submitted into a database and the invoice page would pull all of it and display it in the correct field. Which by looking at this $sql="SELECT * FROM orderTable WHERE orderNum = '10811134151' AND userId = '{$_SESSION['user_id']}'"; I assume it is already in a database?
  4. A diffrent idea you could use is get the data and dynamicaly put it into the page so you can print from there. Have everything in a database and use php to insert everything you need from there. Your URL would be something like /invoice.php?id=829769403 and php would pull everything from the DB $invdata = mysql_query("SELECT * FROM Invoices WHERE AND `ID` = '{$ID}'") or die(mysql_error()); while ($data = mysql_fetch_assoc($invdata)) { //YOUR PAGE HERE $data['name']; ect. . . } ?> So for your title <title><? echo $data['name']; ?> - Invoice</title> Does this make any sense or do you want a file created for each still? Edit: I'm for sure this made no sense but I will gladly explain.
  5. If you can post what you already have I would be glad to take a look
  6. Yes that is correct. brackets don't make a difference, that is just one way of writing. I'd be glad to help in any way possible as is others in the forum. If you will post a new topic I will gladly help
  7. Sorry, Col1 would be the column you want to add information to and $col1data is the variable with data you want to add like $address or $name So for a Name $firstname = $_POST['FirstName']; $LastName = $_POST['LastName']; mysql_query("UPDATE orderTable SET FirstName = '{$firstname}', LastName = '{$LastName}' WHERE orderNum = '{$custOrderNum}'")or die(mysql_error()); post is from the form you were using to submit the data Is this better or do you still not understand?
  8. As I have read it you already have the inital entry with the customer order number using INSERT, so now what you will want to do is use UPDATE. mysql_query("UPDATE orderTable SET col1 = '{$col1data}', col2 = '{$col2data}' WHERE orderNum = '{$custOrderNum}'")or die(mysql_error()); If I read it right?
  9. @premiso That was exactly it @denno020 Mo, that didn't make sense, I didn't think that through
  10. do is for echoing something and you did write it correctly I tried a while loop but it used all my memory trying to do it. . . while ($data = $list) { $SongList .= 'feed://gdata.youtube.com/feeds/api/videos?q='; $SongList .= $data; $SongList .= '&orderby=relevance\n'; }
  11. I am working on a script that will take the data of one array and put it into a new one. All I'm sure about as of now it I will need a while loop. (Maybe?) I have a form where you would post a list of search terms <?php if (isset($_POST['songs'])) { $list = $_POST['songs']; $list = htmlentities($list); $list = str_replace(" ", "%20", $list); $list = explode("\n", $list); print "<pre>"; print_r($list); print "</pre>"; } else { ?> <form method="post"> <input type="submit" value="submit" /> <textarea name="songs" id="songs" /> </form> <?php } ?> Then it needs to go into this array $feed_url = array( 'feed://gdata.youtube.com/feeds/api/videos?q=$list[0]', 'feed://gdata.youtube.com/feeds/api/videos?q=$list[1]', 'feed://gdata.youtube.com/feeds/api/videos?q=$list[2]', 'feed://gdata.youtube.com/feeds/api/videos?q=$list[3]', 'feed://gdata.youtube.com/feeds/api/videos?q=$list[4]', // So on and so forth ); The problem is this first array can be as short as one or possibly up to 1000 and I just want to see if you can do it dynamically or not I know it's possible but I just can't figure it out on my own.
  12. PHP Its what I've used for the User side while ($info = mysql_fetch_assoc($data_name)) { $sum_name += $info['amount']; }
  13. That would make sense. . I've read over the array function and am not sure how to put all the data into a variable so I can call each item in the array to add up balances. I'm sure this is something simple I'm missing
  14. Thank you btherl I've written the begiging and I already have the problem with the array. It will only print the first result <?php require('config.inc.php'); $Names = mysql_query("SELECT COUNT( * ) AS `Rows` , `name` FROM `Transactions` WHERE `delete` = '0' AND `UID` = '2' GROUP BY `name` ORDER BY `name` LIMIT 0 , 6000") or die(mysql_error()); $names_array = mysql_fetch_array($Names); print "<pre>"; print_r($names_array); print "</pre>"; ?>
  15. I have a custom finance management site and within it I can see amount owed paid and total account balance. I have a table called `Transactions` with 8 fields ID - unique post ID UID - User ID name - Name of the person or business amount - amount of the transaction, in the format of -100.00 or +100.00 date category comment delete - default 0 What I want is to check every unique name and add up the totals and if it totals up to a negative send out a email. I already have a PHP script for the user to see this list, I just want to know if there is some way possible to automate this weekly via cron job. Is it possible? Thanks in advanced!
  16. 1&2) Thank you. I did not know i would break the syntax. And for bringing to my attention the fatal error I made with not assigning it. 3)I promise, it was a good idea in my head. I had it set up to be all one table then I got that bright idea. . . Thank ya much.
  17. That code is actually // now we insert user into 'Login' table mysql_real_escape_string($insert = "INSERT INTO `Login` (`UID`, `pass`, `HR`, `mail`, `FullName`) VALUES ('{$_POST['username']}', '{$_POST['pass']}', '{$_POST['pass2']}', '{$_POST['e-mail']}', '{$_POST['FullName']}')"); mysql_query($insert) or die( 'Query string: ' . $insert . '<br />Produced an error: ' . mysql_error() . '<br />' ); $error="Thank you, you have been registered."; setcookie('Errors', $error, time()+20); // Get user ID mysql_real_escape_string($checkID = "SELECT * FROM Login WHERE `mail` = '{$_POST['e-mail']}'"); while ($checkIDdata = mysql_fetch_assoc($checkID)) { $userID = $checkIDdata; } // now we create table 'Transactions" for the user mysql_real_escape_string($create = "CREATE TABLE `financewatsonn`.`Transactions_{$userID}` ( `ID` INT( 20 ) NOT NULL AUTO_INCREMENT COMMENT 'Transaction ID', `name` VARCHAR( 50 ) NOT NULL COMMENT 'Name/Location', `amount` VARCHAR( 50 ) NOT NULL COMMENT 'Amount', `date` VARCHAR( 50 ) NOT NULL COMMENT 'Date', `category` VARCHAR( 50 ) DEFAULT NULL COMMENT 'Category', `delete` INT( 1 ) NOT NULL DEFAULT '0', UNIQUE KEY `ID` ( `ID` ) ) ENGINE = MYISAM DEFAULT CHARSET = utf8 COMMENT = 'User ID {$userID}'"); mysql_query($create) or die( 'Query string: ' . $create . '<br />Produced an error: ' . mysql_error() . '<br />' );
  18. Hey yall! I'm working on a new site idea and I've run across a problem that I know is simple enough but I'm stumped. It's in the signup form What I want to do is insert the new user into the 'Login' table and get the user id that was just created and use that to create a table with the user id in the name. Here is what I have: // now we insert user into 'Login' table mysql_real_escape_string($insert = "INSERT INTO `Login` (`UID`, `pass`, `HR`, `mail`, `FullName`) VALUES ('{$_POST['username']}', '{$_POST['pass']}', '{$_POST['pass2']}', '{$_POST['e-mail']}', '{$_POST['FullName']}')"); mysql_query($insert) or die( 'Query string: ' . $insert . '<br />Produced an error: ' . mysql_error() . '<br />' ); $error="Thank you, you have been registered."; setcookie('Errors', $error, time()+20); // Get user ID mysql_real_escape_string($checkID = "SELECT * FROM Login WHERE `mail` = '{$_POST['e-mail']}'"); while ($checkIDdata = mysql_fetch_assoc($checkID)) { $userID = $checkIDdata; // now we create table 'Transactions" for the user mysql_real_escape_string($create = "CREATE TABLE `financewatsonn`.`Transactions_{$userID}` ( `ID` INT( 20 ) NOT NULL AUTO_INCREMENT COMMENT 'Transaction ID', `name` VARCHAR( 50 ) NOT NULL COMMENT 'Name/Location', `amount` VARCHAR( 50 ) NOT NULL COMMENT 'Amount', `date` VARCHAR( 50 ) NOT NULL COMMENT 'Date', `category` VARCHAR( 50 ) DEFAULT NULL COMMENT 'Category', `delete` INT( 1 ) NOT NULL DEFAULT '0', UNIQUE KEY `ID` ( `ID` ) ) ENGINE = MYISAM DEFAULT CHARSET = utf8 COMMENT = 'User ID {$userID}'"); mysql_query($create) or die( 'Query string: ' . $create . '<br />Produced an error: ' . mysql_error() . '<br />' ); } I know in 'Get user ID' that I need to get the ID but I'm not sure how to get that information. i get the error at 166 which is the while line under Get user ID
  19. @Pikachu2000 Using the code you provided, How would I add an hour to the current time? My server is in a diffrent time zone and is an hour behind me.
  20. That would be a problem. I thought it would work a different way and tried to just put it into a variable. I just put it inside where I wanted it to echo out. $datetime = mysql_query("SELECT DATE_FORMAT(`date`, '%M %e %Y, %l:%i %p') AS `stamp` FROM YBK_Login WHERE `id` = '$CUR_USER_ID'")or die(mysql_error());
  21. I got the insert to work right, but how would I format the return? $datetime = mysql_query("SELECT DATE_FORMAT(`date`, '%e %M %Y, %l:%i %p') AS `stamp` FROM YBK_Login")or die(mysql_error()); while($datetimecheck = mysql_fetch_assoc($datetime)) { $date = $datetimecheck['stamp']; } Gives no errors but will not echo out anything.
  22. @Pikachu2000 What query should be written to do it that way?
  23. @PFMaBiSmAd That would make sense wouldn't it. mysql_query("UPDATE YBK_Login SET date = '$datem', ip = '$ip' WHERE ID = '{$info['ID']}'")or die(mysql_error()); @Pikachu2000 I used VARCHAR instead because i wanted to format the date a spesific way and not the way mysql wanted it. But both would work just as well. Fixed // if login is ok then we add a cookie $ip = $_SERVER['REMOTE_ADDR']; $datem = date("j F Y, g:i a"); mysql_query("UPDATE YBK_Login SET date = '$datem', ip = '$ip' WHERE ID = '{$info['ID']}'")or die(mysql_error()); $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie('ID_WatsonN', $_POST['username'], 0); setcookie('Key_WatsonN', $_POST['pass'], 0); setcookie('UID_WatsonN', $info['ID'], 0); setcookie('LOGIN', $info['ID'], time()+3); //then redirect them to the members area Header("Location: dashboard.php");
  24. The date field is varchar limited to 30
  25. POST had sanitized login in details like username and password
×
×
  • 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.