Tr00jg

Last Login:
November 13, 2011
Warn:

Rank:
Member
Member Points:
50



User Profile
Follow

Hits: 18,390
Joined June 17, 2006
Games (2)

Roach Toaster
June 22, 2006
Emola Mine WIP
November 09, 2006
Examples (1)
Favorite Users
Dev - Sort these by name
Favorite Games


PHP problems. Help?
Posted on December 06, 2006 at 15:16

Hey guys! I am having PHP/MySQL problems. I know there are a lot of you here who develop sites using the above, so dont you hide away!

I have a lil problemo...

Ill line out the problem for you. I run a local server on my PC. Everything works perfectly fine. If I use a simple script like this:

<?php
echo "Yo, welcome to Shotbeak Games";
?>

It works fine. Now I come to the point where I want to include MySQL. Ive run the MySQL Command Line Client to create a database called "shotbeak" and added a table "News" + a field "news".

Now I want to connect to MySQL of course with this:

<?php

$mysqli = mysqli_connect("localhost","root","password","shotbeak");

if(mysqli_connect_errno())
{
echo "It failed.";
}
else
{
echo "It worked";
}

echo "It wont even parse this";

?>

But you see, it doesnt go pass the $mysqli connection. Why? I know this might be a bit vague, but I have no idea why this happens... Everything works fine, but it doesnt want to connect properly...


Dev - Warning
Dev - After editing rating, make rating display change
Dev - When editing, update "edited" column
Dev - Restore deleted comments
Dev - Display deleted comments if mod (hidden, then with dropdown)
Dev - After deletion or during edit, make rating dropdown appear again
Dev - Stricter rating rules. Prevent user from rating again
Dev - Pages
Dev - Reporting
What's mysqli? It's mysql.

Also, you need to be running a mysql server.
Posted by Arcalyth December 06, 2006 15:22 - 6.5 years ago
| [#1]

try
mysql_connect("localhost", "root" , "password") or die(mysql_error());
Posted by Arcalyth December 06, 2006 15:23 - 6.5 years ago
| [#2]

Mysqli...

www.php.net/mysqli

How do I make sure I am running a MYSQL server? I did everything according to my tutorial I have. I installed Apach/PHP/MySQL at all the right places...
Posted by Tr00jg December 06, 2006 15:42 - 6.5 years ago
| [#3]

Hummm, if you're learning php by installing your own webserver in your pc, I suggest you to install XAMPP, it puts PHP Apache and MySQL in one installation, without any bugs or errors.
Posted by Josea December 06, 2006 15:48 - 6.5 years ago
| [#4]

I tried installing PHP etc to my PC so I could develop, and I have the same problem (PHP/Apache works fine but MySQL just doesn't want to do anything). If I fix it I'll probably let you know.
Posted by OL December 06, 2006 15:53 - 6.5 years ago
| [#5]

perhaps you didnt install PHP with the mysqli extentions?
Posted by shadowstrike32 December 06, 2006 16:21 - 6.5 years ago
| [#6]

Well, here's why: mysqli doesn't come built in to php. You have to install it manually first.
Posted by flashback December 06, 2006 18:20 - 6.5 years ago
| [#7]

Why are you using MySQLi again? MySQL regular works just fine, and doesn't require that you recompile PHP.

Install PHP, MySQL, make sure you've got IIS on your box, and get your passwords all sorted out for PHPMyAdmin, then you're set for offline development.
Posted by FredFredrickson December 06, 2006 21:50 - 6.5 years ago
| [#8]

Recent Activity
 
Active Users (0)