No errors coming up!!!!
Moderator: General Moderators
No errors coming up!!!!
Hi guys,
I'm relativley new to coding php but it would help if the errors were displayed to outline whats wrong with my script. I'm trying to query a database through a php script from a html form. Everything is set up correctly but there is no updating on the database and the php script returns nothing but a white page.
I did some reading on the net and in the php.ini file all the configuration setting are correct.
If any one has any answers that would be great
yours
William
I'm relativley new to coding php but it would help if the errors were displayed to outline whats wrong with my script. I'm trying to query a database through a php script from a html form. Everything is set up correctly but there is no updating on the database and the php script returns nothing but a white page.
I did some reading on the net and in the php.ini file all the configuration setting are correct.
If any one has any answers that would be great
yours
William
this is the php file being called by the html form
I left the connection and and database info out becasue i don't want to display it on the forum.
feyd | please use
I left the connection and and database info out becasue i don't want to display it on the forum.
Code: Select all
<?PHP
$PartNo= $_POSTї'PartNo'];
$Mancode= $_POSTї'Mancode'];
$Suppcode= $_POSTї'Suppcode'];
$Descrip= $_POSTї'Descrip'];
$BinNo= $_POSTї'BinNo'];
$Depot= $_POSTї'Depot'];
$Total= $_POSTї'Total'];
$Cprice= $_POSTї'Cprice'];
$Rprice= $_POSTї'Rprice'];
$ Connection= mysql_connect("", "", "");
mysql_select_db ('');
$result = mysql_query
("INSERT INTO parts values ('$PartNo', '$Mancode', '$Suppcode', '$Descrip', '$BinNo', '$Depot', '$Total', '$Cprice', '$Rprice',)");
echo '<h1>You have created the following Part</h1>'
echo 'PartNo'. $PartNo'<br>';
echo 'Description'. $Mancode.'<br>';
echo 'BinNo'. $BinNo.'<br>';
echo 'Total'. $Total.'<br>';
echo 'Retail Price'. $Rprice.'<br>';
echo '<h3><b>The information has now been entered</p></b><br>';
echo '<a href="Createpart.htm">RETURN</a>' . '<a href="Adminhomepage.php">Admin Options</a>';
mysql_close($Connection);
?>feyd | please use
Code: Select all
tags while theCode: Select all
tags are offline[/color]thats whats in the php.ini fiel as well
Code: Select all
/**
* Sets the php error reporting - Please do not change this line!
*/
if (!isset($old_error_reporting)) {
error_reporting(E_ALL);
@ini_set('display_errors', '1');
}- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
typical database debugging:place some other die() or echo calls in various places to make sure the code gets there. You may need to use flush() or better yet, command line to make sure the data does get out.
Code: Select all
$result = mysql_query($query) or die(mysql_error());- smpdawg
- Forum Contributor
- Posts: 292
- Joined: Thu Jan 27, 2005 3:10 pm
- Location: Houston, TX
- Contact:
See that stray comma at the end of the query? It cannot be there.
Was
Change to
BTW - Follow feyd's example and add debugging to your script, this error would have been obvious with it.
Was
Code: Select all
$result = mysql_query
("INSERT INTO parts values ('$PartNo', '$Mancode', '$Suppcode', '$Descrip', '$BinNo', '$Depot', '$Total', '$Cprice', '$Rprice',)");Code: Select all
$result = mysql_query
("INSERT INTO parts values ('$PartNo', '$Mancode', '$Suppcode', '$Descrip', '$BinNo', '$Depot', '$Total', '$Cprice', '$Rprice')");-
thegreatone2176
- Forum Contributor
- Posts: 102
- Joined: Sun Jul 11, 2004 1:27 pm
also change
to
you forgot the last .
Code: Select all
echo 'PartNo'. $PartNo'<br>';Code: Select all
echo 'PartNo'. $PartNo . '<br>';
Last edited by thegreatone2176 on Sat Mar 05, 2005 12:05 am, edited 1 time in total.
Unfortuantly still not working
Unfortuantly its still not working guys, when i submit the form no error messages are appearing nor nothiing is happening to the database. All that is showing is a white blank screen and none of echo statements are apperaing either. Could it be anything to do with 'NULL' fields in the data base. They're all set to null.
any answers please contact back. the last two replies were awesome advice.
cheers.
any answers please contact back. the last two replies were awesome advice.
cheers.
- smpdawg
- Forum Contributor
- Posts: 292
- Joined: Thu Jan 27, 2005 3:10 pm
- Location: Houston, TX
- Contact:
Two points.
1. It is a bad idea to write INSERT statements without specifying the field names too. Without the field names you must enter every field in the same order that they appear in the database and that includes any fields that have default values like an autoincrement field or timestamp. So double check that every column is in your INSERT query.
The other reason it is a bad idea to leave out field names is that this query and every other INSERT into this table will fail if you add more fields to the table because it will have no idea what to do with undefined fields in your INSERT.
2. You have to add the or die(mysql_error()) to the query statement, if it were there you would have gotten some kind of error message that you could be using to solve this problem.
1. It is a bad idea to write INSERT statements without specifying the field names too. Without the field names you must enter every field in the same order that they appear in the database and that includes any fields that have default values like an autoincrement field or timestamp. So double check that every column is in your INSERT query.
The other reason it is a bad idea to leave out field names is that this query and every other INSERT into this table will fail if you add more fields to the table because it will have no idea what to do with undefined fields in your INSERT.
2. You have to add the or die(mysql_error()) to the query statement, if it were there you would have gotten some kind of error message that you could be using to solve this problem.
-
thegreatone2176
- Forum Contributor
- Posts: 102
- Joined: Sun Jul 11, 2004 1:27 pm
cool advice
Cheers for the advice guys but unfortauntly nothing is still not working i used or die(mysql_error()); query and still only blank screen(no error messages) i think i something its something else. With regards to smpdawg comment how do you insert an auto increment variable into the database. I think in the query you leave it blank like , (''); i'm i right. Also when inserting can u leave fileds blank in the database.
sorry about the tedious questions quite new to this game. lol
yours william
sorry about the tedious questions quite new to this game. lol
yours william