i want connect to sql
this is my page "MySqlConnection.php": - <?php
-
$cite_school=mysql_connec("localhost","****","****");
-
$cite_bdd=mysql_select_db("ecole");
-
if(!$cite_school||!$cite_bdd)
-
{
-
die("Connexion impossible à la base de données". mysql_error());
-
}
-
?>
what is the problem?
Put this into a new PHP file and run it. It should tell you exactly what is going on. If it returns a blank page, there is something wrong with the server; something you won't be able to fix in your code. You'd have to reconfigure/reinstall the server software. - <?php
-
// Enable error reporting
-
ini_set('display_errors', true);
-
error_reporting(E_ALL + E_NOTICE);
-
-
// Make sure the mysql extension is available
-
if(!function_exists("mysql_connect")) {
-
die("MySQL extension not available.");
-
}
-
-
// Try to connect
-
if(!($dbLink = mysql_connect("localhost", "usr", "pwd"))) {
-
die("failed to connect to MySQL: " . mysql_error());
-
}
-
if(!mysql_select_db("ecole", $dbLink)) {
-
die("Failed to select db: " . mysql_error());
-
}
-
-
// It worked!
-
echo "Success! You can connect to your MySQL database without problems.";
-
?>
26 2582
Hi Leen,
Please use [code] tags around your code for the future, and also include any error messages you receive which makes us finding the problem quicker.
The biggest problem I see that will stop this from working is you misspelling: "mysql_connect". You have "mysql_connec".
oh sorry here I Write like this ,into my code I write 'mysql_connect ".
when I open this page nothing happens, but in the other pages as a "sign up" in which includ the page "MySQLConnect", I get "connection diagnostic problems", ie it does not make a connection tothe data base "school".
I know this is the easiest page in my project, but I can not detect the problem has
Try run this, and post exactly what is returned: - mysql_connect('localhost', '****', '****') or die("Could not connect: ".mysql_error());
-
mysql_select_db('ecole') or die("Could not select ecole: ".mysql_error());
i try it.
when i open this page in "internet explorer", i get blanc page.
does that mean that there is connection to database??
Try adding: - error_reporting(E_ALL);
-
ini_set('display_errors', 'on');
To the top of your page. Tell us what is says after that.
Sorry, I should have made this clearer.
Put in a page: - error_reporting(E_ALL);
-
ini_set('display_errors', 'on');
-
mysql_connect('localhost', '****', '****') or die("Could not connect: ".mysql_error());
-
mysql_select_db('ecole') or die("Could not select ecole: ".mysql_error());
If that's what you did, then I think there is something wrong with your PHP install. You haven't had any other issues with PHP functions? What PHP version are you running?
i try it but also i get white page.
i used easy php, but he doesn't work in windows seven, now i use wamp
thank u verry much for ur help.
Atli 5,058
Expert 4TB
Put this into a new PHP file and run it. It should tell you exactly what is going on. If it returns a blank page, there is something wrong with the server; something you won't be able to fix in your code. You'd have to reconfigure/reinstall the server software. - <?php
-
// Enable error reporting
-
ini_set('display_errors', true);
-
error_reporting(E_ALL + E_NOTICE);
-
-
// Make sure the mysql extension is available
-
if(!function_exists("mysql_connect")) {
-
die("MySQL extension not available.");
-
}
-
-
// Try to connect
-
if(!($dbLink = mysql_connect("localhost", "usr", "pwd"))) {
-
die("failed to connect to MySQL: " . mysql_error());
-
}
-
if(!mysql_select_db("ecole", $dbLink)) {
-
die("Failed to select db: " . mysql_error());
-
}
-
-
// It worked!
-
echo "Success! You can connect to your MySQL database without problems.";
-
?>
thank u
it return:Success! You can connect to your MySQL database without problems
that mean it's true. thank u.
but when i run the page SignUp.php, i get:'internet explorer cannot display the webpage'
this is the page SignUp.html: - <html>
-
<form method="post" action="SignUp.php">
-
<body>
-
<div align=center>
-
<table cellspacing=15>
-
<caption><h1>SignUp</h1></caption>
-
<tr>
-
<td class=F>last name</F></td>
-
<td colspan="3" width=150><input type=text name="nom" >
-
<td class=F>first name</td>
-
<td colspan="3"><input type=text name="prenom"></td>
-
</tr>
-
<tr>
-
<td class=F>father name</td>
-
<td colspan="3"><input type=text name="perenom"></td>
-
<td class=F>date of birth</td>
-
<td colspan="3" ><input type=text name="dob"></td>
-
</tr>
-
<tr>
-
<td class=F>telephone</td>
-
<td colspan="3"><input type=text name="phone"></td>
-
<td class=F>email</td>
-
<td colspan="3"><input type=text name="mail"></td>
-
</tr>
-
<tr>
-
<td class=F>country</td>
-
<td colspan="3"><input type=text name="ville"></td>
-
<td class=F>rue</td>
-
<td colspan="3"><input type=text name="rue"></td>
-
</tr>
-
<tr>
-
<td class=F>immeuble</td>
-
<td colspan="3"><input type=text name="immeuble"></td>
-
</tr>
-
<tr>
-
<td class=F>identity card</td>
-
<td colspan="3"><input type=file name="idcard"></td>
-
<td class=F>papaer of success</td>
-
<td colspan="3"><input type=file name="pps"></td>
-
</tr>
-
<tr>
-
<td class=F>user name</td>
-
<td colspan="3"><input type=text name="userNom"></td>
-
</tr>
-
<tr>
-
<td class=F>password</td>
-
<td colspan="3"><input type=password name="pass"></td>
-
<td class=F>confirm password</td>
-
<td colspan="3"><input type=password name="pass"></td>
-
-
<td colspan="2"><input type="submit" name="submit" width="70%" height="40%"></td>
-
<td><input type="reset" name="submit" value="Clear" width="100%" height="50%"></td>
-
</tr>
-
</table>
-
-
</body>
-
</form>
-
</html>
and this is SignUp.php: - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-
<?php
-
SESSION_start();
-
$nom=$_POST['nom'];
-
$prenom=$_POST["prenom"];
-
$perenom=$_POST["perenom"];
-
$dob=$_POST["dob"];
-
$phone=$_POST["phone"];
-
$mail=$_POST["mail"];
-
$ville=$_POST["ville"];
-
$rue=$_POST["rue"];
-
$immeuble=$_POST["immeuble"];
-
$idcard=$_POST["idcard"];
-
$pps=$_POST["pps"];
-
$userNom=$_POST["userNom"];
-
$pass=$_POST["pass"];
-
include("essai.php");
-
$insert="INSRET INTO 'etudiante'
-
VALUES('',$nom,
-
'$prename', '$perenom', '$dob', '$phone', '$mail', '$ville', '$rue', '$immeuble', '$idcaed', '$pps','$userNom', MD5('$pass'))";
-
$result= mysql_query($insert);
-
if($result)
-
{
-
header("Location:Acceptance.php");
-
}
-
else
-
{
-
echo("You have missing or wrong input infomation". mysql_error());
-
}
-
mysql_close();
-
?>
-
</html>
-
i name the page u gave me 'essai.page'
but why when i press the button 'submit', i get 'internet explorer cannot display the webpge'???
Atli 5,058
Expert 4TB
Ok, first of all let me say that Internet Explorer is a horrible browser, especially for web development. It's usually best to use Firefox or Chrome, and then just check in with IE from time to time to see if you need to apply fixes. Join the 21'st century! ;)
Now, with that out of the way... Leen: but when i run the page SignUp.php, i get:'internet explorer cannot display the webpage'
This would indicate a problem with the connection to your page, not the page itself. What *exactly* does the URL of the page that generates this error look like? Be sure to note the case of the file name. ("SignUp.php" is not equal to "signup.php".)
Also, even though this is probably not a part of the current problem, in your SignUp.php code, you start of by putting in the HTML doctype but then go on to use the header() function later on. You can not do that.
The header function must be used before ANY content is "sent" to the browser. In a HTTP response the headers are sent first, and then the content. Once you start sending HTML, then the headers are locked. Even a white-space before the <?php tag of a PHP page will trigger this lock-down of the headers.
now i use firefox.
yes, signup is different to SignUp.
but now i get:
"
The connection was reset
The connection to the server was reset while the page was loading.
* The site could be temporarily unavailable or too busy. Try again in a few
moments.
* If you are unable to load any pages, check your computer's network
connection.
* If your computer or network is protected by a firewall or proxy, make sure
that Firefox is permitted to access the Web.
"
why??? always wrong? why?
this is my new page
i have join the 2 pages in one, but also false...why? - <?php
-
include("entete.html");
-
?>
-
<html>
-
<form method="post">
-
<head>
-
<title>Sign Up</title>
-
<Style type="text/css">
-
.text {width:785px;}
-
.F { font-family: "Verdana"; font-size: 20px; text-transform: "capitalize"; align:right;}
-
</style>
-
</head>
-
<body>
-
<div align=center>
-
<table cellspacing=15>
-
<caption><h1>SignUp</h1></caption>
-
<tr>
-
<td class=F>last name</F></td>
-
<td colspan="3" width=150><input type=text name="nom" >
-
<td class=F>first name</td>
-
<td colspan="3"><input type=text name="prenom"></td>
-
</tr>
-
<tr>
-
<td class=F>father name</td>
-
<td colspan="3"><input type=text name="perenom"></td>
-
<td class=F>date of birth</td>
-
<td colspan="3" ><input type=text name="dob"></td>
-
</tr>
-
<tr>
-
<td class=F>telephone</td>
-
<td colspan="3"><input type=text name="phone"></td>
-
<td class=F>email</td>
-
<td colspan="3"><input type=text name="mail"></td>
-
</tr>
-
<tr>
-
<td class=F>country</td>
-
<td colspan="3"><input type=text name="ville"></td>
-
<td class=F>rue</td>
-
<td colspan="3"><input type=text name="rue"></td>
-
</tr>
-
<tr>
-
<td class=F>immeuble</td>
-
<td colspan="3"><input type=text name="immeuble"></td>
-
</tr>
-
<tr>
-
<td class=F>identity card</td>
-
<td colspan="3"><input type=file name="idcard"></td>
-
<td class=F>papaer of success</td>
-
<td colspan="3"><input type=file name="pps"></td>
-
</tr>
-
<tr>
-
<td class=F>user name</td>
-
<td colspan="3"><input type=text name="userNom"></td>
-
</tr>
-
<tr>
-
<td class=F>password</td>
-
<td colspan="3"><input type=password name="pass"></td>
-
<td class=F>confirm password</td>
-
<td colspan="3"><input type=password name="pass"></td>
-
-
<td colspan="2"><input type="submit" name="submit" value="submit" width="70%" height="40%"></td>
-
<td><input type="reset" name="reset" value="Clear" width="100%" height="50%"></td>
-
</tr>
-
</table>
-
<?php
-
include("essai.php");
-
$insert="INSRET INTO 'etudiante'
-
VALUES('',$nom,
-
'$prename', '$perenom', '$dob', '$phone', '$mail', '$ville', '$rue', '$immeuble', '$idcaed', '$pps','$userNom', MD5('$pass'))";
-
$result= mysql_query($insert);
-
if($result)
-
{
-
header("Location:Acceptance.php");
-
}
-
else
-
{
-
echo("You have missing or wrong input infomation". mysql_error());
-
}
-
mysql_close();
-
?>
-
-
</body>
-
</form>
-
</html>
to fix one obvious mistake, <form> must be placed inside <body> (see also validator.w3.org)
Ok, first of all let me say that Internet Explorer is a horrible browser, especially for web development. It's usually best to use Firefox or Chrome, and then just check in with IE from time to time to see if you need to apply fixes. Join the 21'st century! ;)
This is very subjective. In the future, phrase this as " I think of IE as a horrible browser", as your opinion does not necessarily has to reflect reality. I use IE for development and I have no problems whatsoever.
Steven
this is reply for "Dormilich":
thank u.
i place form inside body, but this is not here the problem.
and i use validator.w3.org, but it doesn't detect the main problem
this is reply for "Dormilich":
thank u.
i place form inside body, but this is not here the problem.
and i use validator.w3.org, but it doesn't detect the main problem
I didn’t think it would be the cause of the problem, though it’s always good practice to have valid HTML (which can cause other problems).
but my problem is in php not in html..
Atli 5,058
Expert 4TB
This doesn't sound like a problem in your code. If you are getting "The connection was reset" as an error message, it sounds more like a problem with your server configuration.
Could also be that something in your PHP code is causing a timeout. Do you have to wait long until the error message is shown?
Could you tell us more about your server? Like the OS you are running, and the versions of the server software. Also, any firewall or such you are running.
Atli 5,058
Expert 4TB
This is very subjective. In the future, phrase this as "I think of IE as a horrible browser", as your opinion does not necessarily has to reflect reality. I use IE for development and I have no problems whatsoever.
This is not an opinion, sadly. IE has horrible standards support and a very bad track record when it comes to bugs. Doesn't take much research to verify this. (Just make sure to avoid Microsoft's own propaganda. There is a lot of it out there.)
Not to mention that if you try to adhere to the standards when creating websites, you usually have to work around a few IE bugs/incompatibilities. A lot of us even have "standard" IE standards support fixes we include by default to avoid the brunt of it.
- <?php
-
mysql_connect("localhost","root","")or die("not connected");
-
mysql_select_db("db name")or die("db not connected".mysql_error());
-
?>
No we don't have to wait to long as we load the page it gives us "The connection was reset"
also we are working on windows 7
and the program is WAMP version 2.0
and we are using Firefox version of mozilla is 3.6.8
I know that, in Internet Explorer at least, your error oftentimes implies PHP errors. When there are errors in a page, your server sends an HTTP 500 response. Internet Explorer takes the HTTP 500 response and runs with it. You can check for the exact errors by checking your error logs. Since you are using an Apache set up, you can find it in the error.log file in the logs folder. i.e. c:\wamp\logs\error.log
Looking at your code, I assume that you WILL find errors. You don't check if $_POST variables are empty, you spelled "INSERT" incorrectly, and you attempt to send headers after output has already been made to the browser.
@MrMancunian: How can you claim to use IE for development? Each version of IE renders differently. You'd have to have IE6, IE7, and IE8 up to be able to claim that you support IE.
Which is what I have to do all the time. -_-
I'm scared of what problems IE9 will carry with it. I assume buggy CSS3 and HTML5, if they even follow through with it. To Microsoft, HTML5 is a buzzword.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: G-Fit |
last post by:
Hello group,
I have several servers hosting SQL databases. On each of them, I have
several databases. All those databases have the same structure (even those
on different servers), only the data...
|
by: pradeep_TP |
last post by:
Hi all,
I have a few questions that I have been wanting to ask for long. These are
all related to ADO.net and specifically to conenction to database.
1) If I have opened a connection to a...
|
by: Eric Sabine |
last post by:
In my Finally block, I was using cn.close (where cn is an ADO.NET
connection object, SQLConnection to be exact) and then I came across the
following in some microsoft code.
If Not cn Is Nothing...
|
by: Martin B |
last post by:
Hallo!
I'm working with C# .NET 2.0, implementing Client/Server Applications which
are connecting via Network to SQL-Server or Oracle Databases.
To stay independent from the underlaying Database...
|
by: Terry Jolly |
last post by:
Web Solution
Goal: Have a global database connection
Why: (There will be 30+ tables, represented by 30+ classes) I only want to
reference the database connection once.
I put the connection...
|
by: fniles |
last post by:
I am using VS2003 and connecting to MS Access database.
When using a connection pooling (every time I open the OLEDBCONNECTION I use
the exact matching connection string),
1. how can I know how...
|
by: fniles |
last post by:
In the Windows application (using VB.NET 2005) I use connection pooling like
the following:
In the main form load I open a connection using a connection string that I
stored in a global variable...
|
by: Cintury |
last post by:
Hi all,
I've developed a mobile application for windows mobile 5.0 that has been in use for a while (1 year and a couple of months). It was developed in visual studios 2005 with a back-end sql...
|
by: Robert Avery |
last post by:
In VBA/VB6, I had a class (incomplete sample below) that watched and
displayed for the user all connection events, so that I could easily
see what SQL was taking a long time, and when it freezes, I...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |