No entry added to the PhpAdmin Database. Why?
Moderators: egami, macek, gesf
-
- New php-forum User
- Posts: 13
- Joined: Wed Oct 27, 2004 7:37 am
Hi,
I'm New here! :-?
I have this problem encountered from this PHP Admin 2.3.2 . What happen was, i have this page,
http://www.hst.com.sg/acatalog/testimonial.html(scroll it down) and you will be able to see a form. On this form, the comment box has a variable called "TEXT". I tried to submit a long text but when i open up my PHP Admin 2.3.2, i could not see any entry from that field. What could be teh reason? Pls guide. Thanks aLot!
With Love,
MissTortoise!
I'm New here! :-?
I have this problem encountered from this PHP Admin 2.3.2 . What happen was, i have this page,
http://www.hst.com.sg/acatalog/testimonial.html(scroll it down) and you will be able to see a form. On this form, the comment box has a variable called "TEXT". I tried to submit a long text but when i open up my PHP Admin 2.3.2, i could not see any entry from that field. What could be teh reason? Pls guide. Thanks aLot!
With Love,
MissTortoise!
-
- New php-forum User
- Posts: 13
- Joined: Wed Oct 27, 2004 7:37 am
Hi,
I doubt there are any coding problems. I did not do any coding when i use this program? How could there be coding problems? It was just drop down menu for me to choose which variable i would want for that comment box, and ichose "TEXT" which supposed to take in more words than the "VARCHAR" which takes in 255? isnt it? Erm, could someone please guide. Those who also uses phpadmin2.3.2? please. Thank you very much!
With Regards,
MissTortoise!
I doubt there are any coding problems. I did not do any coding when i use this program? How could there be coding problems? It was just drop down menu for me to choose which variable i would want for that comment box, and ichose "TEXT" which supposed to take in more words than the "VARCHAR" which takes in 255? isnt it? Erm, could someone please guide. Those who also uses phpadmin2.3.2? please. Thank you very much!
With Regards,
MissTortoise!
-
- New php-forum User
- Posts: 13
- Joined: Wed Oct 27, 2004 7:37 am
Hi,
i have the type as : Full text, size: 1, does this information help?
Code written this way :
ALTER TABLE `Customer` ADD FULLTEXT (
`CustFax`
)
It is also set NULL. There are actually not Real codes. It is all operated by drop down menu, where i can select the variable types i like to have.
Please check if it helps. Thanks.
WIth Regards,
Misstortoise.
i have the type as : Full text, size: 1, does this information help?
Code written this way :
ALTER TABLE `Customer` ADD FULLTEXT (
`CustFax`
)
It is also set NULL. There are actually not Real codes. It is all operated by drop down menu, where i can select the variable types i like to have.
Please check if it helps. Thanks.
WIth Regards,
Misstortoise.
- swirlee
- Moderator
- Posts: 2257
- Joined: Sat Jul 05, 2003 1:18 pm
- Location: A bunk in the back
- Contact:
MissTortoise! wrote:There are actually not Real codes.
If there's no code, then there's no way for your data to get into the database. Just having drop-downs on a page doesn't give the server any way to take that information and put it into a database.
Tell me this: In your <form> code, what does the "action" attribute say?
- Alexej Kubarev
- Site Admin
- Posts: 2213
- Joined: Fri Mar 05, 2004 7:15 am
- Location: Täby, Stockholms län
- Contact:
i must say that its no idea asking for help if you dont post your codes...
The problem is that we cant just go on with trying to guess what the problem is..
We are not going to steal your code anyway...
So please, be so kind and post a code that you are using to change the infromation in the DB and it would also help if you post a code of the form and the code of the page that is in the action feeld of that form..
The problem is that we cant just go on with trying to guess what the problem is..
We are not going to steal your code anyway...
So please, be so kind and post a code that you are using to change the infromation in the DB and it would also help if you post a code of the form and the code of the page that is in the action feeld of that form..
-
- New php-forum User
- Posts: 13
- Joined: Wed Oct 27, 2004 7:37 am
OH dear.. Why would i not want to do as you say? i certainly wnat to, my freinds..but maybe you guys would like to guide me what are the ways i can see those codes? where are they located? this is more of just GUI interface. They are in fact no codes i could see. Probably i'm just too stupid in IT that i cant find one. But pardon me, i really need help in this and really would like to cooperate with anyone else that could help me. I'm using PHP admin 2.3.2? application. :eek:
Sigh..I go Look for it!
With Love,
MissTortoise!
Sigh..I go Look for it!
With Love,
MissTortoise!
-
- New php-forum User
- Posts: 13
- Joined: Wed Oct 27, 2004 7:37 am
<?
include("db.php");
$link=dbconnect();
if(isset($_POST['mailing2'])){
$query="SELECT * from Customer WHERE CustEmail='".$_POST['email']."';";
$result=safe_query($query);
if(!(mysql_num_rows($result))){
$query="INSERT INTO Customer(eid,CustName,CustCountry,CustTailor,CustEmail,regDate,Custrecomm,Custcomment)
VALUES('','".$_POST['name']."','".$_POST['country']."','".$_POST['field']."','".$_POST['email']."',now(),'".$_POST['recommendation']."','".$_POST['commentbox']."');";
safe_query($query);
$message="We have received your review. Thank you very much. We hope to give you better services through this. Please click <a href=http://www.hst.com.sg title="Welcome to Hwa Seng Textiles Online Fabric stores"> here</a> to go back to home page.";
}else{
$message="Sorry, We are unable to receive your Review. Please click <a href="http://www.hst.com.sg/acatalog/Business.html" title="You are now in Hwa Seng Online Fabric stores -Please try again. Thank you"> here</a> to enter another email address. If it still doesn't work, please contact us at, (65)63455154 or <a href="mailto:hstextile@hst.com.sg" title="Online Fabric stores">Email us</a>.";
}
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?=$message?>
</body>
</html>
The light came when i saw what swirlee were asking.. Apologise. Dindt know whats the code u guys wanted. Yup! This is it. :grin:
- Alexej Kubarev
- Site Admin
- Posts: 2213
- Joined: Fri Mar 05, 2004 7:15 am
- Location: Täby, Stockholms län
- Contact:
There are few things that i wonder about...
1st is why use safe_query($query);
anyways..
2nd... why dont you put a code like
that will help you see whats wrong..
You can also try to make an output of your query to see what really is wrong...
The problem might be that the script never goes to the part where it should insert into database..
I would assume that you are posting that "mailing2" variable so this is the code that I would use to debug:
This was a user friendly debug code..
Hope it helps... please post error that you get... IF you get them..
1st is why use safe_query($query);
anyways..
2nd... why dont you put a code like
Code: Select all
mysql_query($query) or die(mysql_error());
that will help you see whats wrong..
You can also try to make an output of your query to see what really is wrong...
The problem might be that the script never goes to the part where it should insert into database..
I would assume that you are posting that "mailing2" variable so this is the code that I would use to debug:
Code: Select all
if(isset($_POST['mailing2'])){
$query="SELECT * from Customer WHERE CustEmail='".$_POST['email']."';";
$result=mysql_query($query) or die("Query one error: ".mysql_error());
//If no record found.The one you have used before would work in case there was an error in mysql_num_rows() excecution. No rows is NOT an error
if(mysql_num_rows($result)==0){
$query="INSERT INTO Customer(eid,CustName,CustCountry,CustTailor,CustEmail,regDate,Custrecomm,Custcomment)
VALUES( '',' ".$_POST['name']." ',' ".$_POST['country']." ',' ".$_POST['field']." ',' ".$_POST['email']." ',now(),' ".$_POST['recommendation']." ',' ".$_POST['commentbox']." ')";
//Output of the query and checking if we are at the right place
echo("We are here to excecute this query: ".$query);
//Query excecution with error reporting
$result=mysql_query($query) or die("Oj! We just had a problem!<br>MySQL reported: "mysql_error());
//Post-excecution message
echo('<p>Everything should be just fine! Check the database!</p>');
}
This was a user friendly debug code..

Hope it helps... please post error that you get... IF you get them..
-
- New php-forum User
- Posts: 13
- Joined: Wed Oct 27, 2004 7:37 am
HEY! TOOK me QUITE soem time to think of HOW to DEBUG! haha. OppZ
HERE IT GOES...
--------------------------------
Error
SQL-query :
* ? include(
"db.php"
)
MySQL said:
You have an error in your SQL syntax near '<?
include("db.php")' at line 1
With Regards,
MIssTorTOIse!
HERE IT GOES...
--------------------------------
Error
SQL-query :
* ? include(
"db.php"
)
MySQL said:
You have an error in your SQL syntax near '<?
include("db.php")' at line 1
With Regards,
MIssTorTOIse!
-
- New php-forum User
- Posts: 13
- Joined: Wed Oct 27, 2004 7:37 am
THIS is the DB.php! Whats wrong wiht Line 1? :sad:
One more thing to include, that is i also have a file call "mailing.php" which is used for Newsletter, The mailing2.php is for testimonial submission purposes! Would it clasH? do i need 2 DB.php? wads DB.php for? submission ?
Hope it helps!
One more thing to include, that is i also have a file call "mailing.php" which is used for Newsletter, The mailing2.php is for testimonial submission purposes! Would it clasH? do i need 2 DB.php? wads DB.php for? submission ?
<?php
// resource dbconnect([string database name [, string user name [, string password [, string server name]]]])
// This function will connect to a MySQL database. If the attempt to connect
// fails, an error message prints out and the script will exit.
function dbconnect($dbname="XXX", $user="XXXX", $password="XXX", $server="XXXX") {
$link = mysql_connect($server, $user, $password)
or exit("<h3>could not connect to database</h3>"
. "<li>errorno => " . mysql_errno()
. "<li>error => " . mysql_error()
. "<li>Return to <a href='./'>main page</a>");
mysql_select_db($dbname)
or exit("<h3>could not select database</h3>"
. "<li>errorno => " . mysql_errno()
. "<li>error => " . mysql_error()
. "<li>Return to <a href='./'>main page</a>");
return $link;
}
// resource safe_query(string query)
// This function will execute an SQL query against the currently open
// MySQL database. If the global variable $query_debug is not empty,
// the query will be printed out before execution. If the execution fails,
// the query and any error message from MySQL will be printed out, and
// the function will return FALSE. Otherwise, it returns the MySQL
// result set identifier.
function safe_query($query) {
$result = mysql_query($query)
or exit("ack! query failed: "
."<li>errorno => ".mysql_errno()
."<li>error => ".mysql_error()
."<li>query => ".$query
."<li>Return to <a href='./'>main page</a>");
return $result;
}
?>
Hope it helps!
- Alexej Kubarev
- Site Admin
- Posts: 2213
- Joined: Fri Mar 05, 2004 7:15 am
- Location: Täby, Stockholms län
- Contact:
Im sorry but what hell is this line?
SQL-query :
* ? include(
"db.php"
)
SQL query may not include php tags or anything like that... caan you make it post the whole query and a mysql_error() on the next line after the query??
SQL-query :
* ? include(
"db.php"
)
SQL query may not include php tags or anything like that... caan you make it post the whole query and a mysql_error() on the next line after the query??
-
- New php-forum User
- Posts: 13
- Joined: Wed Oct 27, 2004 7:37 am
Sorry,
They said the Line 1 of "Mailing2.php" (which is e one below not the db.php")
<?
include("db.php");
$link=dbconnect();
if(isset($_POST['mailing2'])){
$query="SELECT * from Customer WHERE CustEmail='".$_POST['email']."';";
$result=mysql_query($query);
if(mysql_num_rows($result)==0){
$query="INSERT INTO Customer(eid,CustName,CustCountry,CustTailor,CustEmail,regDate,Custrecomm,Custcomment)
VALUES('','".$_POST['name']."','".$_POST['country']."','".$_POST['field']."','".$_POST['email']."',now(),'".$_POST['recommendation']."','".$_POST['commentbox']."')";
//Output of the query and checking if we are at the right place
echo("We are here to excecute this query: ".$query);
//Query excecution with error reporting
$result=mysql_query($query) or die("Oj! We just had a problem!<br>MySQL reported: "mysql_error());
//Post-excecution message
echo('<p>Everything should be just fine! Check the database!</p>');
mysql_query($query);
$message="We have received your review. Thank you very much. We hope to give you better services through this. Please click <a href=http://www.hst.com.sg title="Welcome to Hwa Seng Textiles Online Fabric stores"> here</a> to go back to home page.";
}else{
$message="Sorry, We are unable to receive your Review. Please click <a href="http://www.hst.com.sg/acatalog/Business.html" title="You are now in Hwa Seng Online Fabric stores -Please try again. Thank you"> here</a> to enter another email address. If it still doesn't work, please contact us at, (65)63455154 or <a href="mailto:hstextile@hst.com.sg" title="Online Fabric stores">Email us</a>.";
}
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?=$message?>
</body>
</html>
They said the Line 1 of "Mailing2.php" (which is e one below not the db.php")
<?
include("db.php");
$link=dbconnect();
if(isset($_POST['mailing2'])){
$query="SELECT * from Customer WHERE CustEmail='".$_POST['email']."';";
$result=mysql_query($query);
if(mysql_num_rows($result)==0){
$query="INSERT INTO Customer(eid,CustName,CustCountry,CustTailor,CustEmail,regDate,Custrecomm,Custcomment)
VALUES('','".$_POST['name']."','".$_POST['country']."','".$_POST['field']."','".$_POST['email']."',now(),'".$_POST['recommendation']."','".$_POST['commentbox']."')";
//Output of the query and checking if we are at the right place
echo("We are here to excecute this query: ".$query);
//Query excecution with error reporting
$result=mysql_query($query) or die("Oj! We just had a problem!<br>MySQL reported: "mysql_error());
//Post-excecution message
echo('<p>Everything should be just fine! Check the database!</p>');
mysql_query($query);
$message="We have received your review. Thank you very much. We hope to give you better services through this. Please click <a href=http://www.hst.com.sg title="Welcome to Hwa Seng Textiles Online Fabric stores"> here</a> to go back to home page.";
}else{
$message="Sorry, We are unable to receive your Review. Please click <a href="http://www.hst.com.sg/acatalog/Business.html" title="You are now in Hwa Seng Online Fabric stores -Please try again. Thank you"> here</a> to enter another email address. If it still doesn't work, please contact us at, (65)63455154 or <a href="mailto:hstextile@hst.com.sg" title="Online Fabric stores">Email us</a>.";
}
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?=$message?>
</body>
</html>
-
- New php-forum User
- Posts: 13
- Joined: Wed Oct 27, 2004 7:37 am
$result=mysql_query($query) or die("Oj! We just had a problem!<br>MySQL reported: "
mysql_error());
Can someone spot wads the error with this sentence? Plss help
mysql_error());
Can someone spot wads the error with this sentence? Plss help
-
- New php-forum User
- Posts: 13
- Joined: Wed Oct 27, 2004 7:37 am
Can anyone help.. Haiz. This error has been occuring again and again...after adding your debugging codes, it has turn out codes error. What should i do nw?
- Alexej Kubarev
- Site Admin
- Posts: 2213
- Joined: Fri Mar 05, 2004 7:15 am
- Location: Täby, Stockholms län
- Contact:
$result=mysql_query($query) or die("Oj! We just had a problem!<br>MySQL reported: ".mysql_error());
you forgot a connecting dot..
try again... instead of safe_query
that should help...
You would get that Oj! We just had a problem!
In case something is wrong... please post WHAT did mysql report?
you forgot a connecting dot..
try again... instead of safe_query
that should help...
You would get that Oj! We just had a problem!
In case something is wrong... please post WHAT did mysql report?
-
- New php-forum User
- Posts: 13
- Joined: Wed Oct 27, 2004 7:37 am
Now my error is line 28! oh dear..why are there suddenly so many errors..
<?
include("db.php");
$link=dbconnect();
if(isset($_POST['mailing2'])){
$query="SELECT * from Customer WHERE CustEmail='".$_POST['email']."';";
$result=mysql_query($query) or die("Query one error: ".mysql_error());
//If no record found.The one you have used before would work in case there was an
error in mysql_num_rows() excecution. No rows is NOT an error
if(mysql_num_rows($result)==0){
$query="INSERT INTO Customer(
eid,CustName,CustCountry,CustTailor,CustEmail,regDate,Custrecomm,Custcomment)
VALUES( '',' ".$_POST['name']." ',' ".$_POST['country']." ',' ".$_POST['field']."
',' ".$_POST['email']." ',now(),' ".$_POST['recommendation']." ',' ".$_POST[
'commentbox']." ')";
//Output of the query and checking if we are at the right place
echo("We are here to excecute this query: ".$query);
//Query excecution with error reporting
$result=mysql_query($query) or die("Oj! We just had a problem!<br>MySQL reported:
".mysql_error());
//Post-excecution message
echo('<p>Everything should be just fine! Check the database!</p>');
mysql_query($query);
$message="We have received your review. Thank you very much. We hope
to give you better services through this. Please click <a href=http://www.hst.com.sg
title="Welcome to Hwa Seng Textiles Online Fabric stores"> here</a> to go back to
home page.";
}else{
$message="Sorry, We are unable to receive your Review. Please click <a href
="http://www.hst.com.sg/acatalog/Business.html" title="You are now in Hwa Seng
Online Fabric stores -Please try again. Thank you"> here</a> to enter another email
address. If it still doesn't work, please contact us at, (65)63455154 or <a href="
mailto:hstextile@hst.com.sg" title="Online Fabric stores">Email us</a>.";
}
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?=$message?>
</body>
</html>
Last edited by MissTortoise! on Wed Nov 03, 2004 9:04 pm, edited 1 time in total.
- Alexej Kubarev
- Site Admin
- Posts: 2213
- Joined: Fri Mar 05, 2004 7:15 am
- Location: Täby, Stockholms län
- Contact:
Shouldnt be any errors.. :S
replace that code with this one... i just removed some text..
Please do not format that string above... just replace the existing one with this one as is..
By the way... it would also help if you copy-paste errors that you are getting...
replace that code with this one... i just removed some text..
Code: Select all
$result=mysql_query($query) or die("MySQL reported:".mysql_error());
Please do not format that string above... just replace the existing one with this one as is..
By the way... it would also help if you copy-paste errors that you are getting...
-
- New php-forum User
- Posts: 13
- Joined: Wed Oct 27, 2004 7:37 am
If you paste it in DREAMWEAVER, it shows:
Line 26 //Query excecution with error reporting
Line 27 $result=mysql_query($query) or die("Oj! We just had a problem!<br>MySQL reported:
Line 28 ---- ITs a blank?----
Line 29 ".mysql_error());
Now the error is line 28 which is a blank?? or should it be counted as line29? i'm not too sure. I have replaced, Alexei but the problem just don go off.. :shock:
Line 26 //Query excecution with error reporting
Line 27 $result=mysql_query($query) or die("Oj! We just had a problem!<br>MySQL reported:
Line 28 ---- ITs a blank?----
Line 29 ".mysql_error());
Now the error is line 28 which is a blank?? or should it be counted as line29? i'm not too sure. I have replaced, Alexei but the problem just don go off.. :shock:
-
- New php-forum User
- Posts: 13
- Joined: Wed Oct 27, 2004 7:37 am
Problems Had been SOLVED. Btw, what is the different by adding
<?=php ?> or <?php $message ?> ? Anyway i removed one bracket. So i think its that bracket that causes the problem.
one problem arised after that.. now it has been inserted into database but it added 2 times of the same customer! one click which produced 2 records? can i just add one not twice?
2nd problem- Now if you submit the testimonial, you will receive this:
My question is, i want my own Thank you msg which is after your ECHO msg. Even thou i tried deleting it off, it will remain as a Blank page. what could have done?
<?=php ?> or <?php $message ?> ? Anyway i removed one bracket. So i think its that bracket that causes the problem.
one problem arised after that.. now it has been inserted into database but it added 2 times of the same customer! one click which produced 2 records? can i just add one not twice?
2nd problem- Now if you submit the testimonial, you will receive this:
These are the following information you have sent: INSERT INTO Customer(CustName,CustCountry,CustTailor,CustEmail,regDate,Custrecomm,Custcomment) VALUES(' name ',' Ecuador ',' five ',' email ',now(),' fabric recommendation ',' comments ');
My question is, i want my own Thank you msg which is after your ECHO msg. Even thou i tried deleting it off, it will remain as a Blank page. what could have done?
Code: Select all
<?php
include("db.php");
$link=dbconnect();
if(isset($_POST['mailing2'])){
$query="SELECT * from Customer WHERE CustEmail='".$_POST['email']."';";
$result=mysql_query($query) or die("Query one error: ".mysql_error());
//If no record found.The one you have used before would work in case there was an error in mysql_num_rows() excecution. No rows is NOT an error
if(mysql_num_rows($result)==0){
$query="INSERT INTO Customer(CustName,CustCountry,CustTailor,CustEmail,regDate,Custrecomm,Custcomment)
VALUES(' ".$_POST['name']." ',' ".$_POST['country']." ',' ".$_POST['field']." ',' ".$_POST['email']." ',now(),' ".$_POST['recommendation']." ',' ".$_POST['commentbox']." ');";
//Output of the query and checking if we are at the right place
echo("These are the following information you have sent: ".$query);
//Query excecution with error reporting
$result=mysql_query($query) or die("Oj! We just had a problem!<br>MySQL reported: ".mysql_error());
mysql_query($query);
[b]$message="We have received your review. Thank you very much. We hope to give you better services through this. Please click <a href=http://www.hst.com.sg title='Welcome to Hwa Seng Textiles Online Fabric stores'> here</a> to go back to home page.";[/b] }else{
$message="Sorry, We are unable to receive your Review. Please click <a href='http://www.hst.com.sg/acatalog/Business.html' title='You are now in Hwa Seng Online Fabric stores -Please try again. Thank you'> here</a> to enter another email address. If it still doesn't work, please contact us at, (65)63455154 or <a href='mailto:hstextile@hst.com.sg' title='Online Fabric stores'>Email us</a>.";
}
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php $message ?>
</body>
</html>
- Alexej Kubarev
- Site Admin
- Posts: 2213
- Joined: Fri Mar 05, 2004 7:15 am
- Location: Täby, Stockholms län
- Contact:
welll i dont really understand the problems that you are getting... the line 28 was the problem that you may not have a blank line there...
Difference between <?=?> and<?php?> is that <?= will evaluate and output the variable while <?php will bot do it... it will just signal a php processor that its a php code there... so u will need to use echo or print with <?php...
<?=?> is mostly used in templates that are beeing included into a code..
Note that <?= is a short tag and will not work is short-tags are disabled..
Please explain a bit better both of your problems..
Difference between <?=?> and<?php?> is that <?= will evaluate and output the variable while <?php will bot do it... it will just signal a php processor that its a php code there... so u will need to use echo or print with <?php...
<?=?> is mostly used in templates that are beeing included into a code..
Note that <?= is a short tag and will not work is short-tags are disabled..
Please explain a bit better both of your problems..