0

I have a csv file and I am not sure how to set dates on it... For example, if somebody submits a form and its information shows up in the csv but has a date that shows when it was submitted... Can someone help me with this?

3
Contributors
15
Replies
16
Views
4 Years
Discussion Span
Last Post by diafol
Featured Replies
  • **@<MICHAEL>** >For example, if somebody submits a form and its information shows up in the csv but has a date that shows when it was submitted... Can someone help me with this? You need to used this `STR_TO_DATE(str,format)` function to get the date: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_str-to-date Then you can Select yourDateColumn from … Read More

  • **@<MICHAEL>** >Is there a way to do this purely out of php because for some odd reason I can't connect to mysql with DreamWeaver? NO Here is a link to connect to DreamWeaver: http://helpx.adobe.com/dreamweaver/kb/connect-mysql-database-dreamweaver.html and another example: http://kb.mediatemple.net/questions/29/Dreamweaver+-+PHP%7B47%7DMySQL+Configuration#gs Read More

  • 1
    diafol 3,669   4 Years Ago

    Work through your problem with DW - or simply stop using it - there are plenty of great free-to-use editors/IDEs out there. Using php without a DB but still needing storage is v.difficult. You have to rely on CSVs, textfiles, XMLs etc. Highly inconvenient. Have you searched the php manual … Read More

  • 1
    diafol 3,669   4 Years Ago

    Do you have a cPanel setup? If so, there should be a way to connect to your DB remotely as you can provide your own IP addresses. Read More

3

@<MICHAEL>

For example, if somebody submits a form and its information shows up in the csv but has a date that shows when it was submitted... Can someone help me with this?

You need to used this STR_TO_DATE(str,format) function to get the date:

http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_str-to-date

Then you can

Select
    yourDateColumn
from
    yourTable
Votes + Comments
To Rectify what some retard did to LastMitch
0

Is there a way to do this purely out of php because for some odd reason I can't connect to mysql with DreamWeaver?

But thank you for your quick response :)

1

Work through your problem with DW - or simply stop using it - there are plenty of great free-to-use editors/IDEs out there.
Using php without a DB but still needing storage is v.difficult. You have to rely on CSVs, textfiles, XMLs etc. Highly inconvenient.

Have you searched the php manual on date formats? Or strtotime, etc? Start here: http://uk3.php.net/manual/en/function.date.php and read the pages in the left nav list.

0

I should've mentioned I also own coda 2, that also has the same problem... But i am still searching for ways of connecting to a DB... and I have read the article :D

0

I forgot to mention that when I called GoDaddy on why I couldn't connect to MySQL, they said it was my problem...

1

Do you have a cPanel setup? If so, there should be a way to connect to your DB remotely as you can provide your own IP addresses.

0

I'm sorry if I misunderstood this but do you mean a cPanel in GoDaddy or in DW?

0

cPanel is the owner's admin panel to change settings and to set up databases etc. I'm not familiar with godaddy so I don't know what they offer. If they don't offer a cPanel for your account, they should at least provide connection (host) details that allow you to remote access the DB.

Your hosted site should connect to the DB using 'localhost', BUT this cannot be the case if you're trying to connect to the same DB from a copy of the site on your local testing server. Perhaps I've got the wrong end of the stick here.

I'm assuming that your DB and site is hosted by GoDaddy and that you've got a local copy of the site which you're developing in Dreamweaver. Tell me if I'm wrong.

0

Well, I have to connect dreamweaver to godaddy mysql... i think I just word things really badly, but I set up a new DB on GoDaddy, and what should I do from there?

0

I don't know. Do you have remote access to the DB? Either way you need the db host address for the connection.

0

I believe I have remote access... honestly I'm not sure... When I attempted to connect I kept getting an unidentified error...

0

believe I have remote access... honestly I'm not sure

Well, until you find out, there's little I can suggest.

0

Can you tell me what goes on if I do have those capabilities... I can try to follow that procedure? (maybe I'll find out there?)

0

You should have a host address for the DB, e.g. 'diafol-mysql-12' - but it could be called anything.

I'm including a mysql_* example here, but you really should think of using mysqli_* or PDO:

$link = mysql_connect('diafol-mysql-12', 'diafol', '5c00by d00'); //change these parameters to yours (hostname, username, password)
if (!$link) {
    die('Not connected : ' . mysql_error());
}

// make foo the current db
$db_selected = mysql_select_db('mydatabase', $link); //change the mydatabase to your name
if (!$db_selected) {
    die ('Can\'t use foo : ' . mysql_error());
}

I just checked the godaddy site and it does not include cPanel for shared hosting - which I assume is what you have. However, it does if you use Virtual or Dedicated Servers. So, I'll stop banging on about cPanel! :)

Edited by diafol

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.