TheOne(AKA:T1)
02-03-2006, 05:12 PM
Ok, I'll start by saying: "Hello"
Ok, here is my dilema:
I'm making kind of a ShoutBox, it is more like a chat, but what-so-ever.
So, I have to first put the text writen in the database.
I made that when U submited, it goes to this code:
(I'm from Argentina, so don't warry about the "Variable"'s names)
<?
$user="XXXXXXXX";
$password="XXXXXXXXX";
$database="XXXXXX";
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "No se pudo hacer la coneccion");
$query="SELECT * FROM Omega";
$result=mysql_query($query);
$Usuario=$_POST['user'];
$Texto=$_POST['txt'];
$Acciones=$_POST['acciones'];
$Hora=$_POST['Tempo'];
$query = "INSERT INTO Omega VALUES ('$Usuario','$Texto','$Acciones','$Hora')";
mysql_query($query);
mysql_close();
?>
Then, I have to show it, I made this:
(This goes on the <Body>)
<?
$user="XXXXXXXX";
$password="XXXXXXXXX";
$database="XXXXXX";
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "No se pudo hacer la coneccion");
$query="SELECT * FROM Omega";
$result=mysql_query($query);
$i=0;
$num=mysql_numrows($result);
while ($i < $num) {
$U=mysql_result($result,$i,"Usuario");
$T=mysql_result($result,$i,"Texto");
$H=mysql_result($result,$i,"Hora");
if(mysql_result($result,$i,"Acciones")!="")
{
$A=mysql_result($result,$i,"Acciones");
?>
<script>
if(<? echo $A ?>.slice(0,<? echo $A ?>.indexOf("|"))= TuNombre || "Todos") {
eval(<? echo $A ?>);
}
</script>
<?
} else {
?>
<script>
document.write(<? echo "$U [ $H ]:<br>$T<br>"; ?>
</script>
<?
}
$i++;
}
mysql_close();
?>
Could any one help me :confused:
I woul be verry gratefull
Ok, here is my dilema:
I'm making kind of a ShoutBox, it is more like a chat, but what-so-ever.
So, I have to first put the text writen in the database.
I made that when U submited, it goes to this code:
(I'm from Argentina, so don't warry about the "Variable"'s names)
<?
$user="XXXXXXXX";
$password="XXXXXXXXX";
$database="XXXXXX";
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "No se pudo hacer la coneccion");
$query="SELECT * FROM Omega";
$result=mysql_query($query);
$Usuario=$_POST['user'];
$Texto=$_POST['txt'];
$Acciones=$_POST['acciones'];
$Hora=$_POST['Tempo'];
$query = "INSERT INTO Omega VALUES ('$Usuario','$Texto','$Acciones','$Hora')";
mysql_query($query);
mysql_close();
?>
Then, I have to show it, I made this:
(This goes on the <Body>)
<?
$user="XXXXXXXX";
$password="XXXXXXXXX";
$database="XXXXXX";
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "No se pudo hacer la coneccion");
$query="SELECT * FROM Omega";
$result=mysql_query($query);
$i=0;
$num=mysql_numrows($result);
while ($i < $num) {
$U=mysql_result($result,$i,"Usuario");
$T=mysql_result($result,$i,"Texto");
$H=mysql_result($result,$i,"Hora");
if(mysql_result($result,$i,"Acciones")!="")
{
$A=mysql_result($result,$i,"Acciones");
?>
<script>
if(<? echo $A ?>.slice(0,<? echo $A ?>.indexOf("|"))= TuNombre || "Todos") {
eval(<? echo $A ?>);
}
</script>
<?
} else {
?>
<script>
document.write(<? echo "$U [ $H ]:<br>$T<br>"; ?>
</script>
<?
}
$i++;
}
mysql_close();
?>
Could any one help me :confused:
I woul be verry gratefull