Welcome! Log In Create A New Profile

Advanced

TASK 6A-1

Posted by restive 
Announcements Last Post
Announcement : Programming Students at UNISA School of Computing 06/19/2019 02:01PM
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
TASK 6A-1
August 14, 2008 02:32PM
my script:

<?php

error_reporting(E_ALL);

$title = "Database Connection";
include ("header.php"winking smiley;
//This code creates a connection to the MySQL server
$link_id = mysql_connect();
if($link_id)
echo"Connected to the MySQL server successfully<br>";
else
die ("Connection to the MySQL server was unsuccessful"winking smiley;

include ("footer.php"winking smiley;
?>


the result:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Program Files\xampp\htdocs\StudentPHP\connect.php on line 8
Connection to the MySQL server was unsuccessful.

i am able to connect to other databases in MySQL (i'm working on a blog excercise from another PHP manual in which i've had to create a database).
avatar
Mac
Re: TASK 6A-1
August 15, 2008 06:57AM
$link_id = mysql_connect();
must be something like $link_id = mysql_connect("localhost", "login", "password"winking smiley;
You go to the mysql database and in the user table add a user and a password for that user.
Host=localhost
User=tom
Password=harry
Give that user rights to do everything (for now).

Go to the db table in the mysql database. Insert a new entry
Host= localhost
db = the database you wish to connect to
User= the user (e.g. tom) you wish to give access to this database
Give rights what the user can do on this db.
Click om the home button (top left of phpmyadmin to go to the front page of phpmyadmin)
Click reload privileges
The use $link_id = mysql_connect("localhost", "tom", "harry"winking smiley;


sometimes you can get away with $link_id = mysql_connect(); for various other reasons, but generally you should create a user for a database and use it in your connection script.
Anonymous User
Re: TASK 6A-1
August 31, 2008 04:26PM
The database bookstore_db is not shown.

****************
This is the browser display:
Connected to the MySQL server successfully
The following databases are available
mysql

test

The following tables are in bookstore_db

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\xampp\xampp\htdocs\exercises\connect.php on line 26


************************
In Windows Explorer I found the database in UTV76-089dd_rev1.0 and copied it to C:\xampp\xampp\mysql.

Can you tell me which is the right place for bookstore_db resp. where do I find the databases and how do I access them?

Chapter 6 in the textbook is not clear to me.

Thanks & Regards,
Iris

Thanks
avatar
Mac
Re: TASK 6A-1
September 01, 2008 06:55AM
Copy the bookstore_db folder to c:\xampp\mysql\data

You can also access the databases directly when you go the http://localhost, which should bring up the XAMPP homepage, and then click on phpmyadmin.

Download the followinfg pdf file http://dalibor.dvorski.net/downloads/docs/InstallingConfiguringDevelopingWithXAMPP.pdf

and read/do from page 5.
Anonymous User
Re: TASK 6A-1
September 01, 2008 02:40PM
Hi Mac,
spinning smiley sticking its tongue out great spinning smiley sticking its tongue out

I copied the bookstore_db folder to c:\xampp\mysql\data, the browser is now displaying connect.php like this:
*************************************************
Connected to the MySQL server successfully
The following databases are available
information_schema

bookstore_db

cdcol

mysql

phpmyadmin

test

webauth

The following tables are in bookstore_db
subject

titles
***************************************************************
Not to forget, I had to change one line in connect.php:
$link_id = mysql_connect("localhost", "root", ""winking smiley;

phpmyadmin (from XAMPP homepage) gives me more understanding now and the pdf file is really helpful!

Thanks a lot and a successful week.
Iris
Re: TASK 6A-1
September 16, 2008 11:47PM
I have succeeded to complete task 6A-1 successfully after struggling a bit. Fortunately the phorum helped a lot. This part is quite exciting.

Johan Botha
Re: TASK 6A-1
September 21, 2008 09:51PM
Now the fun starts....

Completed TASK6A-1

Regards

Justin Leaf-Wright

www.leafydesignz.co.za

forum.leafydesignz.co.za

hot smiley
Re: TASK 6A-1
September 26, 2008 01:44AM
Iris.Phillip you're a darling ,it seems you are carrying me thru this course.

Any way I'm done ,one hiccup which is fixed now , I used -->


$link_id = mysql_connect("localhost","e_novative","e_novative"winking smiley;

instead of --->

$link_id = mysql_connect();

Oh and Iris helped me install my bookstore_db.

Mac I'm getting a hang of this PHP thing ---> but I suspect I will need much more help with the prac...anyway we'll see..and I was wondeing if you give extensions
should the need arise...I started this thing from scatch and I'm doing the VB.Net course as well and I want to pass both.
avatar
Mac
Re: TASK 6A-1
September 28, 2008 06:50PM
>and I was wondering if you give extensions

It all depends on Unisa deadlines. I don't want to kill your love for PHP smiling smiley but hey, burn the candle..... PHP stands for Pressure Hey Pressure!
Re: TASK 6A-1
September 29, 2008 01:16PM
"PHP stands for Pressure Hey Pressure!"

Agreed on that one

Justin Leaf-Wright

www.leafydesignz.co.za


forum.leafydesignz.co.za

hot smiley
Re: TASK 6A-1
October 01, 2008 08:24PM
Done.

Completed Successfully with no problems what so ever! smiling smiley
Anonymous User
Re: TASK 6A-1
October 02, 2008 07:56AM
Finished and Dusted, no problems once my DB rights and passwords etc have been setup, this is probably the most interesting thing so far......
Re: TASK 6A-1
October 06, 2008 07:19PM
Completed Successfully,no problems.
Anonymous User
Re: TASK 6A-1
October 08, 2008 02:55PM
Done no problem.

Mamog
Re: TASK 6A-1
October 09, 2008 06:45PM
done

tristan
Re: TASK 6A-1
October 12, 2008 08:12PM
6A-1 is done!

first had to move bookstore_db to the correct folder (i'm using MAMP). then i found the Zend tutorial (http://devzone.zend.com/node/view/id/627) Part 8,very helpful for completing this task.
Sorry, only registered users may post in this forum.

Click here to login