Results 1 to 2 of 2

Thread: Trying to connect to MySQL at my ISP (

  1. #1
    Join Date
    Dec 2008
    Thanked 0 Times in 0 Posts

    Default Trying to connect to MySQL at my ISP (

    Hi folks

    This code does not produce an error, trouble is it does not produce anything at all. All it is supposed to do is to connect to a database on my ISP's server via PHPAdmin and return the 7 or 8 records I put in trhe vacancies table yesterday. - Any ideas............................anyone please

    I have tried it on localhost too with exactly the same result, so at least whatever it is doing is at least consistent, trouble is what is it doing, when all the text books say it should be connecting and returning records.

    I am beginning to think there is either something wrong with the MySQL installation at my/my ISP's server.

    TIA John

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
    <html xmlns="">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <meta name="description" content="Recruitment"/>
    <meta name="keywords" content="Recruitment">
    <meta name="author" content="John W."/> 
    <title>Warwickshire Mobile Computer Repair Service</title>
    	<?php # - mysql_connect.php
    	define ('DB_USER','USERNAME');
    	define ('DB_PASSWORD','PASSWORD');
    	define ('DB_HOST','HOST');
    	define ('DB_NAME','DB');
    	$dbc = @mysql_connect (DB_HOST,DB_USER,DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error());
    	mysql_select_db (DB_NAME) OR die ('Could not select the database' . mysql_error());
    	$query="SELECT * FROM vacancies";
    	$result = mysql_query ($query);
    	while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
        	echo "Name :{$row['Ref']} <br>";
    Last edited by thetestingsite; 12-03-2008 at 04:48 PM. Reason: removed user info from code

  2. #2
    Join Date
    Nov 2008
    Thanked 1 Time in 1 Post

    Red face

    The @ symbol is for suppressing output. You know so if there's an error and mysql barfs up a bunch of sensitive info you don't want others to see while in production. However, right now when you are developing you don't want to use those @ symbols. So, remove it and then you should see the error being thrown.

    Also, posting your password is usually a bad idea


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts