Jump to content

chick3n

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

chick3n's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Is it possible to re-make a query so that it would order the results by name alphabetically, except 1 result that i want to be returned first, and that 1 result is dynamic so it cannot be hard coded.
  2. Ive added curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile); and it seems to have sold it, thx.
  3. I dont want to remove session ID's from my own server, the problem is when using CURL to return the web contents of another site it is attaching session ID's to the URL's, and for now i use a preg_replace to remove the session id's but i want to know if there is a way to do it through CURL itself, because with browsers when you goto a webpage you dont see the session IDs in the URL itself so how is it getting rid of them? Does it have to do with cookies maybe?
  4. basically when i use curl to grab a webpage, all the a href's contain session id's ex: ?s=2832832 or jsession=2231231 etc Is there any option to remove that? If you go with IE or FF and goto view source, that data doesnt exist.
  5. sample text: ☼☼☼ ▬ ▬☼☼☼ my result: ☼☼☼ â–¬ % what i want: ☼☼☼ ▬ ▬☼☼☼ I parse a website and it has these extended ascii characters like above. I read in the page from CURL and get that string above. php turns it into "☼☼☼ â–¬ %" and than it gets inputed into the mySQL database as that. How can i maintain the original characters? Ive tried utf8_encode, rawurlencode, combinations of the 2.
  6. Should we only open one mysql connection to the database for each page, and use that 1 connection for any SQL calls we need to make, or should we open/close the connection each time we need to get something? Or does it not really matter?
  7. Fenway ive done the implementation part, and run the scripts and my code still works like it was supposed to however im curious to test a fail case. Is their anyway to force a fail in this scenario. Or should i just use the assumption in the testing code that "hey this insert just failed (even though it really didnt) and call rollback" and see what happens?
  8. Yes i know that, i just wanted to know if their was an automated way of doing it instead of coding it like that. No matter what if their is an INSERT performed on this table another INSERT will need to be performed on another table always. But if the second insert fails the whole process should fail and the first insert should be deleted. I guess this is where i would use transactions?
  9. After i perform an INSERT INTO to 1 table, can i set up the database to automatically make another insert into another table using the last insert id? I do this already with PHP but im wondering if you can set up MySQL to do it automatically. Would i use 'triggers'? Example: 2 tables, table1 & table2 -> INSERT INTO table1 (junk, text) VALUES ('sss', 'sss'); After that query is performed i want the database to automatically create a new row in table2 with the last insert id and the tables default values.
  10. I tried union and it will give me my results however all as 1 field ------ field1 ------ 0 data1 data2 So to get what i wanted i did this for now, but i dont know if its exactly efficient. SELECT (SELECT COUNT(DISTINCT table1.id) FROM table1 WHERE table1.name='{$varName}' AND table1.submited > '{$varTime}') as field1, (SELECT id FROM table2 WHERE table2.id = $var) as field2, (SELECT id FROM table3 WHERE table3.id = $var2) as field3 This produces the results i am looking for -------------------- field1 | field2 | field3 -------------------- 0 | sss | sss Is that an efficient work around to what i was looking for?
  11. MySQL ver 5.0.45 I have 3 tables, 2 of them will always have data i want, 1 of them may not. I need a query that will return the results of the 2 tables always even if the condition in the 3rd table doesnt find a result. Example query that works but only works if all conditions are met. SELECT COUNT(DISTINCT table1.id) as total, table2.image, table3.name FROM table1 JOIN table2 ON table2.id = $var JOIN table3 ON table3.id = $var2 WHERE table1.name='{$varName}' AND table1.submited > '{$varTime}'; So whenever the where clause matches i get all the data i want. However i want a query that will return 0 for COUNT if no matches are found and will return the results from table2, and table3. table2 and table3 always use a static variable and are not dependent on table1's data at all.
  12. String 1: "<tag>text in here<ins>more text</tag>" String 2: "<tag>text in here</tag>" I want to write a expression that will stop at the end of the tag and get the text between it or stop at a predefined tag and get the text between that. So in string 1 i want to get "text in here" and stop at <ins> and in string 2 i want the same text but stop at </tag> instead. My regex for getting the text inbetween the tags is: /<span class=\"\">(.*)<\/span>/smU But i cannot get it to do an either or type of thing with <ins> || </span>
  13. I would like to sort my data by the total amount of 'clicks' for each date. Clicks are unsigned ints, Date is datetime So the dates would be DESC current -> previous, and the number of clicks would be ordered highest -> lowest by date. tom, 234 clicks, 2007-06-23 jim, 134 clicks, 2007-06-23 mike, 54 clicks, 2007-06-23 tom, 546 clicks, 2007-06-22 jim, 432 clicks, 2007-06-22 mike, 123 clicks, 2007-06-22 Thanks. --edit wow im an idiot, i solved it, couldnt have been any simpler.
×
×
  • 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.