Jump to content

Very basic problem with php


Recommended Posts

I've just installed apache, mysql and php in windows. Ive got the apache server running and the mysql server running and i assume the php is working.

Ive set my intranet as a html/css based page and one of the links on that page is a link to

 

text.php - when this script contains something simple like

 

<?php

echo 'this is a test';

?>

then when i click on the link in my intranet and i get the result output onto the new webpage.

 

However if i add something more to it like

 



<?php

$dbhost = 'Brnew.home:3306';
$dbuser= 'root';
$dbpass= 'mypass';
$dbname = 'intranet';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die
	    ('Error Connecting to mysql');


mysql_select_db($dbname);

echo 'database opened';

mysql_select_db('intranet') or die('Cannot select database'); 

$query = 'CREATE TABLE contacts( '.
         'cid INT NOT NULL AUTO_INCREMENT, '.
         'cname VARCHAR(20) NOT NULL, '.
         'cemail VARCHAR(50) NOT NULL, '.
         'cnumber VARCHAR(30) NOT NULL, '.
         'cinfo TEXT NOT NULL, '.
         'PRIMARY KEY(cid))';

$result = mysql_query($query);


mysql_close($conn);



?>

 

 

Then when i click the link in my intranet it dosent display the page, i get an error saying this page cannot be displayed

Link to comment
Share on other sites

There is most likely an error with that php code. If you are using internet explorer go to

tools >> internet options >> click on the advanced tab >> under the browsing tab uncheck the box "show friendly http error messages"

and then look at the page...it will show you the php error and not "page cannot be displayed"

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.