Jump to content

tecdesign

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

Everything posted by tecdesign

  1. I would love to build software which will help me automatically upload auctions to www.trademe.co.nz and www.zillion.co.nz. Is there anyway to remotely login to a website and go through the motions of posting data into their fields? Can anyone point me in the right direction?
  2. I tried the following script if(is_uploaded_file($_FILES['file']['tmp_name'])) { // file uploaded to server move_uploaded_file($_FILES['file']['tmp_name'], "/FILES/$username".$_FILES['form_image']['name']); } else { print ('<p class="bl"><strong>Unable to upload file.</strong></p><p>'); print_r($_FILES); print('</p>'); } With no luck, I have no trouble when working with linux hosting using php 4.4 although this is windows hosting using PHP 5
  3. How do you embed images into an email sent to a group so it looks just like an html web page? Any suggestions?
  4. COM is great the only problem is windows version of php is the only version which supports it and even worst most of the hosting companies who do have windows php usually don't support COM. Actually anyone out there know of a windows hosting service with php that supports COM?
  5. I can create a file to download to excel, but I would like to know if you can bold the excel sheet or make headers and change the width of the cells. If not feel free to say impossible in php. Cheers everyone.
  6. Ok after reading the COM section on php.net. You need to run php on a windows server for the COM classes to work.
  7. This is suppose to be a way $word = new COM("word.application") or die("Unable to instantiate Word"); $word->Documents->Open($filename); $new_filename = substr($filename,0,-4) . ".txt"; // the '2' parameter specifies saving in txt format $word->Documents[1]->SaveAs($new_filename,2); $word->Documents[1]->Close(false); $word->Quit(); $word->Release(); $word = NULL; unset($word); $fh = fopen($new_filename, 'r'); // this is where we exit Hell $contents = fread($fh, filesize($new_filename)); fclose($fh); unlink($new_filename); But I keep getting the error Cannot instantiate non-existent class: com in public_html/editor/word_count.php on line 28 Anyone know how to use the above code.
  8. I need to count the number of words in a microsoft word document. I have search the internet and so far no good. Anyone have any ideas?
  9. Does anyone know how to take the html code of an Iframe and read this code in a text box? Some examples of the code are here: function transfer_email() { var coding = iView.document.body.innerHTML; document.getElementById('email_area').innerHTML = coding; } <iframe id="iView" style="width: 415px; height:205px"> </iframe> <p> <input type="submit" name="Submit" value="Transfer to Email" onClick="transfer_email()"> </p> <p> <textarea name="textarea" cols="70" rows="15" id="email_area"></textarea> </p>
  10. I tried the following mysql query and it is not working $result = mysql_query("select * from $bank where username = '$username' ORDER BY $order DESC HAVING date_stamp >= $from AND date_stamp <= $to"); Any Suggestions
  11. I was using an older version of mysql (around 2. and this code worked fine.... $sql = mysql_query("INSERT INTO `members` ( `username` , `password` , `first_name` , `last_name` , `birthday` , `email_address` , `phone` , `fax` , `street_address` , `suburb` , `country` , `city` , `region` , `postcode` , `mobile` , `id` , `signup_date` , `last_login` , `photo` , `total_posts` ) VALUES ( '$username', '$password', '$first_name', '$last_name', '$birthday', '$email_address', '$phone', '$fax', '$street_address', '$suburb', '$country', '$city', '$region', '$postcode', '$mobile', NULL , NOW( ) , '00000000000000', 'nopic.gif', '0' )"); Now the code does not work, it doesn't give an error message it just does not insert the data into the database. Can someone out there help?
  12. I would like to read a csv file and upload the information into a database. I have started with the following code [code]$data = read_csv('transumm.csv','|'); for ( $i = 0; $i < count($data); $i++ ) { \\$sql = mysql_query("insert into transactions values (" for ( $u = 0; $u < count($data[$i]); $u++ ) {   echo $data[$i][$u].' ';   if($data[$i][$u] == end($data[$i]))   {   \\echo ");   } } } echo '<p>';  [/code]
  13. In a Mysql statement I want to read the variable as part of the mysql statement in the php coding. Is this possible? E.g $sql = mysql_query(" INSERT INTO `transactions` ( `transid` , `username` , `trans_type` , `trans_name` , `trans_method` , `ref` , `code` , `amount` , `date` ) VALUES ( NULL , 'asdf', '."$new_string".')");
  14. try this [code] $result=mysql_query ("SELECT UNIX_TIMESTAMP(mysql_column) as epoch_time FROM table"); $unix_timestamp = mysql_result ($result, 0, 0);                            echo date("F j, Y @ g:ia", $unix_timestamp); [/code] Search in the new snippet section also, they have a really good tutorial on this area. Big ups for the admin for creating the new section.
  15. [!--quoteo(post=384636:date=Jun 16 2006, 04:22 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 16 2006, 04:22 AM) [snapback]384636[/snapback][/div][div class=\'quotemain\'][!--quotec--] Or you can just use PHPs builtin function strtotime which converts the date into a unix timestamp, like so: [code]$result=mysql_query ("SELECT time_col FROM table"); $row = mysql_fetch_array($result); $date = date("F j, Y @ g:ia", strtotime($row['time_col'])); echo $date;[/code] [/quote] I've tried that and it doesn't seem to work for some reason... As it will just put the default date of 1970 or 1900 if you have php 5. My way seems to be successful in php 4.3.0
  16. If you want to take a timestamp from a mysql database you must convert it into a unix timestamp to echo/print out a correct date. [code]$result=mysql_query ("SELECT UNIX_TIMESTAMP(mysql_column) as epoch_time FROM table"); $unix_timestamp = mysql_result ($result, 0, 0);                            echo date("F j, Y @ g:ia", $unix_timestamp); [/code] NB: This is an add on from the tutorial given here in the new snippet section. I just tried this code out and it works and it will solve alot of peoples problems, feel free to add it in as an extension. The as epoch_time is not neccessary for this situation as it is only renaming the column.
  17. Could someone please help? The code is the following CREATE PROCEDURE hire_toy @memberid int = NULL, @toyid int = NULL, @hiredate datetime = NULL AS --IF @memberid = NULL PRINT 'Mem is null' --IF @toyid = NULL PRINT 'toy is null' --IF @hiredate = NULL PRINT 'hiredate is null' IF(@memberid = NULL OR @toyid = NULL OR @hiredate = NULL) BEGIN RAISERROR('Please enter all required parameters: Member id, Toy id, Hiredate',16,1) RETURN END print 'debug 0' INSERT INTO Hire (Member_Id, Toy_Id, Hire_Date) VALUES (@memberid, @toyid, @hiredate) print 'debug 1' IF @@ERROR <> 0 BEGIN print 'error occured' END ELSE BEGIN print 'updating toy status: id: ' + CONVERT(varchar(16), @toyid) UPDATE Toys SET Status = 'Hired' WHERE Id = @toyid END print 'debug 2' - Only gets output of: debug 0 - Updates fine but nothing beyond the insert is executed!? So once the information has been inserted into Hire it does nothing else? It seems strange is there anyone who can help?
  18. I know this is php but I need this for a php section. Could someone please help? The code is the following CREATE PROCEDURE hire_toy @memberid int = NULL, @toyid int = NULL, @hiredate datetime = NULL AS --IF @memberid = NULL PRINT 'Mem is null' --IF @toyid = NULL PRINT 'toy is null' --IF @hiredate = NULL PRINT 'hiredate is null' IF(@memberid = NULL OR @toyid = NULL OR @hiredate = NULL) BEGIN RAISERROR('Please enter all required parameters: Member id, Toy id, Hiredate',16,1) RETURN END print 'debug 0' INSERT INTO Hire (Member_Id, Toy_Id, Hire_Date) VALUES (@memberid, @toyid, @hiredate) print 'debug 1' IF @@ERROR <> 0 BEGIN print 'error occured' END ELSE BEGIN print 'updating toy status: id: ' + CONVERT(varchar(16), @toyid) UPDATE Toys SET Status = 'Hired' WHERE Id = @toyid END print 'debug 2' - Only gets output of: debug 0 - Updates fine but nothing beyond the insert is executed!? So once the information has been inserted into Hire it does nothing else? It seems strange is there anyone who can help?
  19. If you want to alot about php in a short period of time, why not start with complete the membership system tutorial. I learnt alot during the tutorial.
  20. How do I refresh a page using php?
  21. Is there anyway of getting data from a mysql statement and storing it as a variable besides using sessions. I have found that some of my sessions are not registering. I only need the data for that particular page. For example $sql = mysql_query (select * from table where user = $username); $something = mysql_????; I hope this explains what I am trying to do. Cheers
  22. [!--quoteo(post=368761:date=Apr 25 2006, 08:30 PM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Apr 25 2006, 08:30 PM) [snapback]368761[/snapback][/div][div class=\'quotemain\'][!--quotec--] [code]echo date("l jS \of F Y h:i:s A", $timestamp);[/code]Check the date() page in the manual for more information on how to format it. [/quote] In my database it reads this 20060427062251 which is right but in website it is posting 19 01 38 which is d m y which in long form it goes to tuesday 19th of january 2038? Does anyone know what could be causing this?
  23. how do I turn a time stamp when posted looks like this 20060426152138 into something readable like 26th 04 2006 15:21pm or something that looks good.
  24. Thanks Barand. I am trying to create my own forum.
  25. [code] while ($i < $l){ $query = mysql_query("SELECT max( topicid ) as topicmax FROM topics"); $max_check = mysql_num_rows($query); if($max_check > 0){     while($row = mysql_fetch_array($query)){     foreach( $row AS $key => $val ){         $$key = stripslashes( $val ); } session_register('topicmax'); $_SESSION['topicmax'] = $max; } } $maxit = $max - $i; [/code] Ok what I am having trouble with is I want to take max (topicid) from the sql statement and pretty much make $max = max(topicid). Does anyone know how to do this?
×
×
  • 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.