Darkness Soul
Members-
Posts
133 -
Joined
-
Last visited
Never
Everything posted by Darkness Soul
-
Yo, Guys, I need a little help.. or maybe a little function.. I've been seach at php.net function list and don't see nothing like what I need.. I need a function to remove and replace special chars.. to make safe names to the images without cripty then.. exemple: [code]$image = '#_Àéçomn_01.jpg' ; $image = fun_rem_spec_char ( $image ) ; print $image ;[/code] : _Aecomn_01.jpg Thanks for the help.. D.Soul
-
hm, its don't work.. i've tried it this logic: print '1' shell_exec print '3' the py file is togheter in the same folder, so i use the $result as you said, but, it print '1', and stop printing.. do nothing.. tonight i will try better, now im little busy, but thanks =) D.Soul
-
Yo, I need a little help over there.. I wanna to run a python script from a php page.. something like: [code]/* block code */ switch ( $var ) { case 1: # run first.py case 2: # run second.py } /* block code */[/code] This is just an exemple from my idea.. Thanks anyway. D.Soul
-
/** SOLVED **/ [code]SELECT id , data_nascimento , nome FROM tbShalom_Alunos WHERE SUBSTRING( data_nascimento , 5 , 4 ) >= '. $arr_aniversariante[0] .' AND SUBSTRING( data_nascimento , 5 , 4 ) <= '. $arr_aniversariante[2] .' ORDER BY SUBSTRING( data_nascimento , 5 , 2 ) ASC , SUBSTRING( data_nascimento , 7 , 2 ) ASC , nome ASC[/code] =D Thank you! D.Soul
-
Yo, I've tried it and tried between, but it don't work well.. my data_nascimento field is birthday type, so, the year are "random".. And I don't know how to do some like it: [b]YEAR( data_nascimento ) . "0522"[/b][!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] data_nascimento [color=green]FROM[/color] [color=orange]tbShalom_Alunos[/color] [color=green]WHERE[/color] data_nascimento BETWEEN YEAR( data_nascimento ) . [color=red]"0522"[/color] [color=blue]AND[/color] [color=red]"20060612"[/color] [!--sql2--][/div][!--sql3--] Thank you for the help =) D.Soul
-
Yo, I need some help here.. I want to select a interval of dates based on now(), where it start 7 days ago and go to 14 days after.. I've tried to use a function to calculate start/end date, but unhappy its wont work too.. My printed sql is:[code]SELECT id , data_nascimento , nome FROM tbShalom_Alunos WHERE data_nascimento >= "22/05" AND data_nascimento <= "12/06" ORDER BY SUBSTRING( data_nascimento , 7 , 2 ) ASC , nome ASC[/code] 22/05 and 12/06 is a datee() php type, I can print it as I wish, 'd/m' is on.. Thanks for any help =) D.Soul
-
Yo, Thats the point! I'm working on the script to see the result it does.. but, why I need a blank html page? May I create one? like using[b] fopen ( html , w ) [/b]directly? ^-^! *scripting to see the result* [b]Yeah, safe and done! Its work perfectly.. I've change something and personalized it.. making a function.. =) thank you a lot!![/b] D.Soul
-
Hmm, There's no other way? I need to save the mail.html because the sistem can create many files, so the user select the file to send. If exist no other way, I'm thinking in create a html-generator, like htmlarea but more like then that blogs and flogs tools.. to designe how-to-show.. D.Soul
-
Yo, Guys, I need a little help here.. I'm lost in this problem.. The problem is: [img src=\"style_emoticons/[#EMO_DIR#]/excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /] I have a mail.php page, and it generate in the browser a page with the lastest news. But I want to send this one by mail, so I need to save this code as html so send it as newsletter. [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] Thanks anyway, D.Soul
-
Hmmm.. so my performance will be affected less if I broke one in two tables then I make the tabble fields with wrong values? Like... name varchar (128) when i just need about 40.. This give me another question (I think this one is design), like mail field, if I want to limit the mail fild at 45 varchar... whats better? varchar(45) or varchar(64) ? I think about the 64 because of bits values... 1, 2, 4, 8, 16, 32, 64... D.Soul
-
[!--quoteo(post=371604:date=May 5 2006, 01:52 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ May 5 2006, 01:52 PM) [snapback]371604[/snapback][/div][div class=\'quotemain\'][!--quotec--] It's possible that you should have two tables, but there's always a trade-off; if the other "empty" columns aren't NULLable, there are a reasonable number of them, and they're fixed width, you're probably fine. This is partly a normalization question and partly an DB design issue. [/quote] I see, but I was thinking about performance.. so, the performance don't change in this case? About normalization and db design is better two tables.. if I understand right.. =) (never see 'reasonable' word before) edit: I forget ask about security, I think is naturaly increase when keep the data in two tables, is it true? D.Soul
-
Yo, Nice topic! ^^ This give me a question.. o-o When I have to store the user information, and only login fields are required.. whats better? one or two table? I think, with one table, records all user data into the row (many col possibily blank). And with two, one with id, user, pass, mail.. and other with the other data.. I used to keep all into one table.. but don't know if its better or not.. D.Soul
-
Hi, I have a question about syntax.. I want to use an insert or update with select inside it.. I have it work¹ but want to make it faster with this idea².. code working (¹): [code]$sport_q = mysql_query ( 'SELECT id FROM tbSports WHERE name="climb" LIMIT 1' , $conn ); $sport_f = mysql_fecht_array ( $sport_q ); $sport = $sport_f['id']; $other_q = mysql_query ( 'SELECT id FROM tbOther WHERE name="movies" LIMIT 1' , $conn ); $other_f = mysql_fecht_array ( $other_q ); $other = $other_f['id']; $write_q = mysql_query ( "INSERT INTO tbIds ( idsport , idother , iduser ) VALUES ( $sport , $other , $iduser )" , $conn );[/code] code idea (²): [code]$sport_q = 'SELECT id FROM tbSports WHERE name="climb" LIMIT 1'; $other_q = 'SELECT id FROM tbOther WHERE name="movies" LIMIT 1'; $write_q = mysql_query ( "INSERT INTO tbIds ( idsport , idother , iduser ) VALUES ( $sport_q , $other_q , $iduser )" , $conn );[/code] I'm doing it because i have about eight selects inside my insert/update, and the file have about 25000 lines.. so, I want to make it import faster.. Thank you. D.Soul
-
Yeah fen, I agree.. But, the problem here is the states.. this way will need one table for each state.. If I understood right... is wanted to be one id_auto_inc for each state.. if I'm wrong, sorry ^^"! So, with many auto_inc like many states.. i can't think in other way different from my way.. D.Soul
-
Maybe you make a table to use with the states counter.. like.. id / state / value 1 va 5 so, you read this table before insert the new entry, filter by state limit 1, take the value, sum it with 1, make the text entry (pref.state.(value+1)), record.. if sucessfult, go to your state table and do something like UPDATE table SET value=value+1 WHERE state='va' LIMIT 1.. Do you get my idea?? it may be useful ^^! but i don't sure it is the better way.. D.Soul
-
Hi guys, I'm learning about that preg_replace, but, all tutorials I have found, have no info about how to use it as well.. I mean that [i]mixed pattern[/i] field.. Like this exemple.. it was suppose to secury an url from a user or form to call in the require/include.. [code]$url = $_POST['url'] $url = preg_replace ( '@\.\.*@' , '.' , $url ); require ( $url );[/code] So, what the frell is that [b]'@\.\.*@'[/b]..? o-o ^^ Thank you.. D.Soul
-
Let me try one more time, if you don't understood, I will ask for help to 'rewrite' my question.. ;) You open my site... in the index, you have a list with who are at birthday.. to make that list, my script do: 1. call the date function, that will calc the 'begin' and the 'end' of the date select; 2. call the select, that will filter this date and order by date.. 3. print the list my function is like: fuction calc_date ( $today , $days_before , $days_after , $date_format ) so, i call it: [b]$array_date = calc_date ( date ('d/m') , 14 , 7 , 'd/m' ) ;[/b] My array: [b]array_date: 0 -> 13/4 1 -> 27/4 2 -> 4/5[/b] 0 is $today - $days_before, 1 is $today, 2 is $today + $days_after. My SELECT is suppose to get all data between $array_date[0] and $array_date[2].. if the date match.. it will be listed.. so, in the site main, that will list all the guys in birth.. like: [b]SELECT id, born, name FROM tbMembers WHERE born >= $array_date[0] AND born <= $array_date[2] ORDER BY born DESC[/b] better now? ^^" sorry for the mess.. D.Soul
-
Yo, Born is a TIMESTAMP field, like 20060426152712 (YmdHmi). My function return an array with three dates.. array( before , now , after ); What I do? I call that function and as parameter, before is how many days ago, after is how many days after.. What I want from the select? Check a date, like NOW().. into select, want to test a time begins $before and going to $after.. so, show me all results between these two fields.. ^^" sorry for "complex" english.. trying hard to learn faster \o\~~.. Thanks, D.Soul
-
Hi Guys, Well, mysql is not my speciality, so, what I'm done wrong? D.Soul Error:[code] #1064 - 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 'ON tbCatalogo_Produtos.id_subdepartamento = tbCatalogo_Subdepa [/code] Code: [code]SELECT tbCatalogo_Produtos.id AS id, tbCatalogo_Produtos.titulo AS titulo FROM tbCatalogo_Departamentos INNER JOIN ( tbCatalogo_Subdepartamentos INNER JOIN ( tbCatalogo_Produtos ON tbCatalogo_Produtos.id_subdepartamento = tbCatalogo_Subdepartamentos.id ) ON tbCatalogo_Subdepartamentos.id_departamento = tbCatalogo_Departamentos.id ) ON tbCatalogo_Departamentos.id = 2 WHERE tbCatalogo_Subdepartamentos.id = 5[/code]
-
I'm trying to make my own shopping cart, so I have some interest too, but can't help =(.. I will keep an eye here, and, if I learn something (useful) I will post it here.. D.Soul
-
Hi guys, [b]How to create thumbnail of wmv movie?[/b] I start working with stream today, and need to make a WMV gallery.. I've used to upload the file by the site, it's save on database, and refresh the view page.. now its supposed to show the movie thumbnail, but.. i don't know how to.. Thank you.. D.Soul
-
Be sure you can.. enjoy! D.Soul [code]<?php // destination? $location = 'index.php'; // as you wish.. header ( "location:". $location ); ?>[/code]
-
Invalid argument supplied for foreach()
Darkness Soul replied to Mobyforce1's topic in PHP Coding Help
Is that line 115 before foreach at your code? Your second if has double bracers.. (( condition )) ^~ I think is that linen 115 oO D.Soul [code]<?php # line 115 ???????? //cycle through each sub-array foreach ( $leadercache as $players ) { // verify, else loop if ( in_array ( $players['PID'] , $squad )) { //No one knows for sure what happens past Sergeant Major of the Corps //I suspect they become 2nd Lieutenant after Sergeant Major of the Corps, and stay there. (until expansion?) if ( $players['RANK'] >= 11 ) { $pcntDiff = number_format ( 100, 2); $newrank = "At ease soldier!";[/code] -
Try it.. =) D.Soul [code]<?php if ( isset( $_POST['MAX_FILE_SIZE'] )) { $uploadDir = 'images/'; // Upload 1 if ( $HTTP_POST_FILES['upload1']['error'] == 0 ) { $path1 = $uploadDir . basename( $HTTP_POST_FILES['upload1']['name'] ); if ( move_uploaded_file ( $HTTP_POST_FILES['upload1']['tmp_name'] , $path1 )) { echo "The file ". basename($HTTP_POST_FILES['upload1']['name'])." has been sucessfully uploaded"; } else { echo "There was an error with your upload. Please try again."; } } // Upload 2 if ( $HTTP_POST_FILES['upload2']['error'] == 0 ) { $path2 = $uploadDir . basename( $HTTP_POST_FILES['upload2']['name'] ); if ( move_uploaded_file ( $HTTP_POST_FILES['upload2']['tmp_name'] , $path2 )) { echo "The file ". basename($HTTP_POST_FILES['upload2']['name'])." has been sucessfully uploaded"; } else { echo "There was an error with your upload. Please try again."; } } // Upload 3 if ( $HTTP_POST_FILES['upload3']['error'] == 0 ) { $path3 = $uploadDir . basename( $HTTP_POST_FILES['upload3']['name'] ); if ( move_uploaded_file ( $HTTP_POST_FILES['upload3']['tmp_name'] , $path3 )) { echo "The file ". basename($HTTP_POST_FILES['upload3']['name'])." has been sucessfully uploaded"; } else { echo "There was an error with your upload. Please try again."; } } } ?> <html> <head> <title> .::Upload::. </title> </head> <body style="font-family: Arial; font-size: 10px;"> <form method="post" enctype="multipart/form-data" action=""> <input type="hidden" name="MAX_FILE_SIZE" value="650000" /> File location: <input type="file" name="upload1" /><br /> File location: <input type="file" name="upload2" /><br /> File location: <input type="file" name="upload3" /><br /> <input type="submit" value="Upload" /> </form> </body> </html>[/code]
-
Hi guys, I like to ask about a date select.. how my topic name tell, I want to select the daily births.. The user open the page and, in a div, have all the members who are at birthday.. But, my logic problem is: The table record the born, like... 20/10/1987, 09/06/1981.. and my select test if born is between afternoon and tomorrow.. this test is because i want to select between 3 days ago and 3 days after.. Actualy: [code]$sql = "SELECT id, born, name FROM tbMembers WHERE (born > $daysago AND born < $daysafter) ORDER BY born DESC"; $query = mysql_query ( $sql , $conn );[/code] It will test the born year with 2006, so, never select... Thanks anyway.. =) D.Soul