Jump to content

cheadirl

Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cheadirl's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey, Thanks for this - worked a treat I've twaeked it a bit to grab results from a DB and do it with them all much appreciated Chead IRL
  2. Sorry dont get what you mean - I've looked all over for the answer to this - I've got a script that will extract text but not multiple times ! I need it to do that . If a regular expression will do any chance you could help me out with it ?
  3. Hi , I've been trying to figure this one out and I'm stumped ! I have a .csv file that contains a lot of data and is auto uploaded to a DB,  problem is there is no formatting on the fields. So I have a field of this : aghahafgfhfhafgafhkafhfha </TEXT I WANT/> lsgfslgjfasghsjkldfhgsklgh </MORE TEXT I WANT/> I dont think str_replace() will work for what I want to do - Im trying to only display the text inside the </ /> out onto my site, essentially removing the unwanted stuff.  I do need to keep the unwanted in the DB just not displaying it on the page ? Does anyone have any idea how I might get this to work ? Thanks CheadIRL
  4. Thanks for this - Ive seen that post it contains the same DB info that I was looking to generate but no php code to actually display the results on a page :(
  5. Hi , Ive tried all these methods and Im not gettin any results unfortuantly - I either get Resource id #4 or only a single number printed - I need to be able to print the name and the ammount of times it appears, using the sql statment in SQL server I get Name | Count John      10 Anne       4 etc no joy as of yet have tried all the usual echo statements but I just cant figure this one out :( Any more help would be great thanks
  6. Hi , Ive got 2 tables in my db member and account - I want to be able to run a count to get me the ammount of times a member name matches in both tables, the SQL statement below is doing just that for me the problem I have is I have no idea how to echo that out on a website using php - can anyone help me ? [code]SELECT COUNT( member.Name ) AS counter, account.Name FROM member INNER JOIN account act ON act.Name = member.Name GROUP BY member.Name [/code]
  7. Hi , I've been trying to get this sorted for ages and have searched loads of forums and so on ... no joy ! Basically I have a DB setup with a timestamp filed and date filed timestamp = time(); date = date('d-m-Y' , time()); This is working fine and inputting the timestamp and also the date into my DB, I have a seach function on the date where the user selects a date from a calendar ie 05-05-2006 and that search the date colum, then I have the ability to seach back 7 days using the time() - 60*60 etc .... My problem is searching between dates !!! When the user inputs 01-04-2006 to 01-05-2006 and using the sql command WHERE date >= $date1 AND date <= $date2 it doesnt work, and I have no idea how to make it work - i've tried converting the 01-04-2006 to a timestamp but no luck either and it tries to find the exact match even using LIKE its not getting it. Can anyone help me with this - I hope what I'm saying makes sence lol Thanks Wayne
  8. Hi, Thanks for the reply didnt mean to seem like I wanted someone else to write the script I have been trying for ages :) Unfortuatly the server I use doesn allow FTP access and the fopen etc give access denied this is the code I currently have and its giving the file as an SYLK and failing to open. Any ideas ? <?php include 'login.php'; // DB Connection here $date = date('d-m-y'); $table_name = "table"; $select = "SELECT * FROM table"; $export = mysql_query ( $select ) or die ( "Sql error : " . mysql_error( ) ); $fields = mysql_num_fields ( $export ); for ( $i = 0; $i < $fields; $i++ ) { $header .= mysql_field_name( $export , $i ) . "\t"; } while( $row = mysql_fetch_row( $export ) ) { $line = ''; foreach( $row as $value ) { if ( ( !isset( $value ) ) || ( $value == "" ) ) { $value = "\t"; } else { $value = str_replace( '"' , '""' , $value ); $value = '"' . $value . '"' . "\t"; } $line .= $value; } $data .= trim( $line ) . "\n"; } $data = str_replace( "\r" , "" , $data ); if ( $data == "" ) { $data = "\n(0) Records Found!\n"; } header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=$date $table_name.xls"); header("Pragma: no-cache"); header("Expires: 0"); print "$header\n$data"; ?>
  9. Hi, Im looking for a script that can export MySql data into a CSV / XLS keeping the field headers, I have tried some but keep getting errors (SYLK) can anyone provide me a script ? Any help would be great Thanks Wayne
×
×
  • 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.