Jump to content

matstuff

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

matstuff's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry, solved my own problem. - Copied httpd.conf from /etc/apache2/original to /etc/apache2 - Looked at http://php.net/manual/en/install.macosx.bundled.php - Inserted the lines: LoadModule php5_module libexec/httpd/libphp5.so AddModule mod_php5.c <IfModule mod_php5.c> # If php is turned on, we respect .php and .phps files. AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps # Since most users will want index.php to work we # also automatically enable index.php <IfModule mod_dir.c> DirectoryIndex index.html index.php </IfModule> </IfModule> - Didn't work. Discovered that libphp5.so was actually located in libexec/apache2/, so updated that reference - Checked the Console, it said that there's no such command as 'AddModule'. Removed this line and changed the 'IfModule' line to 'IfModule php5_module'. I was improvising BIG TIME on that last bit, it appears to have done what it sets out to do (i.e. it loads index.php by default) I'm cautiously optimistic! Mat
  2. Hi there, I've been struggling to get PHP to work on OS X 10.6 for a few days now, and it's beginning to grate! I initially had the web server turned on fine and then went to install the latest PHP release via Marc Liyanage installation package. Weirdly that corrupted the web server (going to 'localhost' didn't work, and nor did 'localhost/~username/' -- both just timed out). After much faffing I removed the pkg install, and seemingly restored everything back to what it was. I then went for the more straightforward option of just uncommenting the line in httpd.conf which disables PHP by default. I also copied the php.ini.default file to php.ini. Now a bit of progress, I could run a simple test.php consisting of just phpinfo(). However, when I tried to connect to my MySQL database (again, on localhost and apparently running fine -- MySQL workbench is happy as) and had a 'die' statement in the line it threw a 'No such file or directory error'. More strangely, if I deliberately introduced a syntax error (e.g. removed a semi-colon) it didn't produce any errors, just displayed a blank screen. I downloaded php.ini-development and replaced php.ini with it; still no error reporting. To compound matters, after a few refreshes with deliberately broken code, PHP pages stop-loading and Chrome just throws a timeout error (actually 'Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.'). Even when I revert the test.php contents back to an innocuous 'hello world' it still fails to load. I can guarantee that if I come back tomorrow morning though, it will run a 'hello world' program, but still misbehave with MySQL and error reporting. I've attached my httpd.conf file (from /etc/apache2) and my php.ini (which should be identical to php.ini-development as I just downloaded it from cvs.php.net). In httpd.conf there is only one line that contains the string 'php', namely line 115 -- should there be any more php-related directives in there? I would be so grateful for any suggestions. I've never had this much difficulty getting PHP up and running in the past! Thank you so much, Mat [attachment deleted by admin]
  3. For a start, it looks like you're trying to take advantage of PHP's magic quotes, but that only works if you're using double quotes, not single quotes. e.g. $a = "Hello"; echo "$a and goodbye"; output: Hello and goodbye However, IMO, it's better practise to strucutre MySQL queries using sprintf, as you can see more clearly where your variables etc. are. your code would become: $sql = sprintf('SELECT * FROM orders WHERE transaction <> "COMPLETE" and cust_num = (Select cust_num from customer where cust_username = "%s")', $_SESSION['MM_Username']);
  4. Like I said, I'm not after an administrative interface. I want something that will allow me to design a custom input form. PHPMyAdmin is good for setting up and administering the structure etc. of a database, but you can't give it to users to do things with.
  5. Can you use the MySQL prompt directly? SELECT * FROM madcat_players where name=' D'Wayne Matthews' and pos='LT' That should not work! The number of single quotes is not matched. SQLyog must be doing something to that statement. I just tried running the command: SELECT psnId, psnName FROM people WHERE psnName = 'M'at' and MySQL was having none of it... I agree with jaymc - ' D\'Wayne Matthews' should work...
  6. if (!isset($_GET['m'])) { do stuff... }
  7. Bugger. Cheers guys. I suspected as much No, it's not a project. It a database we need in our group. I was using Access, but for no reason that started crashing. I could obviously just use an online server - my ISP supports mysql and PHP, but the nature of the data means that it's sensitive enough not to be online. The crux of it is just being able to implement a GUI for the database (but not an Admin GUI) Not to worry, thanks for your help. Mat
  8. Hi, When you say it works in SQLyog, does it return a row, or does it just run with zero results? If you echo the SQL, copy and paste that to SQLyok and then run that, does it still work?! Your SQL isn't very efficient. You could achieve the same thing in one SELECT... SELECT madcat_yearly_player_info.*, madcat_players.name AS playerName FROM madcat_players INNER JOIN madcat_yearly_player_info USING(id) WHERE playerName='splodge'; Or something like that anyway...! Anyway, you can't strip the slashes!! As your example just showed, SELECT ... WHERE name='D'Wayne Matthews' That's just not going to work! The string is terminated after the 'D' by the second single quote. You could try enclosing it in double quotes... $sql_query = sprintf("SELECT * FROM madcat_players WHERE name = \"%s\" AND pos = \"%s\"", $player, $position)
  9. Hi, I'd like to install PHP to run on my local machine, such that if I open a file in Firefox etc., it runs the script and outputs the HTML correctly. *However*, is there any way of doing this without having to install a webserver? I'm using a machine in a University network with [understandably] somewhat restrictive policies - i.e. I can't run a webserver! However, I need to write an interface for MySQL, and VB Express is shite! Any suggestions would be much appreciated. Cheers, Mat
  10. Hi, Am new to MySQL and relatively new to PHP. Am trying to marry the two together, but have met with confusion at the first hurdle. My server (www.aspfreeserver.com) provides me with two folders - \'www\' and \'db\'. I create my PHP offline, on my home machine and then ftp it to the server. Similarly, my MySQL db is on my local disk, but not online. I\'ve not set up my home pc as a server, hence the need to upload. However, from what I can tell, MySQL doesn\'t create a discrete file (like Access, or something) for the database, rather a folder for it. Do I just upload this folder to my server, and if so do I upload it into the \'db\' folder or the \'www\' folder. Once uploaded, how do I then connect to the database in PHP, since there is basically no file on the server for it to recognise. I\'m pretty sure that the server supports MySQL, since if I run phpinfo() there is a MySQL section that reports all its settings. I\'m may be missing some obvious point here, and probably am, but if anyone can point me in the right direction I\'d be really grateful! Thx in advance, Mat ---[/code]
×
×
  • 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.