No entry added to the PhpAdmin Database. Why?

How to use phpmyadmin.... phpmyadmin related arguments. Even phpMyAdmin issues

Moderators: macek, egami, gesf

MissTortoise!
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Oct 27, 2004 7:37 am

No entry added to the PhpAdmin Database. Why?

Postby MissTortoise! » Wed Oct 27, 2004 7:44 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!

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Postby ruturajv » Wed Oct 27, 2004 7:28 pm

this seems to be a php coding problem,
not a phpmyadmin issue,
please change the forum , and post some code.

MissTortoise!
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Oct 27, 2004 7:37 am

Postby MissTortoise! » Thu Oct 28, 2004 12:17 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!

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Thu Oct 28, 2004 5:40 am

If you have a page with a form on it, there has to be some code in order for the information from that form to be put in the database. It might be PHP or ASP or JSP code, but must be some code there, and it's definitely not working correctly. We can't help you unless we know what that code is.

MissTortoise!
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Oct 27, 2004 7:37 am

Postby MissTortoise! » Fri Oct 29, 2004 3:06 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.

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Fri Oct 29, 2004 8:28 am

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?

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sat Oct 30, 2004 4:16 am

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..

MissTortoise!
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Oct 27, 2004 7:37 am

Postby MissTortoise! » Sun Oct 31, 2004 11:30 pm

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!

MissTortoise!
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Oct 27, 2004 7:37 am

I GOT WHAT u mean! so this was the code u guys wnted..sOrry

Postby MissTortoise! » Sun Oct 31, 2004 11:31 pm

<?
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:

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Mon Nov 01, 2004 9:47 am

There are few things that i wonder about...
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.. :D
Hope it helps... please post error that you get... IF you get them..

MissTortoise!
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Oct 27, 2004 7:37 am

Postby MissTortoise! » Mon Nov 01, 2004 10:29 pm

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!

MissTortoise!
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Oct 27, 2004 7:37 am

Postby MissTortoise! » Mon Nov 01, 2004 10:31 pm

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 ?

<?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!

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Tue Nov 02, 2004 2:14 am

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??

MissTortoise!
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Oct 27, 2004 7:37 am

Postby MissTortoise! » Tue Nov 02, 2004 2:27 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>

MissTortoise!
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Oct 27, 2004 7:37 am

Postby MissTortoise! » Wed Nov 03, 2004 1:54 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

MissTortoise!
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Oct 27, 2004 7:37 am

Postby MissTortoise! » Wed Nov 03, 2004 2:12 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?

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Wed Nov 03, 2004 2:17 am

$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?

MissTortoise!
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Oct 27, 2004 7:37 am

Postby MissTortoise! » Wed Nov 03, 2004 2:25 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.

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Wed Nov 03, 2004 10:27 am

Shouldnt be any errors.. :S

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...

MissTortoise!
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Oct 27, 2004 7:37 am

Postby MissTortoise! » Wed Nov 03, 2004 8:02 pm

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:

MissTortoise!
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Oct 27, 2004 7:37 am

Postby MissTortoise! » Wed Nov 03, 2004 8:59 pm

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:
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>

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Thu Nov 04, 2004 2:01 am

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..


Return to “phpMyAdmin”

Who is online

Users browsing this forum: No registered users and 2 guests

cron