jvaska
10-14-2002, 12:43 AM
hmmm...is this wrong? why won't this work...any fast ideas?
<?
mysql_connect("localhost","vvvvvvv","vvvvvv");
mysql_select_db("vvvvvvv");
$query = mysql_query("SELECT * FROM content,response where response.a=content.blog and blog='$blog' " ) or die ("Unexpected error for MySQL database [1b]");
$row = mysql_fetch_array($query);
if ($submit){
mysql_query("insert into response (name,email,website,date,comments) values ('$name','$email','$website','$date','$comments')") or die ("ciao");
?>
and further down i have a simple form that inserts into the response table...but...am i not allowed to do it this way? it was working fine until i inserted the "submit" part of things...
thanks for any advice...jv
mordred
10-14-2002, 01:48 AM
What errors do you get, and what errors are reported by mysql_error()? Does $submit default to a boolean true? Without knowing these parts we can only guess what went wrong in your script.
jvaska
10-14-2002, 12:43 PM
this is what i have so far...it's a mish mash of things from the past...the page in question opens properly...but when i try to submit the data is not inserted...
<?
mysql_connect("localhost","vvvvvvv","vvvvvv");
mysql_select_db("vvvvv");
$query = mysql_query("SELECT * FROM content,response where response.a=content.blog and blog='$blog' " ) or die ("Unexpected error for MySQL database [1b]");
$row = mysql_fetch_array($query);
if(isset($response)){
$mysql_link = mysql_connect("localhost","vvvvvvv","vvvvvv");
mysql_select_db("vvvvv", $mysql_link);
$name=addslashes($name);
$email=addslashes($email);
$website=addslashes($website);
$date=addslashes($date);
$a=addslashes($a);
$comments=addslashes($comments);
$query="Insert into review (name, email, website, comments, date, a ) ";
$query.="VALUES ('$name','$email','$website','$comments','$date','$a' ) ";
$mysql_result=mysql_query($query,$mysql_link);
$err=mysql_errno($mysql_link);
mysql_close($mysql_link);
}
?>
this is what i'm using for the form itself further down the page...with no luck...
<?php
{
echo "<FORM Action=\"index6.php\" Method=\"POST\">\n";
echo "<BR>Author Title <INPUT TYPE=TEXT NAME=name SIZE=30 MAXLENGTH=30>\n";
echo "<BR>Author Email <INPUT TYPE=TEXT NAME=email SIZE=40 MAXLENGTH=40>\n";
echo "<BR>Author Email <INPUT TYPE=TEXT NAME=website SIZE=40 MAXLENGTH=40>\n";
echo "<BR>Author Email <INPUT TYPE=TEXT NAME=date SIZE=40 MAXLENGTH=40>\n";
echo "<BR>Author Email <INPUT TYPE=TEXT NAME=a SIZE=40 MAXLENGTH=40>\n";
echo "<BR>Author Email <TEXTAREA NAME=comments cols=40 rows=8 WRAP=soft></textarea>\n";
echo "<BR><INPUT TYPE=submit NAME=Add Article VALUE=Add Article>\n";
echo "</FORM>\n";
}
?>
thanks...jv
mordred
10-14-2002, 03:43 PM
I can only repeat myself, what message do you get when you echo mysql_error() after the query that does not work? From what I see in your code you assign the error number to a variable, but neither do you have mysql_error in use nor do you echo the error number.