Tags:
php
jeg har denne kode:
<pre>
<?
mysql_connect("localhost","$brugernavn","$kode");
mysql_select_db("test");
if($sendz == "OK")
{
if($chkuz="#AutoPilot")
{
$query = mysql_query("select * from PCA where word2PCA like '%$mes'");
$number = mysql_num_rows($query);
echo ("Din søgning på: <b>$mes</b> gav $number resultat(er):<p>");
echo (mysql_error());
if ($number==0)
{
$mesg="I cant understand you please try again on the folowing language(s): English";
$Sesg=time();
$Userg="#AutoPilot";
$Pasg="#NON-*";
$Titleg="AutoPilot";
mysql_query("INSERT INTO chkcha (Msg,Ses,User,Pas,Title) VALUES ($mesg,$Sesg,$Userg,$Pasg,$Titleg)");
$query = mysql_query("select id,Msg,Ses,User,Title from chkcha order by Ses DESC LIMIT 0,8888");
$number = mysql_num_rows($query);
while($data = mysql_fetch_array($query)){
$Sa=$Sa & $data[$msg] & "\\n";
echo("textarea cols='50' rows='20' name='mes' wrap='physical'>$Sa</textarea><br><br>");
}
}
else
{
while ($r = mysql_fetch_array($query))
{
extract($r);
$mesg=$PCA2Uz;
$Sesg=time();
$Userg="#AutoPilot";
$Pasg="#NON-*";
$Titleg="AutoPilot";
mysql_query("insert into chkcha (Msg,Ses,User,Pas,Title) values ('$mesg','$Sesg','$Userg','$Pasg','$Titleg')");
$query = mysql_query("select * from chkcha order by Ses DESC LIMIT 0,8888");
$number = mysql_num_rows($query);
while($data = mysql_fetch_array($query)){
$Sa=$Sa & $data[$msg] & "\\n";
echo("textarea cols='50' rows='20' name='mes' wrap='physical'>$Sa</textarea><br><br>");
}
}
}
}
else
{
$mesg=$mes;
$Sesg=time();
$Userg=$Userh;
$Pasg=$UpasH;
$Titleg=$UtileH;
mysql_query("insert into chkcha (Msg,Ses,User,Pas,Title) values ('$mesg','$Sesg','$Userg','$Pasg','$Titleg')");
$query = mysql_query("select * from chkcha order by Ses DESC LIMIT 0,8888");
$number = mysql_num_rows($query);
while($data = mysql_fetch_array($foresp)){
$Sa=$Sa & $data[$msg] & "\\n";
echo("textarea cols='50' rows='20' name='mes' wrap='physical'>$Sa</textarea><br><br>");
}
}
}
else
{
$query = mysql_query("select id,Msg,Ses,User,Title from chkcha order by Ses DESC LIMIT 0,8888");
$number = mysql_num_rows($query);
while($data = mysql_fetch_array($query)){
$Sa=$Sa & $data[$Msg] & "\\n";
echo("textarea cols='50' rows='20' name='mes' wrap='physical'>$Sa</textarea><br><br>");
}
}
?>
<html>
<head>
<title>Nyt dokument</title>
<meta name="generator" content="TSW WebCoder">
</head>
<body>
<form name="PolComChat" method="POST" action="chk.php">
<input type="hidden" name="sendz" value="OK">
<input type="text" name="mes" size="50"><input type="submit" name="send" value="Send"><br><br>
<select name="chkuz" class="input"><p></p>
<?
mysql_connect("localhost","$brugernavn","$kode");
mysql_select_db("test");
$qry = mysql_query("select * from chkusers");
while ($row = mysql_fetch_array($qry)){
echo (mysql_error());
$id = $row["id"];
$chkus = $row["chkUserName"];
echo ("<option value=\\"$id\\">$chkus</option>");
echo (mysql_error());
}
?>
</select>
</form>
</body>
</html>
</pre>
hvorfor vil den ikke sætte et svar ind i databasen kun de tre første felter har værdien not null alle andre har null!
håber i kan hjælpe?
mvh.
Thomas Christensen
6 svar postet i denne tråd vises herunder
1 indlæg har modtaget i alt 1 karma
<quote>
<pre>
<?
mysql_connect("localhost","$brugernavn","$kode");
mysql_select_db("test");
if($sendz == "OK")
{
if($chkuz="#AutoPilot")
{
$query = mysql_query("select * from PCA where word2PCA like \\'%$mes\\'");
$number = mysql_num_rows($query);
echo ("Din søgning på: <b>$mes</b> gav $number resultat(er):<p>");
echo (mysql_error());
if ($number==0)
{
$mesg="I cant understand you please try again on the folowing language(s): English";
$Sesg=time();
$Userg="#AutoPilot";
$Pasg="#NON-*";
$Titleg="AutoPilot";
mysql_query("INSERT INTO chkcha (Msg,Ses,User,Pas,Title) VALUES ($mesg,$Sesg,$Userg,$Pasg,$Titleg)");
</pre>
</quote>
Den sidste linje mangler plinger (\\'\\') uden om dine stringvalues.. dvs, alle med indtagelse af $Sesg..
--
Med Venlig Hilsen
Lasse Hjorth
lasse@hjorth.tk
0
<quote>
<pre>
<?
mysql_connect("localhost","$brugernavn","$kode");
mysql_select_db("test");
if($sendz == "OK")
{
if($chkuz="#AutoPilot")
{
$query = mysql_query("select * from PCA where word2PCA like '%$mes'");
$number = mysql_num_rows($query);
echo ("Din søgning på: <b>$mes</b> gav $number resultat(er):<p>");
echo (mysql_error());
if ($number==0)
{
$mesg="I cant understand you please try again on the folowing language(s): English";
$Sesg=time();
$Userg="#AutoPilot";
$Pasg="#NON-*";
$Titleg="AutoPilot";
mysql_query("INSERT INTO chkcha (Msg,Ses,User,Pas,Title) VALUES ($mesg,$Sesg,$Userg,$Pasg,$Titleg)");
</quote>
Den sidste linje mangler plinger ('') uden om dine stringvalues.. dvs, alle med indtagelse af $Sesg..
--
Med Venlig Hilsen
Lasse Hjorth
lasse@hjorth.tk
0
<quote>
<pre>
<?
mysql_connect("localhost","$brugernavn","$kode");
mysql_select_db("test");
if($sendz == "OK")
{
if($chkuz="#AutoPilot")
{
$query = mysql_query("select * from PCA where word2PCA like '%$mes'");
$number = mysql_num_rows($query);
echo ("Din søgning på: <b>$mes</b> gav $number resultat(er):<p>");
echo (mysql_error());
if ($number==0)
{
$mesg="I cant understand you please try again on the folowing language(s): English";
$Sesg=time();
$Userg="#AutoPilot";
$Pasg="#NON-*";
$Titleg="AutoPilot";
mysql_query("INSERT INTO chkcha (Msg,Ses,User,Pas,Title) VALUES ($mesg,$Sesg,$Userg,$Pasg,$Titleg)");
</pre>
</quote>
Den sidste linje mangler plinger ('') uden om dine stringvalues.. dvs, alle med indtagelse af $Sesg..
--
Med Venlig Hilsen
Lasse Hjorth
lasse@hjorth.tk
0
<quote>
<pre>
<?
mysql_connect("localhost","$brugernavn","$kode");
mysql_select_db("test");
if($sendz == "OK")
{
if($chkuz="#AutoPilot")
{
$query = mysql_query("select * from PCA where word2PCA like '%$mes'");
$number = mysql_num_rows($query);
echo ("Din søgning på: <b>$mes</b> gav $number resultat(er):<p>");
echo (mysql_error());
if ($number==0)
{
$mesg="I cant understand you please try again on the folowing language(s): English";
$Sesg=time();
$Userg="#AutoPilot";
$Pasg="#NON-*";
$Titleg="AutoPilot";
mysql_query("INSERT INTO chkcha (Msg,Ses,User,Pas,Title) VALUES ($mesg,$Sesg,$Userg,$Pasg,$Titleg)");
</pre>
</quote>
Den sidste linje mangler plinger (\\'\\') uden om dine stringvalues.. dvs, alle med indtagelse af $Sesg..
--
Med Venlig Hilsen
Lasse Hjorth
lasse@hjorth.tk
0
her min kode
<html>
<body>
<pre>
while ($r = mysql_fetch_array($query))
{
extract($r);
$mesg=$PCA2Uz;
$Sesg=time();
$Userg="#AutoPilot";
$Pasg="#NON-*";
$Titleg="AutoPilot";
mysql_query("insert into chkcha (Msg,Ses,User,Pas,Title) values ('$mesg','$Sesg','$Userg','$Pasg','$Titleg')");
$query = mysql_query("select id,Msg,Ses,User,Title from chkcha order by Ses DESC LIMIT 0,8888");
$number = mysql_num_rows($query);
while($data = mysql_fetch_array($query)){
$Sa=$Sa & $data[1] & "\\n";
echo("<textarea cols='50' rows='20' name='mes' wrap='physical'>$Sa</textarea><br><br>");
</pre>
den udskriver 0 og ikke havd der står i databasen, hvorfor?
-Thomas
[Redigeret d. 12/03-02 19:16:24 af Thomas Christensen][Redigeret d. 12/03-02 19:17:32 af Thomas Christensen]
0
her min kode
<html>
<body>
<pre>
while ($r = mysql_fetch_array($query))
{
extract($r);
$mesg=$PCA2Uz;
$Sesg=time();
$Userg="#AutoPilot";
$Pasg="#NON-*";
$Titleg="AutoPilot";
mysql_query("insert into chkcha (Msg,Ses,User,Pas,Title) values ('$mesg','$Sesg','$Userg','$Pasg','$Titleg')");
$query = mysql_query("select id,Msg,Ses,User,Title from chkcha order by Ses DESC LIMIT 0,8888");
$number = mysql_num_rows($query);
while($data = mysql_fetch_array($query)){
$Sa=$Sa & $data[1] & "\\n";
echo("<textarea cols='50' rows='20' name='mes' wrap='physical'>$Sa</textarea><br><br>");
</pre>
den udskriver 0 og ikke havd der står i databasen, hvorfor?
-Thomas
[Redigeret d. 12/03-02 19:16:24 af Thomas Christensen][Redigeret d. 12/03-02 19:17:32 af Thomas Christensen]
ikke flere svar. tak