Jump to content

isimpledesign

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

isimpledesign's Achievements

Member

Member (2/5)

0

Reputation

  1. thanks kenrbsn your code helped loads i ended up using this. // querys the database $new = mysql_query("SELECT {$ROWS} FROM {$DB_TABLE}"); // while loop to loop through selected fields while ($row = mysql_fetch_assoc($new)) { $tmp = array(); $tmp[] = implode($DELIMITER, $row); echo $tmp[0] . "<br />"; } legend
  2. hi i have got the following issues i am using the following code. <?php //DB CONNECTION $ROWS = "id,firstname,lastname"; // explode at the comma and insert into an array $test = explode("," , $ROWS); //adds array test to the var sam $sam = array($test); // querys the database $new = mysql_query("SELECT * FROM {$DB_TABLE}"); // while loop to loop through selected fields while ($row = mysql_fetch_array($new)) { foreach ($sam[0] as $v) { echo $row[$v] . $DELIMITER . "<br />"; } echo "<br />"; } ?> This will output the following . 834(|)Step(|)Thompson(|) 835(|)Lucy(|)kim(|) 836(|)Iwan(|)Will(|) 837(|)Sarah (|)Good(|) what i am struggling with is i want to get rid off the last delimiter so it would be 834(|)Step(|)Thompson 835(|)Lucy(|)kim 836(|)Iwan(|)Will 837(|)Sarah (|)Good i have tried using // while loop to loop through selected fields while ($row = mysql_fetch_array($new)) { foreach ($sam[0] as $v) { $test = $row[$v] . $DELIMITER; echo substr($test, 0, -1); } echo "<br />"; } but this gets rid off the delimiter for all off them??? This will output the following . 834Stephompson 835Lucykim 836IwanWill 837SarahGood ideally i would like each row to be its own stored together. Any Help Please
  3. hi i have got the following issues i am using the following code. <?php //DB CONNECTION $ROWS = "id,firstname,lastname"; // explode at the comma and insert into an array $test = explode("," , $ROWS); //adds array test to the var sam $sam = array($test); // querys the database $new = mysql_query("SELECT * FROM {$DB_TABLE}"); // while loop to loop through selected fields while ($row = mysql_fetch_array($new)) { foreach ($sam[0] as $v) { echo $row[$v] . $DELIMITER . "<br />"; } } ?> i get the following results. 834(|) Steph(|) Thompson(|) 835(|) Lucy(|) kim(|) 836(|) Iwan(|) Will(|) 837(|) Sarah (|) Good(|) The problem i have is the br tag where do i put it because i need it to output like this. like it shows in the $ROWS variable above "$ROWS = "id,firstname,lastname";"; 834(|)Step(|)Thompson(|) 835(|)Lucy(|)kim(|) 836(|)Iwan(|)Will(|) 837(|)Sarah (|)Good(|) Where do i add the br tag??? Any Help PLease
  4. really need help any ideas on how i can change this while ($row = mysql_fetch_array($new)) { echo $row['username'] . $DELIMITER . $row['firstname'] . $DELIMITER . $row['lastname']; echo "<br />"; } to something like this $sam = array('username','firstname','lastname'); while ($row = mysql_fetch_array($new)) { echo $row[$sam] . $DELIMITER; echo "<br />"; }
  5. Hi I am looking to be able to pass an array to mysql_fetch_row() not sure where i am going wrong. works fine like this. mysql_select_db($DB_NAME); $new = mysql_query("SELECT * FROM {$DB_TABLE}"); if (!$new) { echo 'MySQL Error: ' . mysql_error(); exit; } $row = mysql_fetch_array($new); while ($row = mysql_fetch_array($new)) { echo $row['username'] . $DELIMITER . $row['firstname'] . $DELIMITER . $row['lastname'] . $DELIMITER . $row['password'] . $DELIMITER. "example@gmail.com" . $DELIMITER . "author"; echo "<br />"; } But really need too be able to do it this way. mysql_select_db($DB_NAME); $new = mysql_query("SELECT * FROM {$DB_TABLE}"); if (!$new) { echo 'MySQL Error: ' . mysql_error(); exit; } $row = mysql_fetch_array($new); echo "<pre>"; //print_r($row); echo "</pre>"; $sam = array('username','firstname','lastname'); while ($row = mysql_fetch_row($new)) { echo $row[$sam] . $DELIMITER; echo "<br />"; } So it will just loop through the array so i can keep adding to it by just adding an extra parameter to the array. Any Help Stuck????
  6. is their a way to automatically generate a screen grab of a specific area on a web page. What i am looking to do is grab a screenshot off a flash apllication and then send that screenshot in pdf formatt when a button is clicked Is this possible?? Thanks
  7. 0 down vote favorite I know this is a rookie question but whats actually happening with a progress bar what is it actually monitoring. I figure the only way to understand it is to get this answer. when i run a piece off php code how can i get a progress bar to monitor it while it runs untill completion off the code?? most progressbars i have seen are file upload and download. is it monitoring the amount off requests the browser sends when upload the file so its monitoring the bytes that are being transfer? Can someone please give me a better understanding off whats going on? I just want a simple progress bar to monitor progress while my php code is running so say if i am running this simple code to backup a websites files and folders, how could i do this??? <?php if ( isset($_POST['backup']) ) { if(exec("cd {$_SERVER['DOCUMENT_ROOT']}/wp-content/plugins/s3bk/files;tar -cvpzf backup.tar ".get_option( 'isd-server')."")) { echo "done"; } } <form id="backup" method='post' action=''> <input type='submit' class="button" name='backup' value='backup'> sorry for the rookie question just really want to get my head around whats actually happening??? Thanks
  8. i can do something like this which shows the files but i get the error below <?php S3::setAuth(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY); $bucket = "bucket"; $path = ""; // Can be empty "" $lifetime = 3600; // Period for which the parameters are valid $maxFileSize = (1024 * 1024 * 50); // 50 MB $metaHeaders = array("uid" => 123); $requestHeaders = array( "Content-Type" => "application/octet-stream", "Content-Disposition" => 'attachment; filename=${filename}' ); $params = S3::getHttpUploadPostParams( $bucket, $path, S3::ACL_PUBLIC_READ, $lifetime, $maxFileSize, 201, // Or a URL to redirect to on success $metaHeaders, $requestHeaders, false // False since we're not using flash ); $uploadURL = "https://{$bucket}.s3.amazonaws.com/"; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>S3 Form Upload</title> </head> <body> <form method="post" action="<?php echo $uploadURL; ?>" enctype="multipart/form-data"> <?php foreach ($params as $p => $v) echo " <input type=\"hidden\" name=\"{$p}\" value=\"{$v}\" />\n"; ?> <input type="text" name="file" value="<?php echo $_SERVER['DOCUMENT_ROOT']."/wp-content/plugins/s3allfiles/files/test.txt"; ?>" /><input type="submit" value="Upload" /> </form> </body> </html> so ichange the type to text instead of file i get this error <PostResponse> − <Location> https://bucket.s3.amazonaws.com/%24%7Bfilename%7D </Location> <Bucket>bucket</Bucket> <Key>${filename}</Key> </PostResponse>
  9. Hi Kira Thanks for the reply i want to grab the file from the server so i was looking at doing something like the follow. so my file structure would be. index.php // which would have the upload code files/backup.zip //which would be the file i would like to automatically grab so i thinking of doing something like $_SERVER['DOCUMENT_ROOT']."/files/backup.zip to locate the file?
  10. That doesnt seem to work <input type="file" name="file" value="/Users/SamuelEast/Desktop/businesscard.psd" /><input type="submit" value="Upload" /> just gives me an error. <Error> <Code>InvalidArgument</Code> <Message>User key must have a length greater than 0.</Message> <ArgumentValue/> <ArgumentName>key</ArgumentName> </Error>
  11. I have just read this http://www.phpfreaks.com/forums/php-coding-help/set-file-path/ So i thinks its not possible. but i dont want it to download off someone comupter but from their server root. Basically do a backup zip it and the set the path for that to be uploaded so all the user has to do is click upload, because i will set the path to the file???
  12. Hi Everyone i am looking for a way to automatically upload a file but skip the browse and choose file process. So i set the location of the file somehow via the form and the client just has to click submit and it will automatcially upload the file from the path i have set. skipping the browse for file process. I would like to intergrate it into the following undesigns S3 Class http://undesigned.org.za/2007/10/22/amazon-s3-php-class/documentation <?php S3::setAuth(awsAccessKey, awsSecretKey); $bucket = "upload-bucket"; $path = "myfiles/"; // Can be empty "" $lifetime = 3600; // Period for which the parameters are valid $maxFileSize = (1024 * 1024 * 50); // 50 MB $metaHeaders = array("uid" => 123); $requestHeaders = array( "Content-Type" => "application/octet-stream", "Content-Disposition" => 'attachment; filename=${filename}' ); $params = S3::getHttpUploadPostParams( $bucket, $path, S3::ACL_PUBLIC_READ, $lifetime, $maxFileSize, 201, // Or a URL to redirect to on success $metaHeaders, $requestHeaders, false // False since we're not using flash ); $uploadURL = "https://{$bucket}.s3.amazonaws.com/"; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>S3 Form Upload</title> </head> <body> <form method="post" action="<?php echo $uploadURL; ?>" enctype="multipart/form-data"> <?php foreach ($params as $p => $v) echo " <input type=\"hidden\" name=\"{$p}\" value=\"{$v}\" />\n"; ?> <input type="file" name="file" />&#160;<input type="submit" value="Upload" /> </form> </body> </html> at what point does it grab the file path ? is it grabbing it out of the name here <input type="file" name="file" /> can i do something with $_FILES ??? Can someone please give me a point on where to start i would really appriciate this. thanks
  13. hi all i am looking for the quickest way to zip all files and folder of a website i am currently using the followning. <?php $date = date("F-j-Y-g-ia"); if(exec("cd /home/isd/public_html/bk/files;tar -cvpzf backup-$date.tar /home/isd/public_html")) { echo "done"; } ?> This works but was just wondering if anyone can give me and insight on a better solution?? Thanks
  14. Hi all i have stumbled across an issue and really need some help i have got a function below which i am using in a wordpress plugin. here is the code. // Base function function isd_s3player() { // Plugin Url $s3url = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)); echo '<object type="application/x-shockwave-flash" data="'.$s3url.'dewplayer-playlist.swf" width="235" height="200" id="dewplayer" name="dewplayer"> <param name="wmode" value="transparent" /> <param name="wmode" value="transparent" /> <param name="movie" value="'.$s3url.'dewplayer-playlist.swf" /> <param name="flashvars" value="showtime=true&autoreplay=true&xml='.$s3url.'playlist.php&autostart=1" /> </object>'; } ok the problem i am having is i cant passed the database variable to the playlist.php which the dewplayer needs to call within the function. is their a way to somehow use or set the playlist.php in this function without having to call it seperatly??? Here is my playlist.php <?php $bucket = get_option("isd-bucket"); $folder = get_option("isd-folder"); //include the S3 class if (!class_exists('S3'))require_once('s3/S3.php'); //AWS access info if (!defined('awsAccessKey')) define('awsAccessKey', 'amazon key'); if (!defined('awsSecretKey')) define('awsSecretKey', 'amazon secret key'); //instantiate the class $s3 = new S3(awsAccessKey, awsSecretKey); // Get the contents of our bucket $bucket_contents = $s3->getBucket($bucket,$folder); header("Content-type: text/xml"); $xml_output = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; $xml_output .= '<playlist version="1" xmlns="http://xspf.org/ns/0/">\n'; $xml_output .= "<trackList>\n"; foreach ($bucket_contents as $file){ $fname = $file['name']; $furl = "http://$amazon_bucket.s3.amazonaws.com/".urlencode($fname); if(preg_match("/\.mp3$/i", $furl)) { if (isset($outputted[$furl])) { continue; } $xml_output .= "\t<track>\n"; $xml_output .= "\t\t<location>" . $furl . "</location>\n"; $xml_output .= "\t\t<creator>" . $fname . "</creator>\n"; $xml_output .= "\t\t<album>" . $fname . "</album>\n"; $xml_output .= "\t\t<title>" . basename($fname) . "</title>\n"; $xml_output .= "\t\t<annotation>I love this song</annotation>\n"; $xml_output .= "\t\t<duration>32000</duration>\n"; $xml_output .= "\t\t<image>covers/smetana.jpg</image>\n"; $xml_output .= "\t\t<info></info>\n"; $xml_output .= "\t\t<link>" . $furl . "</link>\n"; $xml_output .= "\t</track>\n"; $outputted[$furl] = true; } } $xml_output .= "</trackList>"; echo $xml_output; ?> ok so as you can see right at the top i am trying to grab two option from the database but it doesnt allow you to do it this way within wordpress. So i guess what i am asking is their a way to completely skip the playlist.php file and do everything within the function??? Any help??
×
×
  • 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.