Fukushousha Posted April 5, 2008 Share Posted April 5, 2008 Hello all,having done SQL for 2 semesters in uni I thought it would be a piece of cake to use it in my site. Heh .... now I know better. I am using dreamweaver to design my site and I just installed a MySQL Server into my machine. I intend to finish the site in my machine having the SQL server in my machine and when I am finished upload it to a remote hosting server. Problem is that I do not know how to connect to the MySQL server. Dreamweaver really made it difficult for me, I read its help manual, read up on 3 different forums yet nothing came out of it. The MySQL server is working, I can communicate with it by console commands via cmd.exe. Now I don't know how to make my site communicate with it.I tried the way the tutorials on this great site say but it does not work. More specifically I tried this : <?php$con = mysql_connect("localhost","name","password");if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("myDB", $con);$result = mysql_query("SELECT * FROM users");while($row = mysql_fetch_array($result)) { echo $row['FirstName'] . " " . $row['LastName']; }mysql_close($con);?> This displays .... nothing .. not even an error :/ . Please , any help? I have been trying to figure it out for at least 3 hours now Link to comment Share on other sites More sharing options...
Synook Posted April 5, 2008 Share Posted April 5, 2008 Try putting echo mysql_error() under the mysql_query() and see whether there is anything.Of course, also check that there are rows in that table. Link to comment Share on other sites More sharing options...
Fukushousha Posted April 6, 2008 Author Share Posted April 6, 2008 I tried it but still nothing :)Can you explain how I am supposed to connect to a database that I am runnign as a Mysql service in my pc( hence the local host?) ... I think the problem lies there ... EDIT: I found out the problem and solved it. Thanks for the help anyway people Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.