![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
First of all, I suggest you change your root password: having it blank is a huge security risk.
What operating system are you on? |
|
|
|
|
|
#12 |
|
Programmer
Join Date: Apr 2006
Posts: 35
Rep Power: 0
![]() |
mac 10.4 and i know that its a risk but im not going to be creating anythign for the web yet im only just familiar with the basics(as you probably noticed). i know how to change it i think but i cant see too much of a point at the moment. at the moment im a bit confused why i am getting that error message. a friend said about the use of spaces in field names so ive changed that and ive also tried using strings rather than variables just to test but i constantly get the same error as above.
__________________
this forum rules you guys are great! thanks to all who help piercy |
|
|
|
|
|
#13 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Thought as much, but I wasn't sure. You need to find out what user your web server is using, and make sure it has the privileges to read the file specified:
/var/mysql/mysql.sock |
|
|
|
|
|
#14 |
|
Programmer
Join Date: Apr 2006
Posts: 35
Rep Power: 0
![]() |
how do i do that? and i tried to naviagate to the mysql folder but it said it didnt exist.
__________________
this forum rules you guys are great! thanks to all who help piercy |
|
|
|
|
|
#15 |
|
Newbie
Join Date: Apr 2006
Location: London, EU
Posts: 3
Rep Power: 0
![]() |
I'm clueless about PHP, but there isn't a reference to a database in there to start off with, only a table, try:
INSERT INTO databasename.messages ... If you have some data in the table already try: SELECT * from databasename.messages; Where "databasename" is the real name of the database that you have listed in Navicat. To get to /var/mysql/ just type cmd-shift-g in the Finder, you'll get a dialogue box, then type in "/var/mysql/" (to access this via a menu, in the Finder pull down the "Go" menu and select "Go to Folder"). To see the permissions on "mysql.sock" select it in the Finder and type cmd-i, the user privileges are shown at the bottom. |
|
|
|
|
|
#16 |
|
Programmer
Join Date: Apr 2006
Posts: 35
Rep Power: 0
![]() |
yes i did the go to folder thing earlier and it says it does not exist. i added the database anme in there and still same error as above. whats going on with this folder?
__________________
this forum rules you guys are great! thanks to all who help piercy |
|
|
|
|
|
#17 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Hmmz... perform a search for mysql.sock using the administrator account - let's find out where this bugger is.
|
|
|
|
|
|
#18 |
|
Programmer
Join Date: Apr 2006
Posts: 35
Rep Power: 0
![]() |
i have done that. ive got remote assistance for now and they are going to search tomorrow. so hopefully it will be sorted by tomorrow if not i will probably post about 6 tomorrow (GMT).
thanks for your help
__________________
this forum rules you guys are great! thanks to all who help piercy |
|
|
|
|
|
#19 |
|
Newbie
Join Date: Apr 2006
Location: London, EU
Posts: 3
Rep Power: 0
![]() |
Fixed
Ok, I think I fixed this, there's still one minor problem with your code, but I'll get to that at the end.
The mysql.sock is actually at: /tmp/mysql.sock Which explains why PHP couldn't connect to it. The fix is to edit the php.ini file which is at: /etc/php.ini Well, except that by default there is no php.ini, so you have to take the /etc/php.ini.default, duplicate and rename it to php.ini. Then go to the line: mysql.default_socket = and change it to: mysql.default_socket = /tmp/mysql.sock Then restart Apache (turn off personal web sharing in the system preferences/sharing, then turn it back on again). All this is done now. Not sure why your system was messed up like this, because it was working ok, must have been some change between MacOS X versions. Another way to achieve the changing of the socket connection location is in your PHP code. Take this line: $link = mysql_connect("localhost","guest","password");And change it to: $link = mysql_connect("localhost:/tmp/mysql.sock","guest","password");It's better to change the php.ini file though, because with the above method you'd have to specify the socket in every connection in your code/solution. Right, the final problem is that your date input is ending up as "0000-00-00 00:00:00" when you look at it in MySQL via Navicat. There are two reasons for this, one is that your default value in MySQL is "0000-00-00 00:00:00" and the second is that the variable you are trying to input is not in MySQL date format. MySQL date format is '2006-04-24 14:53:10" ie: (four digit year)-(two digit month)-(two digit day) (24 hour two digit):(two digit minute):(two digit second) In reality it's actually ok to input: 2006-4-1 14:5:2 rather than 2006-04-01 14:05:02. But you can see that it still follows approximately the same format. Your date looks like this: $date = date('l dS F Y at h:i:s A');Which I think means that it looks like this: "Monday 24th April 2006 at 3:07:03 PM" Which is great for you to be able to read, but is invalid for the MySQL field type you are trying to put it into. So, you can either: change the field type, or change the formatting. Tip: if you change the field type you won't be able to sort on that column in any way that makes any sense, and you won't be able to search for date ranges - which makes that type of input not a lot of use for a database. |
|
|
|
|
|
#20 |
|
Newbie
Join Date: Apr 2006
Location: London, EU
Posts: 3
Rep Power: 0
![]() |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|