Jump to content

oskare100

Members
  • Posts

    69
  • Joined

  • Last visited

    Never

Everything posted by oskare100

  1. Hello, OK, when I run this code now without several of the identify or the identify_negs..; [code=php:0]$item_amount="2.95"; $item_title="Templates, test, ebooks"; // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $trimmed = trim($item_title, " \t."); $keywords = explode(",", $trimmed); echo $keywords[0]; echo $keywords[1]; echo $keywords[2]; echo $keywords[3]; $sql="SELECT * FROM `items` WHERE `identify_pos` LIKE '%{$keywords[0]}%' OR `identify_pos` LIKE '%{$keywords[1]}%' OR `identify_pos` LIKE '%{$keywords[2]}%' OR `identify_pos` LIKE '%{$keywords[0]}%'"; $result = mysql_query($sql);     $row=mysql_fetch_assoc($result); echo $row['item_id']; echo $row[0]; echo $result[0];[/code] I do only get this output/it echos only this; Templates test ebooks (the keywords that is echoed in the beginning of the script) but not the item_id I want Please help, Thanks in advance, /Oskar R
  2. Hello, OK, do you mean this code then; [code]"SELECT * FROM `items` WHERE `identify_pos` LIKE '%{$keywords[0]%}' OR `identify_pos` LIKE '%{$keywords[1]%}' OR `identify_pos` LIKE '%{$keywords[2]%}' OR `identify_pos` LIKE '%{$keywords[0]%}'"[/code] And not the one with match against? Thanks, /Oskar R
  3. Hello, OK, but can I do something like NOT MATCH.. AGAINST..? Because I need to get just one result. Best Regards Oskar R
  4. Hello, OK, now I've really tried to fix this but I couldn't come longer than this; [code=php:0]$item_amount="2.95"; $item_title="Templates, test, ebooks"; // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $trimmed = trim($item_title, " \t."); $keywords = explode(",", $trimmed); echo $keywords; echo $keywords[0]; echo $keywords[1]; echo $keywords[2]; echo $keywords[3];[/code] And that echos this; [code]ArrayTemplates test ebooks[/code] So I guess that's good? Because it was from the beginning "Templates, test, ebooks" but now "Templates" "test" "ebooks" and from what I understand I needed to do that for the LIKE function to function as it should. The thing I can figure out is how to get a working MySQL querey of that, I've tried but it doesn't work... Here is one, among many others, that I've tried with; [code]"SELECT * FROM `items` WHERE ((`identify_pos` LIKE '%".$keywords[0]."%' OR '%".$keywords[1]."%' OR '%".$keywords[2]."%'OR '%".$keywords[3]."%' OR '%".$keywords[4]."%' OR '%".$keywords[5]."%') AND (`identify_pos2` LIKE '%".$keywords[0]."%' OR '%".$keywords[1]."%' OR '%".$keywords[2]."%'OR '%".$keywords[3]."%' OR '%".$keywords[4]."%' OR '%".$keywords[5]."%')) AND ((`identify_neg` NOT LIKE '%".$keywords[0]."%' OR '%".$keywords[1]."%' OR '%".$keywords[2]."%'OR '%".$keywords[3]."%' OR '%".$keywords[4]."%' OR '%".$keywords[5]."%') AND (`identify_neg2` NOT LIKE '%".$keywords[0]."%' OR '%".$keywords[1]."%' OR '%".$keywords[2]."%'OR '%".$keywords[3]."%' OR '%".$keywords[4]."%' OR '%".$keywords[5]."%'))"[/code] So could you please help me with the querey? Or at least tell me what to do? I would ge really greatful if you could.. Thanks in advance, Best Regards Oskar R
  5. Hello, Now I've changed the code to; [code=php:0]$item_amount="2.95"; $item_title="Templates, test, ebooks"; // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM `items` WHERE `price` = ".$item_amount." AND ((`identify_pos` LIKE '".$item_title."') AND (`identify_pos2` LIKE '".$item_title."')) AND ((`identify_neg` NOT LIKE '".$item_title."') AND (`identify_neg2` NOT LIKE '".$item_title."'))"; $result = mysql_query($sql); if (mysql_errno()) {       echo 'Error: ' . mysql_error(); } else {     $row=mysql_fetch_assoc($result);     echo $row['item_id']; }[/code] It doesn't echo anything.. Here is the table structure; [code]-- -- Table structure for table `items` -- CREATE TABLE `items` (   `item_id` int(11) NOT NULL AUTO_INCREMENT,   `item_name` varchar(100) NOT NULL DEFAULT '',   `price` varchar(30) NOT NULL DEFAULT '',   `identify_pos` varchar(50) NOT NULL DEFAULT '',   `identify_pos2` varchar(50) NOT NULL DEFAULT '',   `identify_neg` varchar(50) NOT NULL DEFAULT '',   `identify_neg2` varchar(50) NOT NULL DEFAULT '',   `file_id` int(10) NOT NULL DEFAULT '0',   `pack_id` int(10) NOT NULL DEFAULT '0',   PRIMARY KEY  (`item_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; -- -- Dumping data for table `items` -- INSERT INTO `items` (`item_id`, `item_name`, `price`, `identify_pos`, `identify_pos2`, `identify_neg`, `identify_neg2`, `file_id`, `pack_id`) VALUES (1, '15GB package', '2.95', '15gb', 'templates', 'test', '', 0, 0), (2, 'not 15gb package', '2.95', 'ebooks', 'templates', '15gb', '', 0, 0); [/code] But it still doesn't return anything! Please help me, what is wrong with it?? Thanks in advance, Best Regards Oskar R
  6. Hello, When I try to run this: [code=php:0]$sql="SELECT *, COUNT(*) AS i FROM `items` WHERE `price` = $item_amount AND ((`identify_pos` OR `identify_pos2`) LIKE %$item_title%) AND ((`identify_neg` OR `identify_neg2`) NOT LIKE %$item_title%) AND ((`identify_pos` OR `identify_pos2` OR `identify_neg` OR `identify_neg2`) NOT = $item_title) AND `i` = 1"; $result = mysql_query($sql); $row=mysql_fetch_assoc($result); echo $row['item_id'];[/code] I get this error: "Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in". And then I tried this; [code=php:0]$sql="SELECT *, COUNT(*) AS i FROM `items` WHERE `price` = $item_amount AND ((`identify_pos` OR `identify_pos2`) LIKE %$item_title%) AND ((`identify_neg` OR `identify_neg2`) NOT LIKE %$item_title%) AND ((`identify_pos` OR `identify_pos2` OR `identify_neg` OR `identify_neg2`) NOT = $item_title) AND `i` = 1"; $result = mysql_query($sql); if ($row = mysql_fetch_row($result)) {           return $row;         } else {           print (mysql_error());         } $row=mysql_fetch_assoc($result); echo $row['item_id'];[/code] And got this error; "Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in.. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%Templates, test, ebooks%) AND ((`identify_neg` OR `identify_neg2`) NOT LIKE %Te' at line 1 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in..." Could you please take a look at the errors and tell me what's wrong with my code? Thanks in advance, /Oskar R
  7. Hello, OK, Now I've, with help, got three suggestions about how it can be done.. The problem is that none of them work as they should.. [code=php:0]$data_matches = array(); $sql = "SELECT * FROM `items` WHERE `price`=$item_price"; $query = mysql_query($sql); while ($result=mysql_fetch_assoc($query)) {     if (strstr($item_title,$result['identify_pos'])!==false &&         strstr($item_title,$result['identify_pos2'])!==false &&         strstr($item_title,$result['identify_neg'])===false &&         strstr($item_title,$result['identify_neg2'])===false) {         $data_matches[] = $result;     } } [/code] When I try to fetch the result of that code with mysql_fetch_array($result['item_id']) I get an error message.. (Don't know how to get the correct result) [code=php:0]$sql2="SELECT item_id FROM items WHERE price = $item_amount AND (identify_pos and identify_pos2 LIKE '%$item_title%' AND identify_neg and identify_neg2 NOT LIKE '%$item_title%')"; $result2 = mysql_query($sql2); while ($row = mysql_fetch_array($result2)) {       $found_item = $row['item_id'];       echo $found_item; }[/code] When I use this code I get this error message; "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in".. (Don't know how to get the correct result) [code=php:0]$buildquery = "select * from items where price = $item_amount"; if ($identify_pos != "") {   $buildquery.= " and instr($item_title, $identify_pos) > 0"; } if ($identify_pos2 != "") {   $buildquery.= " and instr($item_title, $identify_pos2) > 0"; } if ($identify_neg != "") {   $buildquery.= " and instr($item_title, $identify_neg) < 1"; } if ($identify_neg2 != "") {   $buildquery.= " and instr($item_title, $identify_neg2) < 1"; } $result = mysql_query($buildquery);[/code] And when I use this code I either get an error message or the same item. (Don't know how to get the correct result) These codes might work, my problem is that I don't know how to get the "finnish" right (in other words; I don't know how to the the item_id of the correct result). Any help on this would be very appreciated. Thanks, /Oskar R
  8. Hello, OK, thanks, but that still doesn't solve the problem with the keywords. " item_name='$item_title'" " would only match the entire title, I want it to search for the keywords "identify_pos" and "identify_pos2" and find a match where both of the keywords are present in the $item_title. If it's possible it would be good if it also could search for the "identify_neg" and "identify_neg2" and exlude all item_name rows where "identify_neg" or "identify_neg2" are present in the $item_title. Thanks in advance, Best Regards Oskar R
  9. Hello, The problem is that I don't know how to make it first check the price and then identify the correct item by matching it against the identify_ values in the different rows where the price is the price of the item. /Oskar
  10. Hello, The answer I got when I asked this question a while ago was that any half decent query should do it but I forgoted the main problem, that it should both match the price first and then all of the identify_. Sorry to ask a similar question but I really couldn't sove it with just that answer. I want the script, when finnished, to be able to identify incomming orders by first checking the title and then, where price is = the price, check the identify to find a match. Here is the database structure; [CODE]CREATE TABLE `items` (   `item_id` int(11) NOT NULL auto_increment,   `item_name` varchar(100) NOT NULL default ''   `price` varchar(30) NOT NULL default '',   `identify_pos` varchar(50) NOT NULL default '',   `identify_pos2` varchar(50) NOT NULL default '',   `identify_neg` varchar(50) NOT NULL default '',   `identify_neg2` varchar(50) NOT NULL default '',   `file_name` varchar(100) NOT NULL default '',   `file_pack` varchar(30) NOT NULL default '',   PRIMARY KEY  (`item_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;[/CODE] First the script needs to select all rows where "price" = $item_amount. Then it should check the $item_title and search all rows where the price is $amount and find a match where the  $item_title contains "identify_pos" and "identify_pos2" but not "identify_neg" or "identify_neg2". To clarify, It is the title that should contain "identify_pos" and "identify_pos2" but not "identify_neg" or "identify_neg2" and the identify_ isn't the complete title, just keywords that the title should or shouldn't contain. The incomming transaction contains item_title and item_price - item_price -> select all items with that price in the database, if only one then that's the correct one : ) - item_title -> if several rows has the same price, then find a matching row by match the item_title with the keywords in the tows ("identify_pos" and "identify_pos2" but not "identify_neg" or "identify_neg2"). If the script finds one match, then continue. If the scripts finds several rows where the price = $item_amount and the title matches the identify_values then it should report it/do something else. Also, if it isn't a problem it would be good if the identify_ also can be empty so if just one identify_pos contains text then ignore the other identify_. Thanks in advance to anyone who can help me with this, /Oskar R
  11. Hello, When I've asked around people tell me that I shouldn't store my dates and so on in varchar and that MySQL can insert them for me.. Here is how I insert the dates and how I remove the rows that are older than five days: [code=php:0]// The current time $date = date("H:i:s M j, Y"); // The current unix timestamp $timestamp = time(); // See if there is any row in the temporary database that is older than $cutoff = time() - 432000; // 5 days ago in seconds mysql_query("DELETE FROM temp_users WHERE script_received < '$cutoff'"); // Set the latest login in the user table $sql8="UPDATE $user_tbl SET (latest_login_date, latest_login_timestamp) VALUES ($date, $timestamp) where user_id = ".$vuserid[0].""; $result8=mysql_query($sql8);[/code] And here is how the database structure looks like: [CODE]CREATE TABLE `login_logs` (   `login_id` int(11) NOT NULL auto_increment,   `user_id` int(10) NOT NULL default '0',   `ip` varchar(30) NOT NULL default '',   `logged_date` varchar(30) NOT NULL default '',   `logged_timestamp` varchar(30) NOT NULL default '',   PRIMARY KEY  (`login_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;[/CODE] I want to store the time and date in the database and be able to use the information to for example remove rows that are older than five days. It seams like CURRENT_DATE or NOW() can be used to insert the infromation without PHP into the tables and that I should use something like TIMESTAMP or DATETIME in the table in the database. The reason for that I store both the timestamp and the date in the databae for the moment is that I need to remove rows that are older than five days (as in the code above) and that I need to be able to select all rows with a date between three and five days ago. What kind of MySQL info should I have and how can I do the things I want with MySQL? Also, I'm currently storing prices in varchar but someone told me that I should use DOUBLE or DECIMAL or something similar, which one should I use for prices (ex. 2.95)? And is there any difference between storing numbers in INT or varchar? Best Regards Oskar R
  12. Hello, I'm having two problems with my login "check" script. The first problem is that nothing is inserted in the login_logs_tbl and the ip_logs_tbl. The second problem is that the "$new_num_logins = $current_num_logins[0] + 1;" part doesn't work, it just inserts "1" all the time regardless of the $current_num_logins[0]. I would also appreciate any feedback on the login script itself. Structure and content and so on.. Here is the code; [code=php:0]<?php include 'db_info.php'; // Connect to server and select databse. mysql_connect("$sqlhost", "$sqlusername", "$sqlpassword")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from signup form $vusername=$_POST['vusername']; $vpassword=$_POST['vpassword']; $sql="SELECT * FROM $user_tbl WHERE username='$vusername' and password='$vpassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $vusername and $vpassword, table row must be 1 row if($count==1){ $sql3="SELECT user_id FROM $user_tbl WHERE username='$vusername' and password='$vpassword'"; $result3=mysql_query($sql3); $vuserid = mysql_fetch_array($result3); // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("vusername"); session_register("vpassword"); // The current time (for logs) $date = date("H:i:s M j, Y"); // The current unix timestamp (for logs) $timestamp = time(); // Log the login in the ip log table $sql5="INSERT INTO $login_logs_tbl (user_id, ip, logged_date, logged_timestamp) VALUES(".$vuserid[0].", '".$_SERVER['REMOTE_ADDR']."', $date, $timestamp)"; $result5=mysql_query($sql5); // Set the latest login in the user table $sql8="UPDATE $user_tbl SET (latest_login_date, latest_login_timestamp) VALUES ($date, $timestamp) where user_id = ".$vuserid[0].""; $result8=mysql_query($sql8); // Add 1 to the number of logins in the user table $sql2 = "select num_logins from $user_tbl where user_id = '$vuserid'"; $result2 = mysql_query($sql2) or die( mysql_error() ); $current_num_logins = mysql_fetch_array($result2); $new_num_logins = $current_num_logins[0] + 1; $sql9="UPDATE $user_tbl SET num_logins = '$new_num_logins' where user_id = ".$vuserid[0].""; $result9=mysql_query($sql9); echo "$new_num_logins"; // Check if the IP is already logged in the database $sql22 = "select user_id from $ip_logs_tbl where user_id = ".$vuserid[0]." and ip = '".$_SERVER['REMOTE_ADDR']."'"; $result22 = mysql_query($sql22) or die( mysql_error() ); $row = mysql_fetch_array($result22); if ($row['user_id'] == ".$vuserid[0].") { // It's an old ip for that user - change the latest login date $sql12="update $ip_logs_tbl set (latest_date, latest_timestamp) values ($date, $timestamp) where ip = '".$_SERVER['REMOTE_ADDR']."'"; $result11=mysql_query($sql12); } else { // It's a new IP for that user - log it $sql10="INSERT INTO $ip_logs_tbl (ip, user_id, latest_date, latest_timestamp) VALUES('".$_SERVER['REMOTE_ADDR']."', ".$vuserid[0].", $date, $timestamp)"; $result10=mysql_query($sql10); // And add 1 to the number of different IPs in the user table $sql4 = "select num_ips from $user_tbl where user_id = ".$vuserid[0].""; $result4 = mysql_query($sql4) or die( mysql_error() ); $current_num_ips = mysql_fetch_array($result2); $new_num_ips = $current_num_ips[0] + 1; $sql11="UPDATE $user_tbl SET num_ips = '$new_num_logins' where user_id = ".$vuserid[0].""; $result11=mysql_query($sql11); } echo "logged in"; } else { echo "Wrong Username or Password"; } ?> [/code] Thanks, /Oskar
  13. Hello, Before I changed to my own server PHP always showed all errors, also things like if I had forgotten a ; on one line it told me that something was wrong. Now, it just shows a bland page and I have to go though the whole script or guess. I have added; [code=php:0]error_reporting(E_ALL); ini_set('display_errors', '1');[/code] But it doesn't help, it still just shows blank pages when something is wrong. Isn't it possible to change something in the PHP config file or something else to make PHP show all errors? Thanks in advance, Best Regards Oskar R
  14. Hello, I have a table where I add the items I have. When I receive a new order I get the title of the item the new order contains, and I assign that title the variable $title in the script that is supposed to match/identify the new order with an item in my database. Here is the database structure; [CODE]CREATE TABLE `items` (   `item_id` int(11) NOT NULL auto_increment,   `item_name` varchar(100) NOT NULL default '',   `price` varchar(30) NOT NULL default '',   `identify_pos` varchar(50) NOT NULL default '',   `identify_pos2` varchar(50) NOT NULL default '',   `identify_neg` varchar(50) NOT NULL default '',   `identify_neg2` varchar(50) NOT NULL default '',   `file_name` varchar(100) NOT NULL default '',   `file_pack` varchar(30) NOT NULL default '',   PRIMARY KEY  (`item_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; [/CODE] So I need the script to see if the title matches any of the items in my database. As soon as the script finds a row where the $title contains identify_pos and identify_pos2 but not identify_neg or identify_neg2 then it should get the item_id of that item and continue. If it can't find any match, then do something else.. Also, identify_pos, identify_pos2, identify_neg and identify_neg2 can be empty but I hope that doesn't make it more difficult.. If it does it is OK if all must contain something. Maybe I've forgotten to mention something important here but I'mm monitor this thread so just reply.. Is it possible to do that with PHP and if, how can I do it? I'm not that good at PHP so I can't figure out how to do that myself.. Thanks in advance, /Oskar R
  15. Hello again, Basicly, in other words, what I want to do is to find the "TransactionArray.Transaction.TransactionID" for the buyer "TransactionArray.Transaction.Buyer.UserID". It is just an XML response, is there really no one who can help me with this? I'm not even sure you need to know anything about XML to be able to help me, just have better knowledge of PHP than I. I really need help because the script I'm writing on wount work without this part and I can't figure out how to do it myself. Thanks in advance, /Oskar
  16. Hello, I want to be able to find and assign a PHP variable to the Transaction ID where the UserID is a specified user though Ebays XML API. Here is the structure of the replies I get from the XML API; http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/io_GetItemTransactions.html Now, I want to assign a variable to "TransactionArray.Transaction.TransactionID" where the "TransactionArray.Transaction.Buyer.UserID" is a specified user (theventsell in this example). I tried with this code; [code=php:0]<?php require_once('functions.php'); require_once('variables.php'); error_reporting(E_ALL); //SiteID must also be set in the Request's XML //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, .... //SiteID Indicates the eBay site to associate the call with $siteID = 0; //the call being made: $verb = 'GetItemTransactions'; //Regulates versioning of the XML interface for the API $compatabilityLevel = 433; //get an array of strings containing the required headers $headers = buildEbayHeaders($devID, $appID, $certID, $compatabilityLevel, $siteID, $verb); ///Build the request Xml string $requestXmlBody = '<?xml version="1.0" encoding="utf-8"?>'; $requestXmlBody .= '<GetItemTransactionsRequest xmlns="urn:ebay:apis:eBLBaseComponents">'; $requestXmlBody .= "<RequesterCredentials><eBayAuthToken>$userToken</eBayAuthToken></RequesterCredentials>"; $requestXmlBody .= '<ItemID>110013682918</ItemID>'; $requestXmlBody .= '<ModTimeFrom>2006-12-25T18:28:52.799Z</ModTimeFrom>'; $requestXmlBody .= '<ModTimeTo>2007-01-10T18:28:52.799Z</ModTimeTo>'; $requestXmlBody .= '</GetItemTransactionsRequest>'; $responseXml = sendHttpRequest($requestXmlBody, $serverUrl, $headers); if(stristr($responseXml, 'HTTP 404') || $responseXml == '') die('<P>Error sending request'); //Xml string is parsed and creates a DOM Document object $responseDoc = domxml_open_mem($responseXml); //get any error nodes $errors = $responseDoc->get_elements_by_tagname('Errors'); //if there are error nodes if(count($errors) > 0) { echo '<P><B>eBay returned the following error(s):</B>'; //display each error //Get error code, ShortMesaage and LongMessage $code = $errors[0]->get_elements_by_tagname('ErrorCode'); $shortMsg = $errors[0]->get_elements_by_tagname('ShortMessage'); $longMsg = $errors[0]->get_elements_by_tagname('LongMessage'); //Display code and shortmessage echo '<P>', $code[0]->get_content(), ' : ', str_replace(">", "&gt;", str_replace("<", "&lt;", $shortMsg[0]->get_content())); //if there is a long message (ie ErrorLevel=1), display it if(count($longMsg) > 0) echo '<BR>', str_replace(">", "&gt;", str_replace("<", "&lt;", $longMsg[0]->get_content())); } else //no errors { //get results nodes $transactionNodes = $responseDoc->get_elements_by_tagname('Transaction');     echo $transactionNodes;     //get the node containing the time and display its contents $eBayTime = $responseDoc->get_elements_by_tagname('Transaction'); echo '<P><B>The answer is ', $eBayTime[0]->get_content(), ' GMT</B>'; } ?>[/code] And got this when I runned it; [code] Array The answer is 2.950.00.0falsenY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFk4CkAZKDqQydj6x9nY+seQ==oskare200@hotmail.com0falseNonetruetruefalse2006-01-01T19:59:59.000ZUSConfirmedtheventbuytrue2006-12-28T22:34:43.000ZNoVATTaxTest UseraddresscitystateNone(180) 011-1111 ext.: 1951253101053eBayfalsetrue0.0NotOfferedfalsefalse0.0falseUSPSPriority0.00.01false23Flatfalsefalse2.952.952006-12-31T11:12:49.000ZNone1NoPaymentFailureCheckoutIncomplete2006-12-31T11:12:49.000ZNoneIncompletefalse50062629452.95false0.0USPSPriority0.0eBay GMT [/code] So it seams like what I get back is an array, the problem is that I don't know how to select and assign a variable to "TransactionArray.Transaction.TransactionID" where the "TransactionArray.Transaction.Buyer.UserID" is a specified user (theventsell in this example). Is it possible to do so and how can I do it? If it is to any help, here is the results I get from print_r($transactionNodes); [QUOTE]ArrayArray ( [0] => domelement Object ( [type] => 1 [tagname] => Transaction [0] => 6 [1] => 144378264 ) [1] => domelement Object ( [type] => 1 [tagname] => Transaction [0] => 7 [1] => 143887560 ) )[/QUOTE] Best Regards Oskar R
  17. Hello, The MySQL thing was to compare what I want to do with something, the items returned are from Ebays XML API. Do you think your code would work anyway? Thanks. /Oskar
  18. Hello, When I call the Ebays XML API I get an array or something similar back (see the code sample), is it possible to "select item_id where item_id = 123123" or something similar as in MySQL? If, How can I do that? Also, I need to attach a PHP variables to the row I selected as for example $starttime, $endtime and so on. Here is the code sample (the end of the scritpt); [code=php:0] <?php //stores the alternationg background colour of the rows $bgColor = "#FFFFFF"; //go through each result foreach($itemNodes as $item) { //get the required nodes from the results $itemID = $item->get_elements_by_tagname('ItemID'); $title = $item->get_elements_by_tagname('Title'); $price = $item->get_elements_by_tagname('CurrentPrice'); $startTime = $item->get_elements_by_tagname('StartTime'); $endTime = $item->get_elements_by_tagname('EndTime'); $link = $item->get_elements_by_tagname('ViewItemURL'); //display the result in a table row ?> <TR bgcolor="<?php echo $bgColor ?>"> <TD><?php echo $itemID[0]->get_content(); ?></TD> <!-- Display the Title as a link to the item on eBay --> <TD><A href="<?php echo $link[0]->get_content(); ?>" target="_blank"> <?php echo $title[2]->get_content(); ?> </A> </TD> <TD><?php echo $price[0]->get_content(); ?></TD> <TD><?php echo $startTime[0]->get_content(); ?> GMT</TD> <TD><?php echo $endTime[0]->get_content(); ?> GMT</TD> </TR> <?php //alternate the background colours $bgColor = $bgColor == "#FFFFFF" ? "#EEEEEE" : "#FFFFFF"; } ?> </TABLE> <?php }[/code] Best Regards Oskar R
  19. Hello, I've my sales in a table. I want to be able to echo them in a "google search type design" (as shown in the attached picture) where each row is like a separate table. The screen shot of a script is of the RW download script and how they show the categories in that script. Is that possible and if, what would the php code look like? This is how my second "draft" table (the one which shows three rows and is one table) looks like in HTML (with one blank line at the bottom if it). [CODE]<table border="0" width="419" height="86" bgcolor="#C0C0C0" style="border-collapse: collapse"> <tr> <td height="13" width="308" colspan="2">$item_name</td> <td height="13" width="107">$item_number</td> </tr> <tr> <td height="21" width="97">Purchase date: </td> <td height="21" width="209">$item_date</td> <td height="55" width="107" rowspan="3"> <p align="center"><a href="http://downloads">Download</a></td> </tr> <tr> <td height="14" width="97">Price:</td> <td height="14" width="209">$item_price</td> </tr> <tr> <td height="12" width="97">Downloads</td> <td height="12" width="209">$item_downloads</td> </tr> <tr> <td height="6" width="413" colspan="3" bgcolor="#FFFFFF">&nbsp;</td> </tr> </table>[/CODE] I've searched but I couldn't find any information about how to create a such table in any of the guides I'm using.. If you have one that shows how to do this, feel free to post a link to it.... (if it isn't agains the forum rules). /Oskar [attachment deleted by admin]
  20. Hello, I'm trying to build a Ebay API system to leave feedback (I still need help with that in thread http://www.phpfreaks.com/forums/index.php/topic,120213.0.html in the PHP section) but here is another more specific question about XML. This is how the code sample I got from ebay look like; [code=php:0] (The end of the file for the search code sample, full info about the function I want to use can be found at http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/io_GetFeedback.html) else //no errors { //get results nodes $itemNodes = $responseDoc->get_elements_by_tagname('Item'); //see if there are any results if(count($itemNodes) > 0) { ?> <TABLE cellpadding="6" cellspacing="0" border="0"> <TR bgcolor="#BBBBBB"> <TD><B>Id</B></TD> <TD><B>Title</B></TD> <TD><B>Price</B></TD> <TD><B>Started</B></TD> <TD><B>Ends</B></TD> </TR> <?php //stores the alternationg background colour of the rows $bgColor = "#FFFFFF"; //go through each result foreach($itemNodes as $item) { //get the required nodes from the results $itemID = $item->get_elements_by_tagname('ItemID'); $title = $item->get_elements_by_tagname('Title'); $price = $item->get_elements_by_tagname('CurrentPrice'); $startTime = $item->get_elements_by_tagname('StartTime'); $endTime = $item->get_elements_by_tagname('EndTime'); $link = $item->get_elements_by_tagname('ViewItemURL'); //display the result in a table row ?> <TR bgcolor="<?php echo $bgColor ?>"> <TD><?php echo $itemID[0]->get_content(); ?></TD> <!-- Display the Title as a link to the item on eBay --> <TD><A href="<?php echo $link[0]->get_content(); ?>" target="_blank"> <?php echo $title[0]->get_content(); ?> </A> </TD> <TD><?php echo $price[0]->get_content(); ?></TD> <TD><?php echo $startTime[0]->get_content(); ?> GMT</TD> <TD><?php echo $endTime[0]->get_content(); ?> GMT</TD> </TR> <?php //alternate the background colours $bgColor = $bgColor == "#FFFFFF" ? "#EEEEEE" : "#FFFFFF"; } ?> </TABLE> <?php } else { echo '<P><B>No items found</B>'; } } } ?>[/code] Is it possible to just select one or two of the items the script is returning and add variables as for example $item_id and so on to the selected item? Thanks in advance, /Oskar
  21. Hello, I know that this is maybe a bit complicated but I thought I could take a chance and see if someone had time to read it trough. I need help with the whole script but the main thing is [B]How to select just one transaction of all transactions ebay is returning (see the code sample, in the end of it)[/B]. I'm working on a script that will be able to "GetFeedback" to see if a user has left positive feedback and then "LeaveFeedback" positive if the feedback left was positive. Everything is built on XML, here is the functions described at ebay; [url=http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/io_GetFeedback.html]http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/io_GetFeedback.html[/url] [url=http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/io_LeaveFeedback.html]http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/io_LeaveFeedback.html[/url] Unfortunately there are not many code samples at Ebay (but all codes looks the same because it is just send and receive with different variables). Below is the sample code for searching, but I've tried to edit it and it also works the same for all other Ebay API functions. So when I request "GetFeedback" the script returns the variables in that function instead and my script creates an array with the the feedback I've received and (because I don't know how to make it do anything else) creates a table in HTML with all those iteams. [B]I need to "select" a feedback[/B]. Then I need to get all the information about it and assignt PHP variables to them as for example $transaction_id_awaiting for the transaction id, $user_id_awaiting for the user id of that transaction and so on. Because then I need those variables to be able to use the "LeaveFeedback" function to leave feedback for that transaction/user. Another thing is that the script can't select the same feedback/transaction from "GetFeedback" all the time because then script would loop to the next feedback is left. It should only select feedbacks/transactions that the script already hasn't left feedback for. Maybe I could store the for example 30 latest feedbacks that has been answered in a table in my database, only make Ebay return the 30 latest feedbacks left for me and then fist check the table before leaving feedbacks? Here is the code sample; [code=php:0]<?php if(isset($_POST['Query'])) { //Get the query entered $query = $_POST['Query']; //SiteID must also be set in the Request's XML //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, .... //SiteID Indicates the eBay site to associate the call with $siteID = 0; //the call being made: $verb = 'GetSearchResults'; //Regulates versioning of the XML interface for the API $compatabilityLevel = 433; //get an array of strings containing the required headers $headers = buildEbayHeaders($devID, $appID, $certID, $compatabilityLevel, $siteID, $verb); ///Build the request Xml string $requestXmlBody = '<?xml version="1.0" encoding="utf-8">'; $requestXmlBody .= '<GetSearchResultsRequest xmlns="urn:ebay:apis:eBLBaseComponents">'; $requestXmlBody .= "<RequesterCredentials><eBayAuthToken>$userToken</eBayAuthToken></RequesterCredentials>"; $requestXmlBody .= "<Query>$query</Query>"; $requestXmlBody .= '</GetSearchResultsRequest>'; $responseXml = sendHttpRequest($requestXmlBody, $serverUrl, $headers); if(stristr($responseXml, 'HTTP 404') || $responseXml == '') die('<P>Error sending request'); //Xml string is parsed and creates a DOM Document object $responseDoc = domxml_open_mem($responseXml); //get any error nodes $errors = $responseDoc->get_elements_by_tagname('Errors'); //if there are rrror nodes if(count($errors) > 0) { echo '<P><B>eBay returned the following error(s):</B>'; //display each error //Get error code, ShortMesaage and LongMessage $code = $errors[0]->get_elements_by_tagname('ErrorCode'); $shortMsg = $errors[0]->get_elements_by_tagname('ShortMessage'); $longMsg = $errors[0]->get_elements_by_tagname('LongMessage'); //Display code and shortmessage echo '<P>', $code[0]->get_content(), ' : ', str_replace(">", "&gt;", str_replace("<", "&lt;", $shortMsg[0]->get_content())); //if there is a long message (ie ErrorLevel=1), display it if(count($longMsg) > 0) echo '<BR>', str_replace(">", "&gt;", str_replace("<", "&lt;", $longMsg[0]->get_content())); } else //no errors { //get results nodes $itemNodes = $responseDoc->get_elements_by_tagname('Item'); //see if there are any results if(count($itemNodes) > 0) { ?> <TABLE cellpadding="6" cellspacing="0" border="0"> <TR bgcolor="#BBBBBB"> <TD><B>Id</B></TD> <TD><B>Title</B></TD> <TD><B>Price</B></TD> <TD><B>Started</B></TD> <TD><B>Ends</B></TD> </TR> <?php //stores the alternationg background colour of the rows $bgColor = "#FFFFFF"; //go through each result foreach($itemNodes as $item) { //get the required nodes from the results $itemID = $item->get_elements_by_tagname('ItemID'); $title = $item->get_elements_by_tagname('Title'); $price = $item->get_elements_by_tagname('CurrentPrice'); $startTime = $item->get_elements_by_tagname('StartTime'); $endTime = $item->get_elements_by_tagname('EndTime'); $link = $item->get_elements_by_tagname('ViewItemURL'); //display the result in a table row ?> <TR bgcolor="<?php echo $bgColor ?>"> <TD><?php echo $itemID[0]->get_content(); ?></TD> <!-- Display the Title as a link to the item on eBay --> <TD><A href="<?php echo $link[0]->get_content(); ?>" target="_blank"> <?php echo $title[2]->get_content(); ?> </A> </TD> <TD><?php echo $price[0]->get_content(); ?></TD> <TD><?php echo $startTime[0]->get_content(); ?> GMT</TD> <TD><?php echo $endTime[0]->get_content(); ?> GMT</TD> </TR> <?php //alternate the background colours $bgColor = $bgColor == "#FFFFFF" ? "#EEEEEE" : "#FFFFFF"; } ?> </TABLE> <?php } else { echo '<P><B>No items found</B>'; } } } ?>[/code] /Oskar
  22. I've now found this http://rpm.pbone.net/index.php3/stat/4/idpl/2357173/com/php-domxml-4.3.9-3.9orc.i386.rpm.html, is that the things I should install? If, How do I install them on a CentOS system?
  23. I think I've found what the name of the missing extension should be; domxml.so. But I still don't know where to find it and if I need to install it as I already have (at least I think I have) the necessary info in the php config...
  24. Hello, I'm building a download site for paid members only and I log, at least according to me, quite a lot of things. I do also have the logs spread out on several tables so I'm wondering if I maybe have a "strange" database structure that will be hard to work with.. Here is it; [CODE]-- -- Table structure for table `downl_compl_logs` -- CREATE TABLE `downl_compl_logs` (   `downl_id` int(11) NOT NULL auto_increment,   `downl_file_id` varchar(40) NOT NULL default '',   `downl_file_fullname` varchar(30) NOT NULL default '',   `downl_ip` varchar(30) NOT NULL default '',   `downl_user` varchar(50) NOT NULL default '',   `downl_refer` varchar(20) NOT NULL default '',   `downl_status` varchar(30) NOT NULL default '',   `downl_date` varchar(30) NOT NULL default '',   `downl_timestamp` varchar(30) NOT NULL default '',   PRIMARY KEY  (`downl_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `downl_fail_logs` -- CREATE TABLE `downl_fail_logs` (   `downl_id` int(11) NOT NULL auto_increment,   `downl_file_id` varchar(40) NOT NULL default '',   `downl_file_fullname` varchar(30) NOT NULL default '',   `downl_ip` varchar(30) NOT NULL default '',   `downl_user` varchar(50) NOT NULL default '',   `downl_refer` varchar(20) NOT NULL default '',   `downl_status` varchar(30) NOT NULL default '',   `downl_date` varchar(30) NOT NULL default '',   `downl_timestamp` varchar(30) NOT NULL default '',   PRIMARY KEY  (`downl_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `files` -- CREATE TABLE `files` (   `file_id` int(11) NOT NULL auto_increment,   `file_pack` varchar(50) NOT NULL default '',   `file_pack_cat` varchar(50) NOT NULL default '',   `file_cat` varchar(50) NOT NULL default '',   `file_name` varchar(100) NOT NULL default '',   `file_desc` text NOT NULL,   `file_fullname` varchar(100) NOT NULL default '',   `file_downloads` varchar(11) NOT NULL default '',   PRIMARY KEY  (`file_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -------------------------------------------------------- -- -- Table structure for table `ip_logs` -- CREATE TABLE `ip_logs` (   `ip_id` int(11) NOT NULL auto_increment,   `ip_ip` varchar(30) NOT NULL default '',   `ip_user` varchar(50) NOT NULL default '',   `ip_latest_date` varchar(30) NOT NULL default '',   `ip_latest_timestamp` varchar(30) NOT NULL default '',   PRIMARY KEY  (`ip_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `items` (Items that a user can buy) -- CREATE TABLE `items` (   `item_id` int(11) NOT NULL auto_increment,   `item_name` varchar(100) NOT NULL default '',   `item_identifi` varchar(100) NOT NULL default '',   `item_price` varchar(30) NOT NULL default '',   `item_file_name` varchar(100) NOT NULL default '',   `item_file_pack` varchar(30) NOT NULL default '',   PRIMARY KEY  (`item_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `login_logs` -- CREATE TABLE `login_logs` (   `login` int(11) NOT NULL auto_increment,   `login_user` varchar(50) NOT NULL default '',   `login_ip` varchar(30) NOT NULL default '',   `login_date` varchar(30) NOT NULL default '',   `login_timestamp` varchar(30) NOT NULL default '',   PRIMARY KEY  (`login`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `sales` -- CREATE TABLE `sales` (   `invoice_id` int(10) NOT NULL auto_increment,   `receiver_email` varchar(60) NOT NULL default '',   `item_name` varchar(100) NOT NULL default '',   `item_number` varchar(18) NOT NULL default '',   `quantity` varchar(6) NOT NULL default '',   `payment_status` varchar(10) NOT NULL default '',   `pending_reason` varchar(10) NOT NULL default '',   `payment_date` varchar(25) NOT NULL default '',   `mc_gross` varchar(20) NOT NULL default '',   `mc_fee` varchar(20) NOT NULL default '',   `tax` varchar(20) NOT NULL default '',   `mc_currency` varchar(4) NOT NULL default '',   `txn_id` varchar(20) NOT NULL default '',   `txn_id_refund` varchar(20) NOT NULL default '',   `txn_type` varchar(10) NOT NULL default '',   `payment_type` varchar(10) NOT NULL default '',   `notify_version` varchar(10) NOT NULL default '',   `verify_sign` varchar(10) NOT NULL default '',   `referrer_id` varchar(10) NOT NULL default '',   `memo` varchar(255) NOT NULL default '',   `for_auction` varchar(20) NOT NULL default '',   `auction_buyer_id` varchar(64) NOT NULL default '',   `auction_closing_date` varchar(21) NOT NULL default '',   `auction_multi_item` varchar(20) NOT NULL default '',   `account_username` varchar(50) NOT NULL default '',   `account_password` varchar(20) NOT NULL default '',   `received_timestamp` varchar(20) NOT NULL default '',   `first_name` varchar(30) NOT NULL default '',   `last_name` varchar(40) NOT NULL default '',   `  address_street` varchar(50) NOT NULL default '',   `address_city` varchar(30) NOT NULL default '',   `address_state` varchar(30) NOT NULL default '',   `address_zip` varchar(20) NOT NULL default '',   `address_country` varchar(30) NOT NULL default '',   `address_status` varchar(11) NOT NULL default '',   `payer_email` varchar(60) NOT NULL default '',   `  payer_status` varchar(10) NOT NULL default '',   `mark_paid` varchar(20) NOT NULL default '',   `mark_shipped` varchar(20) NOT NULL default '',   `mark_feedback` varchar(30) NOT NULL default '',   `feedback_received` varchar(100) NOT NULL default '',   `feedback_left` varchar(100) NOT NULL default '',   PRIMARY KEY  (`invoice_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `user_perm` (the files the user has permission to download) -- CREATE TABLE `user_perm` (   `perm_id` int(11) NOT NULL auto_increment,   `perm_user` varchar(50) NOT NULL default '',   `file_pack` varchar(30) NOT NULL default '',   `file_name` varchar(100) NOT NULL default '',   `perm_date` varchar(30) NOT NULL default '',   `perm_timestamp` varchar(30) NOT NULL default '',   PRIMARY KEY  (`perm_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` (   `user_id` int(11) NOT NULL auto_increment,   `username` varchar(100) NOT NULL default '',   `password` varchar(40) NOT NULL default '',   `payer_email` varchar(100) NOT NULL default '',   `ebay_userid` varchar(50) NOT NULL default '',   `num_downloads` varchar(10) NOT NULL default '',   `num_logins` varchar(10) NOT NULL default '',   `num_ips` varchar(30) NOT NULL default '',   `num_purchases` varchar(10) NOT NULL default '',   `address_street` varchar(50) NOT NULL default '',   `address_city` varchar(30) NOT NULL default '',   `address_state` varchar(30) NOT NULL default '',   `address_zip` varchar(20) NOT NULL default '',   `address_country` varchar(30) NOT NULL default '',   `address_status` varchar(11) NOT NULL default '',   `payer_status` varchar(10) NOT NULL default '',   `first_name` varchar(30) NOT NULL default '',   `last_name` varchar(40) NOT NULL default '',   `latest_login_date` varchar(30) NOT NULL default '',   `latest_login_timestamp` varchar(30) NOT NULL default '',   `created_date` varchar(30) NOT NULL default '',   `created_timestamp` varchar(30) NOT NULL default '',   PRIMARY KEY  (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; [/CODE] Feedback is appreciated : ) Thanks in advance, /Oskar
×
×
  • 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.