Jump to content

me102

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by me102

  1. Ch0cu3r your the freaking best thanks so much... :happy-04: :happy-04:
  2. I think you may have miss understood me because of my poor english sorry. I am trying to use the script to replace define('script_path', 'files'); to define('script_path', 'NEWPATH');
  3. Hello I have the following code from php websites $myfile = fopen("/config.php", "a+") or die("Unable to open file!"); while(!feof($myfile)) { echo fgets($myfile) . "<br>"; $txt = "Mickey Mouse\n"; fwrite($myfile, $txt); } inside config.php is <?php define('script_path', 'files'); ?> How can I replace files with another value? any help would be great thanks.
  4. me102

    Better method

    thank you juddster just what I needed.
  5. me102

    Better method

    Hello I have a rating script what I need is a faster and better way of getting the title from the first query so i dont have to run 2 queries. $q1 = "select ItemID, sum(Rating) as mr from dd_rating group by ItemID order by mr desc limit 0,4"; $r1 = mysql_query($q1) or die(mysql_error()); while($a1 = mysql_fetch_array($r1)) { $q2 = "select ItemTitle from dd_items where ItemID = '$a1[0]' "; $r2 = mysql_query($q2) or die(mysql_error()); while($a2 = mysql_fetch_array($r2)){
  6. me102

    PHP FTP

    Hello I am having a little bit of a problem when I try to upload a directory and its subdirectorys i keep getting errors because the done exist but how would I go about making them, This is what I have, <?php //Source Files, Where to put them $src_dir = "/source_codes/"; $dst_dir = "/haha/"; // Start the ftp connection $conn_id = ftp_connect($ftp_server) or die("<span style='color:#FF0000'><h2>Couldn't connect to $ftp_server</h2></span>"); $login_result = ftp_login($conn_id, $user, $passwd); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $ftp_user_name"; die; } else { echo "<br>Connected to $ftp_server, for user $user<br>"; } function ftp_copy($src_dir, $dst_dir) { global $conn_id; $d = dir($src_dir); while($file = $d->read()) { if ($file != "." && $file != "..") { if (is_dir($src_dir."/".$file)) { if (!@ftp_chdir($conn_id, $dst_dir."/".$file)) { ftp_mkdir($conn_id, $dst_dir."/".$file); } ftp_copy($src_dir."/".$file, $dst_dir."/".$file); }else { $upload = ftp_put($conn_id, $dst_dir."/".$file, $src_dir."/".$file, FTP_BINARY); // check upload status if (!$upload) { echo "FTP upload has failed!"; } else { echo "Uploaded $source_file to $ftp_server as $destination_file"; } } } } $d->close(); } ftp_copy($src_dir, $dst_dir); // close the FTP stream ftp_close($conn_id); ?>
  7. me102

    2 Databases

    Basicly theres input box where people put there database details then on the next page it check the database details and if everythings ok it adds the details to the database. My problem is the 2 database connections are not working together and I was wondering what I could do? include(config.php) $testconnect = @mysql_connect($mysql_host,$mysql_username,$mysql_password); if(!$testconnect ){ echo "error can not connect to database"; }else{ $add = mysql_query(" INSERT INTO DATABASE () VALUES () } config.php $database_a = mysql_connect($host,$username,$password); $database_1 = mysql_select_db($database, $database_a); Any ideas?
  8. Hello I have a script thats checks to see if I am able to connect to the database or not. If I am unable to it should display an image called refused and if I am able to connect it should display the accept image. Everything works fine in my script but I cant seem to get ride of my mysql warning saying its unable to connect to the database. Heres my code $connect = mysql_connect($showcart['mysql_host'],$showcart['mysql_username'],$showcart['mysql_password']); if(!$connect){ $tconnect = "<img src=\"images/refuse.png\">"; }else{ $tconnect = "<img src=\"images/accept.png\">"; } I just need the warnings to go away if the script cant connect to the database. Any ideas?
  9. me102

    Adding

    Syntax is wrong. Remove "," from before the "FROM" Thank you.
  10. me102

    Adding

    What do you mean?
  11. me102

    Adding

    Can someone tell me whats wrong with this? <?php $total = mysql_query("SELECT SUM(amount) as amount, FROM `transaction` WHERE `user_id` = '$user_id'") or die(mysql_error()); while($row = mysql_fetch_array($total)){ extract($row); echo $amount; } ?>
  12. me102

    Adding

    There is another way ::: but ill keep it to myself..... anyways I did try it and didnt work which is why I asked in the first place.
  13. me102

    Adding

    The problem is the numbers have + and - before the numbers will this still work?
  14. me102

    Adding

    Hello I have a database which is filled with numbers which have + or - in it. looks like this, +10.00 -100.00 +45.00 Now I have been working with php for a long time and dont have a clue how I would get the total.
  15. Can someone tell me how to remove everything but "." and numbers.
  16. Can someone please tell me how to remove /www/path/dsdf/index.php everything but index.php?
  17. I set the cookies this way setcookie("TestCookie", $value, time()+3600, "", "example.com", 1); and it did not work. Yes I changed the example.com
  18. I have a signup form located at http://domain.com/signup/index.php now when I go to http://domain.com/ the cookie no longer works can you tell me how to make it work?
  19. Anything else I should do? Only the last 3 lines break.
  20. When I submit data to mysql from a textarea it does not add the line breaks and what not. textarea Blah blah Some details down here. Mysql input looks like Blah blah Some details down here. Mysql input should look like, Blah blah Some details down here.
  21. My Problem, $empl is set alot of times not always the same amount or same value, The Input $empl = "Message 123 <br>"; $empl = "Message 1234 <br>"; $empl = "Message 12345 <br>"; $empl = "Message 123456 <br>"; I need to display every $empl. Output should be, Message 123 Message 1234 Message 12345 Message 123456 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.