something Posted October 22, 2006 Share Posted October 22, 2006 I'm new to php and i'm trying to install a news script to use on a page. It asks me to do this"Before we begin, we should set up a table in our mysql database. We will need to following fields:NameSubjectMessageDateID"I'm working on a remote server with mysql already set up with everything configured, how do I do this? Quote Link to comment Share on other sites More sharing options...
Orio Posted October 22, 2006 Share Posted October 22, 2006 mysql_connect(...);mysql_select_db(...);mysql_query("CREATE `TableName` ....");Maybe you should read some Mysql tutorials?Orio. Quote Link to comment Share on other sites More sharing options...
gmwebs Posted October 22, 2006 Share Posted October 22, 2006 Assuming your host has PHPMyAdmin installed, then you could creat the table and fields using it. Have a look at [url=http://www.phpmyadmin.net]www.phpmyadmin.net[/url] and look through the documentation. If you are following a tutorial, then they probably included a SQL query which will create this for you. You can paste that query into the SQL Query input dialog in PHPMyAdmin which should create the table and fields for you.Alternatively, you could always take a look at PHPFlashMyAdmin which is a flash based alternative. I have found it to be very useful on hosts that do not have/allow PHPMyAdmin. [url=http://www.tufat.com/script.php?id_num=7]http://www.tufat.com/script.php?id_num=7[/url] Quote Link to comment Share on other sites More sharing options...
something Posted October 22, 2006 Author Share Posted October 22, 2006 I found the program used on my server to setup fields, but what do I do with all these options? (type, length values, Collation, Attributes, Null, Default2, Extra, then the choice between Primary, Index, unique, ---, Fulltext, Comments. How do I know what to set them to? Is there a guide anyone could point me to?) Quote Link to comment Share on other sites More sharing options...
gmwebs Posted October 22, 2006 Share Posted October 22, 2006 There are many MySQL tutorials available on the internet, just Google for them. I have listed one below for you on the official MySQL site which has tonnes of info...[url=http://dev.mysql.com/doc/refman/5.0/en/creating-tables.html]http://dev.mysql.com/doc/refman/5.0/en/creating-tables.html[/url] Quote Link to comment Share on other sites More sharing options...
something Posted October 22, 2006 Author Share Posted October 22, 2006 I finally have my table setup [img]http://img258.imageshack.us/img258/3740/tablemv8.jpg[/img]It still gives me a error message, the tutorial gives very little help [url=http://www.phpfreaks.com/quickcode/News-System/523.php]http://www.phpfreaks.com/quickcode/News-System/523.php[/url] what did I miss? Quote Link to comment Share on other sites More sharing options...
gmwebs Posted October 22, 2006 Share Posted October 22, 2006 I am assuming you replaced the following[code]<?php$db_host = "localhost";$db_username = "your_db_username";$db_password = "your_db_password";$db_name = "your_db_name";?>[/code]with your actual values? If not, it will never work mate... Also, when you get error messages, it is always a good idea to post them with your questions so that it provides us with more information to go on. Quote Link to comment Share on other sites More sharing options...
something Posted October 22, 2006 Author Share Posted October 22, 2006 I just need to be sure about what I'm putting in$db_host = "localhost";$db_host = "http://something.com"$db_username = "your_db_username";Here do you make up a username or do you have to add it in the table first?$db_password = "your_db_password";Same as username.$db_name = "your_db_name";What do I enter here? Just who I want it to say posted it? Quote Link to comment Share on other sites More sharing options...
gmwebs Posted October 22, 2006 Share Posted October 22, 2006 You will have to find out from your host what the values for these are, my host actually provides these details when I create each database... I have commented next to each one.[code]<?php$db_host = "localhost"; // This is the IP address or fully qualifed domain name of the server on which MySQL is installed$db_username = "your_db_username"; // This is the username that has been granted rights to modify the database$db_password = "your_db_password"; // This is the password for the above username$db_name = "your_db_name"; // This is the name of the database. If you look in the left column of PHPMyAdmin, then you will see the database name above the tables.?>[/code] Quote Link to comment Share on other sites More sharing options...
something Posted October 22, 2006 Author Share Posted October 22, 2006 <?php$db_host = "localhost"; // This is the IP address or fully qualified domain name of the server on which MySQL is installed$db_host = "http://www.something.com"$db_username = "your_db_username"; // This is the username that has been granted rights to modify the database$db_username ="something"$db_password = "your_db_password"; // This is the password for the above username$db_password = "admin"$db_name = "your_db_name"; // This is the name of the database. If you look in the left column of PHPMyAdmin, then you will see the database name above the tables.$db_name = "some_only"?>That’s the approximation of what I changed it to (none of that is the real information) and it still gave me a error message. Is this setup correctly?P.S. Is it ok that my table entrees are set to NULL is that ok? Quote Link to comment Share on other sites More sharing options...
something Posted October 23, 2006 Author Share Posted October 23, 2006 I have the submit news working fine, but my new that I'm trying to put on my index keeps showing this...*edit* removed *edit*when I uploaded the client/ viewing side on a php instead of html it gave me this error:Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'http' (1) in /home/******/public_html/news.php on line 14Unknown MySQL server host 'http' (1)***** replaces a word Quote Link to comment Share on other sites More sharing options...
gmwebs Posted October 23, 2006 Share Posted October 23, 2006 Just remove the http:// from the $db_host parameter...[code]<?php$db_host = "www.something.com";?>[/code] Quote Link to comment Share on other sites More sharing options...
something Posted October 23, 2006 Author Share Posted October 23, 2006 Thank you :) I seem to have solved that, now though it is giveing me this errorWarning: mysql_connect() [function.mysql-connect]: Access denied for user '*******_******'@'**.***.**.**' (using password: YES) in /*****/index.php on line 14Access denied for user '********'@'**.***.**.**' (using password: YES)I have the right password in the password area, my username came with a prefix, but my password is as I set it. Is there a reason why it won't connect?P.S. I tried adding a local host ("% means allow connection from every Host (IP address)") is there any way to remove the local hosts I added, they didn't form a list below the local host button as I had expected. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.