Jump to content

playwright

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Everything posted by playwright

  1. I have multiple datetimes. The format is dd-mm-yy, hh:mm. I want to insert it into a table using mysql. However mysql format is yy-mm-dd, hh:mm:ss. How can i do it and what type should i use (datetime?timestamp?). Thanks for your help!!
  2. I have a table (id,name,number). Id is auto-increment so it is different in every row. I want to add more entries in my table. However, when i add entries i don't want to insert rows that name AND number that are identical to another row that already exists. For example if there is already a row in my table (4,'Bill', '345'), I want to be able to insert (NULL,'Bill','667') or (NULL,'John','345') but not (NULL,'Bill', '345') (i use NULL since it is auto-increment) Is it appropriate to use unique (name,number)?
  3. You mean that i should remove primary key index from the id field?? i understand what you say about unique indexes. However,i want to be able to enter rows like this one: (id, 'John','567') if there is already an entry like : (id, 'John', '123') or (id,'Bill','567') So i cant use unique index. Actually i shouldn't have entries that have identical name and number with another row. However, the entire row won't be identical since id is different.
  4. Hello.I have created a table with some rows. Then, i want to add more rows in the table using insert into. However, i need to check if any of the rows that i add is ALMOST identical to a row that already exists, so as to avoid adding rows with the same content in the same table. To be more specific i have a table like this one: First column: id (primary key), Second column:name, Third column:number (1,'John','123') (2,'John','123') (3,'Bill','345') I dont want to enter both first and second entry since they have the same name and number. Should i first enter them and then delete the one? Any ideas???
  5. Actually i am grabbing datetimes from a text and i want to put them in a db. The format of these datetimes is dd-mm-yy hh:mm. When i put them in the db it shows 0000-00-00 00:00:00 and this happens with all datetimes. I use mysql and datetime type in my table. I think i should do some convertions. Any ideas?
  6. Hello!! i want to save datetimes into a mysql database. Their format is dd-mm-yy hh:mm. I think mysql format for datetime is yy-mm-dd hh:mm..How can i convert them??
  7. Is there a way to fill one column of a table and afterwards fill the rest columns??For example i have a table : abc('id','a','b','c') and i want to fill first the column 'id' and 'c' (where id is the primary key) with elements and then fill the other columns.. As a result i want to have all rows filled with all elements but is this possible to do it in 2 steps???
  8. You 're right..I used the pattern you said and it works fine now!!
  9. Hello!! i want to grab all content that is between the tags <-- message --> and <!-- message -->.. I have found the right pattern to do so which is something like preg_match_all('%<!-- message -->(.+)<!-- / message -->%si',$x,$y) but it seems that it grabs all content from the 1st tag <-- message --> untill the last tag <!-- message --> in one record. However, there are many more such tags between the first and the last encounter and the thing is that i want to fill my array with all this records separately..Any ideas???
  10. Problem solved..I just needed to use foreach ($y[$i] as $img){}..
  11. I'll be more specific : i Want to grab every : <img src="blablabla" border="X" alt="" title="X" class="X" /> that exists in the source code..That's why i use preg_match_all(). Then i want to check for every record if in "blablabla" a specific word is contained.Let's say if "smilies" is contained in "blablabla". And "smileys" appears only in 30th position of "blablabla" and that's why i use substr()..
  12. it gives me an error Invalid argument supplied for foreach()..
  13. I want to create a table $y that contains anything that matches with the pattern /<img src\=[\"](.*?)[\"] (.*?)>/si'..Then convert any value of the table into string so as to check if the value contains a specific phrase..That's way i'm using substr().
  14. hello!! is there any function that can convert every single value of an array into string??? I tried implode() but i think it converts the whole array into one string..maybe i'm wrong..this is what i'm trying to do.. preg_match_all('/<img src\=[\"](.*?)[\"] (.*?)>/si',$x, $y); $count = count($y; for ($i=1;$i<=$count;$i++){ $keys = implode("+",$y[$i]); $new = substr($keys,30,7); } any ideas??
  15. i'm using the right paths now, the files are different but it seems to be stuck in comparing the html files..Anyway does anyone know a way to compare two html files??
  16. i do something like that do{ ... }while (file_get_contents($html1)!=file_get_contents($html2)); and it gives me an error..failed to open stream: No such file or directory
  17. I need to compare 2 html files so as to use this statement in a do-while loop. Can i do this by using file_get_contents() for each file and then compare the result?e.g do{ ... }while (file_get_contents($html1)!=file_get_contents($html2));
  18. ok i will be more specific..the code is this one: <a class="paginationLink" href="showthread.php?t=123&page=2" title="Display results">2</a> I want to be able to use a regex or something else so as to grab all href like this one (and also showthread.php?t=123&page=3 and showthread.php?t=123) and then use file_get_contents() to grab contents from all these files.
  19. Is there a way to search in html file for a specific string and the same string plus some other content? For example: abc.php?t=123 and also abc.php?t=123&page=2 and abc.php?t=123&page=3. Is there a regex that can do the job along with preg_match()?
  20. Actually i want to give to file_get_contents() function a url like the one i mentioned above and return to me all urls that are like http://www.................&page=2 or &page=3 and so on. I can do that manually by changing the url and read every page at once, but i want it automatically to read all pages and show them at once. For example, lets say read all posts of the same thread that are contained in more than one pages..
  21. I want to parse multiple html pages in a php file.. The first url is like http://www.blablabla.php?t=123. The other pages are http://www.blablabla.php?t=123&page=2 ... http://www.blablabla.php?t=123&page=3 and so goes on..I believe this can be done with regex and a loop???Any idea about how the regex can be like?
  22. i just tried something like that preg_replace('/<div class\=[\"]quotation[\"] style=[\"][\"]\>(.*?)<\/div>/si',"", $html); and it works!! is there a better way to do that??
  23. I want to remove a div tag with all its content..so far i' m able to remove tags that don't contain any other tags inside..e.g <b>bla bla bla </b>..However the div tag i want to remove is like <div class="" style=""><tag>bla bla...<other tag/>....</tag></div>..any ideas??
×
×
  • 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.