Jump to content

telsiin

Members
  • Posts

    47
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://www.tradetongue.com/pacino
  • Yahoo
    telsiin@yahoo.com

Profile Information

  • Gender
    Male
  • Location
    Kissimmee Florida

telsiin's Achievements

Member

Member (2/5)

0

Reputation

  1. I looking for a good tutorial that will cover arrays, from HTML forms to storing the data( serialize,unserialize, implode, explode)in mysql with php I need to create a from that will allow me to create an array from text field then submit to database and late allow me to editied and update that array So I have four basic tables one serving as main table that will hold 5 field of data plus three field set aside for arrays then I have 3 tables that will hold keys and reference for those array plus additional data objective : In my main table the fields array1 array2 and array3 are the one I need to insert the array data into. I need to be able to manipulate the data of the array completely from an HTML form or multiple forms create basic HTML forms and PHP code to process I must be able to pull a record, check to see if that is an in those field array then add some data if their is if not start a new array for that record create basic HTML forms and PHP code to process I must be able to view and delete part of the array as well create basic HTML forms and PHP code to process then pull a record that has array data in it, then create a query base on those array to pull data from other tables and create some basic calculation base on the original record and the data that you reference in the other tables ( tables array1 array2 and array3 )create basic HTML forms and PHP code to process To help paint you better picture I am attaching below some sample tables and data I know that the data is not optimize but that is on purpose ok let say that this is( id) 2 in main 2 11 12 12 15 18 ('MOPQY4IV','9QR4TH7K','NZ1O45B0','1XUUU5D4','J94RVSNY')NULL NULL this array would be reference in table array1 'MOPQY4IV','9QR4TH7K','NZ1O45B0','1XUUU5D4','J94RVSNY' So in PHP I need to create a for loop that would take the value of this array and pull the data from table array1 I don't think the foreign key would work as this is not normalize database since other (id) in main could reference the same keys in array1 so I believe it be a many to many relation (id)3 could look some like this 3 10 16 12 17 14 ('MOPQY4IV','9QR4TH7K','JAM39TXN',)NULL NULL some of the array value are the same as in (id) 2 Thank You Antonio CREATE TABLE IF NOT EXISTS `array1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `arrayKey` varchar( NOT NULL, `data1` int(11) NOT NULL, `data2` int(11) NOT NULL, `data3` int(11) NOT NULL, `data4` int(11) NOT NULL, `data5` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ; -- -- Dumping data for table `array1` -- INSERT INTO `array1` (`id`, `arrayKey`, `data1`, `data2`, `data3`, `data4`, `data5`) VALUES (1, 'MOPQY4IV', 0, 1, 0, 3, 2), (2, '9QR4TH7K', 2, 2, 0, 0, 2), (3, '8NBYRZ72', 2, 1, 3, 3, 3), (4, 'NZ1O45B0', 0, 2, 2, 3, 2), (5, 'Y7XPA7Q3', 0, 0, 1, 1, 2), (6, '1XUUU5D4', 1, 3, 2, 1, 2), (7, 'JVUI1KA6', 2, 1, 3, 3, 1), (8, 'J94RVSNY', 3, 2, 3, 1, 1), (9, 'NF9YSEF4', 2, 3, 0, 1, 3), (10, 'LFY81TBA', 1, 1, 1, 3, 1), (11, 'LZH9S2DE', 0, 3, 2, 0, 1), (12, '7XK4NF8M', 3, 1, 1, 2, 0), (13, 'JAM39TXN', 0, 0, 2, 2, 1); -- -------------------------------------------------------- -- -- Table structure for table `array2` -- CREATE TABLE IF NOT EXISTS `array2` ( `id` int(11) NOT NULL AUTO_INCREMENT, `arrayKey` varchar( NOT NULL, `data1` int(11) NOT NULL, `data2` int(11) NOT NULL, `data3` int(11) NOT NULL, `data4` int(11) NOT NULL, `data5` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ; -- -- Dumping data for table `array2` -- INSERT INTO `array2` (`id`, `arrayKey`, `data1`, `data2`, `data3`, `data4`, `data5`) VALUES (1, 'BZGZX887', 1, 0, 0, 0, 3), (2, 'WW7JG2WI', 3, 1, 0, 2, 0), (3, 'U1UAK4Z7', 0, 2, 2, 3, 0), (4, 'L1ETC8VM', 1, 3, 3, 3, 3), (5, 'RYPO75Y6', 3, 3, 0, 1, 0), (6, 'O9XKS4B0', 2, 2, 2, 2, 0), (7, 'A1W8VD5M', 1, 1, 0, 3, 3), (8, '4EH4IUBF', 1, 3, 3, 2, 0), (9, '2YV7VJML', 0, 2, 0, 1, 1), (10, '1V9TPRT8', 1, 2, 3, 3, 1), (11, '6XC0QJPB', 1, 2, 2, 3, 3), (12, 'JWX4SG1M', 2, 2, 3, 1, 0), (13, '60UBRIB2', 0, 0, 2, 2, 0); -- -------------------------------------------------------- -- -- Table structure for table `array3` -- CREATE TABLE IF NOT EXISTS `array3` ( `id` int(11) NOT NULL AUTO_INCREMENT, `arrayKey` varchar( NOT NULL, `data1` int(11) NOT NULL, `data2` int(11) NOT NULL, `data3` int(11) NOT NULL, `data4` int(11) NOT NULL, `data5` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ; -- -- Dumping data for table `array3` -- INSERT INTO `array3` (`id`, `arrayKey`, `data1`, `data2`, `data3`, `data4`, `data5`) VALUES (1, 'XW2R8FZV', 0, 2, 0, 2, 1), (2, 'U0UQ4XE0', 3, 3, 3, 2, 1), (3, 'DJZ0F72P', 0, 2, 0, 2, 1), (4, '58NZG2QT', 3, 0, 3, 1, 0), (5, '8X0MTA7C', 3, 3, 1, 3, 0), (6, '566JPHPO', 3, 1, 0, 2, 2), (7, '59FE3PVA', 3, 0, 2, 3, 1), (8, 'O87PI80J', 1, 2, 0, 3, 3), (9, 'J69OP30N', 1, 2, 0, 2, 2), (10, '4VCA5FA9', 2, 1, 1, 3, 3), (11, 'N6I82WQS', 2, 0, 3, 0, 2), (12, 'ZSNV3O7K', 0, 0, 2, 2, 3), (13, 'YE6E4RB0', 2, 2, 3, 1, 0); -- -------------------------------------------------------- -- -- Table structure for table `main` -- CREATE TABLE IF NOT EXISTS `main` ( `id` int(11) NOT NULL AUTO_INCREMENT, `data1` int(11) NOT NULL, `data2` int(11) NOT NULL, `data3` int(11) NOT NULL, `data4` int(11) NOT NULL, `data5` int(11) NOT NULL, `array1` text, `array2` text, `array3` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ; -- -- Dumping data for table `main` -- INSERT INTO `main` (`id`, `data1`, `data2`, `data3`, `data4`, `data5`, `array1`, `array2`, `array3`) VALUES (1, 10, 11, 15, 14, 16, NULL, NULL, NULL), (2, 11, 12, 12, 15, 18, NULL, NULL, NULL), (3, 10, 16, 12, 17, 14, NULL, NULL, NULL), (4, 18, 10, 13, 16, 11, NULL, NULL, NULL), (5, 11, 10, 13, 9, 15, NULL, NULL, NULL), (6, 9, 18, 14, 17, 14, NULL, NULL, NULL), (7, 14, 18, 16, 13, 17, NULL, NULL, NULL), (8, 15, 16, 12, 17, 17, NULL, NULL, NULL), (9, 17, 16, 12, 14, 10, NULL, NULL, NULL), (10, 17, 14, 11, 9, 17, NULL, NULL, NULL), (11, 12, 18, 10, 13, 13, NULL, NULL, NULL), (12, 10, 12, 14, 14, 10, NULL, NULL, NULL), (13, 14, 14, 12, 17, 18, NULL, NULL, NULL), (14, 1, 1, 1, 1, 1, NULL, NULL, NULL), (15, 22, 22, 22, 22, 22, NULL, NULL, NULL), (16, 1, 1, 1, 1, 1, NULL, NULL, NULL);
  2. I have a page the loads a form via ajax into <div id="content"> which works great however once the user submit the form I would like to load a different page/form into the <div id="content"> the PHP code I have trigger after the submit and user data is inserted to a table $insertGoTo = "registrybusiness.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } my problem is that the code above break out of the <div id="content"> refreshing the page I am looking for an alternative code that will load a new page called from the div id="content" and load it back in div id="content" $insertGoTo = "javascript:ajaxpage('registrybusiness.php', 'content');"; of course this doesn't work : P.S. my java script skill are the equivalently to a three year and theirs maybe better.
  3. I am not quite sure what was wrong I think it was the form, : I started again fresh and solved it <?php require_once('Connections/testdb.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_validate = "-1"; if (isset($_GET['giftcard'])) { $colname_validate = $_GET['giftcard']; } mysql_select_db($database_testdb, $testdb); $query_validate = sprintf("SELECT * FROM giftcard WHERE card_id = %s", GetSQLValueString($colname_validate, "text")); $validate = mysql_query($query_validate, $testdb) or die(mysql_error()); $row_validate = mysql_fetch_assoc($validate); $totalRows_validate = mysql_num_rows($validate); ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Validate Gift Card</title> </head> <body> <form action="getgift2.php" method="GET"> Gift Card: <input type="text" name="giftcard" /> <input type="submit" value="Validate your Gift Card " /> </form> Your Gift card Number is <?php echo $_GET["giftcard"]; ?>!<br /> <table border="1"> <?php do { ?> <tr><td><strong>Validation :</strong></td><td><strong><?php echo $row_validate['validation']; ?></strong></td></tr> <tr><td><strong>Amount :</strong></td><td><strong><?php echo $row_validate['amount']; ?></strong></td></tr> <tr><td>Purchaser :</td><td><?php echo $row_validate['purchaser']; ?></td></tr> <tr><td>Purchaser Phone :</td><td><?php echo $row_validate['phone_pur']; ?></td></tr> <tr><td>Recipient :</td><td><?php echo $row_validate['recipient']; ?></td></tr> <tr><td>Recipient Phone :</td><td><?php echo $row_validate['phone_rec']; ?></td></tr> <tr><td>Purchase Date :</td><td><?php echo $row_validate['purchase_date']; ?></td></tr> <tr><td>Expiration Date :</td> <td><?php echo $row_validate['expiration_date']; ?></td></tr> <tr><td>Location :</td><td><?php echo $row_validate['location']; ?></td></tr> <tr><td>Memo :</td> <td><?php echo $row_validate['memo']; ?></td></tr> <tr><td>Occasion :</td><td><?php echo $row_validate['occasion']; ?></td></tr> <?php } while ($row_validate = mysql_fetch_assoc($validate)); ?> </table> </body> </html> <?php mysql_free_result($validate); ?>
  4. when I change to $giftcards = $_POST['giftcard']; I get the following error Notice: Undefined index: giftcard in C:\xampp\htdocs\pacino\getgift2.php on line 33
  5. hi all I am missing something in my syntax I am trying to retrieve and display data, base on user input from a form thanks in advance <?php require_once('Connections/testdb.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $giftcards = '$_POST[giftcard]'; mysql_select_db($database_testdb, $testdb); $query_Recordset1 = sprintf("SELECT * FROM giftcard WHERE card_id = '%s'", mysql_real_escape_string($giftcards)); $Recordset1 = mysql_query($query_Recordset1, $testdb) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Validate Gift Card</title> </head> <body> <form action="<?php echo $editFormAction; ?>" method="Post" enctype="application/x-www-form-urlencoded" name="validategiftcard" target="_self"> <input name="giftcard" type="text" value="234oeo4" maxlength="16" /> <input name="validate" type="reset" value="Validate Giftcard" /> </form> <table> <tr> <td>id</td> <td>transaction_id</td> <td>card_id</td> <td>purchaser</td> <td>phone_pur</td> <td>recipient</td> <td>phone_rec</td> <td>purchase_date</td> <td>expiration_date</td> <td>amount</td> <td>location</td> <td>memo</td> <td>occasion</td> <td>validation</td> <td>use_date</td> </tr> <?php do { ?> <tr> <td><?php echo $row_Recordset1['id']; ?></td> <td><?php echo $row_Recordset1['transaction_id']; ?></td> <td><?php echo $row_Recordset1['card_id']; ?></td> <td><?php echo $row_Recordset1['purchaser']; ?></td> <td><?php echo $row_Recordset1['phone_pur']; ?></td> <td><?php echo $row_Recordset1['recipient']; ?></td> <td><?php echo $row_Recordset1['phone_rec']; ?></td> <td><?php echo $row_Recordset1['purchase_date']; ?></td> <td><?php echo $row_Recordset1['expiration_date']; ?></td> <td><?php echo $row_Recordset1['amount']; ?></td> <td><?php echo $row_Recordset1['location']; ?></td> <td><?php echo $row_Recordset1['memo']; ?></td> <td><?php echo $row_Recordset1['occasion']; ?></td> <td><?php echo $row_Recordset1['validation']; ?></td> <td><?php echo $row_Recordset1['use_date']; ?></td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </table> </body> </html> <?php mysql_free_result($Recordset1); ?>
  6. I have a some value that are being generated from a database then thrown into <li><href> to create a list that user can click and fetch data through ajax right now its in a form select/menu and works fine however I need to convert to a list and use and onKeyDown event <form> <select name="users" size="<?php echo $num_rows;?>" onchange="showUser(this.value)" > <?php do { ?> <option value="<?php echo $row_Recordset1['item_id']?>"><?php echo $row_Recordset1['item_id'].' '. $row_Recordset1['item_name']?></option> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); $rows = mysql_num_rows($Recordset1); if($rows > 0) { mysql_data_seek($Recordset1, 0); $row_Recordset1 = mysql_fetch_assoc($Recordset1); } ?> </select> </form> I need to correct this <ol> <?php do { ?> <li onKeyDown="showUser(this.value)"><a href="getmenu.php?item_id="<?php echo $row_Recordset1['item_id']?>"> <?php echo $row_Recordset1['item_name']?></a></li> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); $rows = mysql_num_rows($Recordset1); if($rows > 0) { mysql_data_seek($Recordset1, 0); $row_Recordset1 = mysql_fetch_assoc($Recordset1); } ?> </ol>
  7. Thorpe you are so the Man! :) You have no idea how long I been trying to figure that out You have my gratitude and appreciation. Antonio
  8. Hello Everyone I need a little help I have a select statement and I need to make a query base on a Class variable pass from paypal. mysql_select_db($database_mobile, $mobile); $query_Recordset1 = "SELECT * FROM invoice WHERE invoice.invoice= '$p->ipn_data[invoice]'"; $Recordset1 = mysql_query($query_Recordset1, $mobile) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  9. I am trying to pass a variable to a function, I believe my syntax is wrong thank you for your help Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /../../../actiontest.php on line 7 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /../../../actiontest.php on line 9
  10. Hi all I am try to trouble shoot this function error Your help would be greatly appreciated
  11. ok I found that it was a custom function function add_field($field, $value) { // adds a key=>value pair to the fields array, which is what will be // sent to paypal as POST variables. If the value is already in the // array, it will be overwritten. $this->fields["$field"] = $value; } I thought it was something specific to class I learn something every day
  12. So this ("->add_field" or "->addField")is not consider a php method or reserved word used in php syntax with setting a class ?
  13. I am trying to learn the syntax so I can create and/or modify a class for creating a button however I don't know how to set the different form element and their attributes in class syntax On this page http://vailo.wordpress.com/2008/09/04/the-php-form-class-one-becomes-two/ they show example for the syntax for check box and text but not the image or radio and they don't give and example for the syntax for the different attribute such src,border,alt,. etc
  14. Ok this has probably been asked before ,so if it has can you please point me the right direction I am attempting to convert a PayPal button in to a class but I am not too familiar with OOP So I have this from Micah Carrick IPN Integration Class $p->add_field('cn', 'Add special instructions to the seller'); $p->add_field('no_shipping', '2'); $p->add_field('bn', 'PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted'); this the html code I need to convert to add to class <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> $p->image('submit', 'src','https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif');
  15. No I don't think that would work for me because then the SESSION variable would be $_SESSION['row_menu']with the value of $row_menu['field_name']; but that would only be one variable what I am try to do is create multple "unique" session variable each time the result of $row_menu['field_name']; is different some more like an example from http://www.jauhari.net/dynamic-variables-in-php.jsp $var = "hello"; Now let’s say you want a variable whose name is the value of the $var variable. You can do that like this: $$var = "World"; PHP parses $$var by first dereferencing the innermost variable, meaning that $var becomes “hello”. The expression that’s left is $”hello”, which is just $hello. In other words, we have just created a new variable named hello and assigned it the value “World”. You can nest dynamic variables to an infinite level in PHP, although once you get beyond two levels, it can be very confusing for someone who is trying to read your code. however what need is the syntax to apply the above to a $_SESSION and have the value from my query become a new varible if its possiable
×
×
  • 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.