Jump to content

me102

Members
  • Posts

    43
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

me102's Achievements

Member

Member (2/5)

0

Reputation

  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.
×
×
  • 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.