Jump to content

aschk

Staff Alumni
  • Posts

    1,245
  • Joined

  • Last visited

    Never

Everything posted by aschk

  1. I'll provide you with an example so you can see what I mean: <?php while($row=mysql_fetch_array($query)){ echo $theFid=$row['member_id'];//member" echo $themsg=$row['emailmsg'];//message echo $thedate=$row['recdate'];//date received echo $theid=$row['main_id'];//id }; ?> Put that in your code and you'll see what I mean.
  2. So you have sets of nodes? i.e. Best List 1 contains Nodes, 1,2,3? Best List 2 contains Nodes, 1,3,5?
  3. And a sample dataset and simple explanation? Drupal eh? I've been working with it for the past couple of months so hopefully it'll become obvious what you're after when I get these last pieces of the puzzle.
  4. One word: regex (regular expressions). Something like: $regex = "@<a[^>]+href=([^>]+)>@i"; preg_match_all($regex, $subject, $matches); Try it and see, I make no guarantees...
  5. I think when the op refers to "banks can do it" he means, when you're going through a "step" situation , like a transaction. What happens is that the server side (session) maintains a record of the last state you were in (i.e. step 3) , and on going "back" in the browser, or "refreshing" the server asks what step the last one was (from session info), and decides upon logic depending on that. You can't disable a persons browser capabalities. And even if you could I wouldn't recommend it as you're interfering with a common user interface (making your site less usable). Describe to us what your problem is and why you want to faciliate this. Is your problem regarding "double posting" of information? i.e. they fill in a form, post to another page, and then refresh that page (asking for re-post) ?
  6. Most webhosts these days CAN provide custom php environmental variables for your apache config file. You need to request that they change this (within reason of course). The fact that you can upload smaller file indicates that it's a size issue.
  7. Mmm, I concur session_register() is deprecated. You probably change the lines to <?php // Register the session variables $_SESSION["ses_basket_items"] = $ses_basket_items; $_SESSION["ses_basket_name"] = $ses_basket_name; $_SESSION["ses_basket_amount"] = $ses_basket_amount; $_SESSION["ses_basket_price"] = $ses_basket_price; $_SESSION["ses_basket_stockcode"] = $ses_basket_stockcode; $_SESSION["ses_basket_id"] = $ses_basket_id; ?> You will also need to intialise all the proper variables above.
  8. You may wish to consider FULLTEXT search options. Splitting the string into it's component parts and using the MATCH clause with them. See the following reference: http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html The one requirement is that the tables are MyISAM (until falcon sorts itself out).
  9. Assuming a linux server, and also assuming default directories, they should be located inside /var/lib/mysql , however some people choose to install in /usr/local/mysql-x.x.x (where x represents version part)
  10. I've given the hint With the code I quoted you're ALREADY looping your dataset, i.e. what you have there is getting the next row each time in a loop. You just need to figure out what you should really be putting inside the loop.
  11. Curiously why would you want this? You're better of keeping it as a rowed dataset, then you can manipulate any rendered output in your scripting language instead.
  12. Sorry, i'm not 100% sure of what it is you're asking for here. You have a table with data records in it, what are you trying to get out of it?
  13. Before I go any further, i'd like to ask that you provide a schema layout for the tables you are using. And a description and sample set of the data you want returning.
  14. You are already looping through your dataset by using the while loop I have quoted above.
  15. Yup, or you could use DATE_SUB, it's just the inverse INTERVAL of DATE_ADD
  16. This probably sounds silly, but when you posted this question, the date was the 10th of Feb... TODAY IS the 10th of Feb...
  17. That sounds like a good answer to your own question. Have you tried it?
  18. I don't know, but then I'm not the one requesting the answer to the question, so I covered all bases
  19. Or you could use INSERT .... ON DUPLICATE KEY UPDATE ... See the manual for syntax. http://dev.mysql.com/doc/refman/5.1/en/insert-on-duplicate.html
  20. So basically you're looking to generate an invoice number based on current date + XX. Thus you need to count the number of invoices that have a date of today, and append 1 to that count. ... $query = "SELECT CONCAT(REPLACE(CURRENT_DATE,'-',''),COUNT(*)+1) FROM invoice WHERE inv_date = CURRENT_DATE"; $result = mysql_query($query); $row = mysql_fetch_row($result); $count = $row['inv_num'];
  21. For anyone else interested I have generated a SQL schema for testing: CREATE TABLE items ( site_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, site_name VARCHAR(255) NOT NULL, site_category INT UNSIGNED NOT NULL ); INSERT INTO items(site_name, site_category) VALUES('yahoo.com',1) ,('msn.com',1) ,('google.com',2) ,('youtube.com',3) ,('yahoovideo.com',3); CREATE TABLE Sums( site_id INT UNSIGNED NOT NULL, `day` DATE NOT NULL, visitors INT UNSIGNED NOT NULL DEFAULT 0 ); INSERT INTO Sums(site_id, `day`, visitors) VALUES(1,'2009-01-01',851075) ,(1,'2009-01-02',172083) ,(2,'2009-01-01',1750207) ,(2,'2009-01-02',2357) ,(3,'2009-01-01',123);
  22. I'll break this down: Total Visitors (for all days) for site_id 1 SELECT site_id , SUM(visitors) FROM Sums WHERE site_id = 1 GROUP BY site_id Linking the above to a "Site Name" SELECT i.site_id , i.site_name , SUM(s.visitors) FROM items i LEFT JOIN Sums s ON i.site_id = s.site_id GROUP BY i.site_id, i.site_name P.S. you never supplied a SQL query for us to start working with, so I can only really guess at what you were doing before. P.P.S it might also be worth me pointing out you are storing your dates in a non-standard format. Use MySQL DATE datatype please instead.
  23. Of course not... $result is a "resource" type. If you want the actual data from that query you'll need to use any of the mysql_fetch_* functions to pull the data from that query. Anyway you'll want to do a query using the INFORMATION_SCHEMA tables, not using the "SHOW TABLES" cmd.
  24. So which fields are duplicated? This is key to the query. I'll take a guess: SELECT p1.id, p1.title, p2.id, p2.title FROM photo p1 JOIN photo p2 ON p1.title = p2.title AND p2.id != p1.id The above should give you all the id's (assuming "id" is the name of your primary key) and title's of duplicated records. This also points to an issue with indexes. If your titles need to be unique make sure your application checks for duplicate titles before it starts the insert, AND you have a UNIQUE index on the title field, to stop duplicate entries.
  25. From the cmd prompt mysqldump --opt -uUSERNAME -p DATABASE_NAME > "C:/path/to/dump/file.sql"
×
×
  • 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.