...

View Full Version : comment area



runnerjp
05-12-2008, 04:37 PM
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/runningp/public_html/members/include/box.php on line 25


<?php session_start();
// Sign the guestbook
require_once("../settings.php");
{
$id = $_SESSION['user_id'];

$get_username_value = get_username($id);

$username = $_GET['user'];
$from = $get_username_value;

$message = $_POST["message"];
$time = date("F j, Y, g:i a");
$query = "INSERT INTO guestbook(owner,postedby,post,time) VALUES('$username','$from','$message','$time')";
$db->query($query);
echo "Your message has been posted";



}

$owner = $get_username_value;
$query = $query = "SELECT * FROM guestbook WHERE owner='$get_username_value' ORDER BY ID DESC";
$result = $db->query($query);
while($grab = mysql_fetch_array($result))
{
echo "Posted by: <a href=\"member.php?id=".$grab["postedby"]."\">".$grab["postedby"]."</a> - ".$grab["time"]."<br/>".$grab["post"]."<br><br>";
}
echo "<center><br/><b>Sign $owner:s guestbook</b><br/>
<form action=\"member.php?sign=$owner&from=$get_username_value method='POST'>
<textarea name='message' rows='5' cols='30' align='left'>Your message</textarea><br/>
<input type='submit' value='Update' name='submit'>
</form>
</center>";

?>

basicly i cant undestand whats up with while($grab = mysql_fetch_array($result))
{
echo "Posted by: <a href=\"member.php?id=".$grab["postedby"]."\">".$grab["postedby"]."</a> - ".$grab["time"]."<br/>".$grab["post"]."<br><br>";
} to fetch all the results for the comment area


also if there is an easyer way of making a comment box for each profile im open to suggestions lol but this is the way iv thought about going about it

abduraooft
05-12-2008, 04:40 PM
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/runningp/public_html/members/include/box.php on line 25 Check your old threads to see the comments posted by other members on similar cases Or use google.

runnerjp
05-12-2008, 05:07 PM
hummm ok iv been thinkin ... if i got a normal shoutbox, how would i do it so each user has there own shoutbox?? asign each shoutbox with sum id in the db and call the id or something?>

TheShaner
05-12-2008, 05:15 PM
Runnerjp, you really need to go back to the basics and read up on lots of tutorials. You're really missing simple things here, and although we love to help, it's getting a little out of control.

Your code below:

$query = $query = "SELECT * FROM guestbook WHERE owner='$get_username_value' ORDER BY ID DESC";
$result = $db->query($query);
while($grab = mysql_fetch_array($result))
Problems:

That first line completely baffles me as to why you have that set up like you do. It should read:
$query = "SELECT * FROM guestbook WHERE owner='$get_username_value' ORDER BY ID DESC";
Your second line is using some query method from probably a cross-DB class. It's not a mysql_query() (http://php.net/mysql_query), thus it will not return a MySQL result resource.


If you are going to use this DB class you seem to be using, you cannot use PHP MySQL functions. However, if you want to use these PHP MySQL functions, then you must use the MySQL connect and query functions provided by PHP, i.e. mysql_connect() (http://php.net/mysql_connect) and mysql_query() (http://php.net/mysql_query), instead of $db->query().

-Shane

runnerjp
05-12-2008, 06:42 PM
ok atting at from scratch and i have got an error im not famillia with


<?php
session_start(); // starts sessions

$id = $_SESSION['user_id'];
$query = "SELECT * FROM guestbook WHERE id = '$id' LIMIT 1";
if ($result = mysql_query($query)){
if (mysql_num_rows($result)) {
$array = mysql_fetch_assoc($result);
$message = $array['message'];
}}



echo $message;


echo (" <form method='POST' action='?page=updatepost'>
<table width="523" border="0" align="center" cellpadding="0" cellspacing="2">
<tr><td width="150"><div align="right">
<label for="events">Message</label>
</div>
</td>
<td colspan="2"><textarea class="input" id="message" name="message" rows="4" cols="40">type your message here</textarea></td>
</tr>
<tr>
<td width="150"></td>
<td width="112"><input name="submitButtonName" type="submit" class="submit-btn" value=""></td>
<td width="253">&nbsp;</td>
</tr>
</table>
</form>");
case 'updatepost':
$id = $_POST['id'];
$message = $_POST['message'];
$update = "INSERT guestbook SET message='$message', id = '$id' WHERE id='$id' ";
$rsUpdate = mysql_query($update);
if ($rsUpdate)?>

unexpected T_LNUMBER on this line <table width="523" border="0" align="center" cellpadding="0" cellspacing="2">

TheShaner
05-12-2008, 07:44 PM
See, you're running into the same problems that I helped you with previously. You're not learning anything we're telling you.

You are using double quotes in your HTML inside an echo that was started with double quotes. Instead of echoing all that HTML, just end your PHP before it and then start it back up when you need to.

Like this:

<?php
session_start(); // starts sessions

$id = $_SESSION['user_id'];
$query = "SELECT * FROM guestbook WHERE id = '$id' LIMIT 1";
if ($result = mysql_query($query)){
if (mysql_num_rows($result)) {
$array = mysql_fetch_assoc($result);
$message = $array['message'];
}}

echo $message;
?>
<form method='POST' action='?page=updatepost'>
<table width="523" border="0" align="center" cellpadding="0" cellspacing="2">
<tr><td width="150"><div align="right">
<label for="events">Message</label>
</div>
</td>
<td colspan="2"><textarea class="input" id="message" name="message" rows="4" cols="40">type your message here</textarea></td>
</tr>
<tr>
<td width="150"></td>
<td width="112"><input name="submitButtonName" type="submit" class="submit-btn" value=""></td>
<td width="253">&nbsp;</td>
</tr>
</table>
</form>
<?php
case 'updatepost':
$id = $_POST['id'];
$message = $_POST['message'];
$update = "INSERT guestbook SET message='$message', id = '$id' WHERE id='$id' ";
$rsUpdate = mysql_query($update);
if ($rsUpdate)?>
As much as I didn't want to look at your code, I just can't help notice that there are many more errors in it.


Your form doesn't even have an input that has name="id", so the line $id = $_POST['id] isn't going to retrieve anything. On top of that, you store the user_id from the session into $id, so there's no reason for this code anyway.
Your update query needs UPDATE and not INSERT.
In this post, you're actually using mysql_query(), where before, you were using $db->query. Which one is it?
And last, you have a random case statement without the start of a switch statement.


Seriously, you need to start going through tutorials on your own and learn much more before posting another 50 questions that all end up with similar errors.

-Shane

runnerjp
05-13-2008, 08:52 AM
humm i dont think im using my switch statement properly


<?php
session_start(); // starts sessions

$id = $_SESSION['user_id'];
$query = "SELECT * FROM guestbook WHERE id = '$id' LIMIT 1";
if ($result = mysql_query($query)){
if (mysql_num_rows($result)) {
$array = mysql_fetch_assoc($result);
$message = $array['message'];




echo $message;

{switch($_GET[page])}
default:
echo (' <form method="POST" action="?page=updatepost">
<table width="523" border="0" align="center" cellpadding="0" cellspacing="2">
<tr><td width="150"><div align="right">
<label for="events">Message</label>
</div>
</td>
<td colspan="2"><textarea class="input" id="message" name="message" rows="4" cols="40">type your message here</textarea></td>
</tr>
<tr>
<td width="150"></td>
<td width="112"><input name="submitButtonName" type="submit" class="submit-btn" value=""></td>
<td width="253">&nbsp;</td>
</tr>
</table>
</form>');

case 'updatepost':
$id = $_POST['id'];
$message = $_POST['message'];
$update = "INSERT guestbook SET message='$message', id = '$id' WHERE id='$id' ";
$rsUpdate = mysql_query($update);
if ($rsUpdate)}}?>

also im missing some {} out sum where but for the life of me can see where abouts

abduraooft
05-13-2008, 09:15 AM
humm i dont think im using my switch statement properly


also im missing some {} out sum where but for the life of me can see where abouts
Then read http://in2.php.net/switch to get the proper syntax.

runnerjp
05-13-2008, 09:25 AM
do i even need to use switch in this case as all i need to do is post the data once forms submitted

TheShaner
05-13-2008, 03:28 PM
RunnerJP, stop coding. Start reading. Please. You have brackets ALL over the place for no reason. Your code looks like a word scramble where you seem to have the right letters, but they're all in the wrong places. The below code will fix all your errors you're having hopefully, but this is the last time I do this.

<?php
session_start(); // starts sessions

$user_id = $_SESSION['user_id'];

if (isset($_POST['update _submit']))
{
$post_id = intval($_POST['post_id']);
$message = $_POST['message'];
$update = "UPDATE guestbook SET message = '".mysql_real_escape_string($message)."' WHERE id = $post_id ";
$rsUpdate = mysql_query($update);
}

$query = "SELECT * FROM guestbook WHERE id = '$user_id' LIMIT 1";
if ($result = mysql_query($query))
{
while($row = mysql_fetch_assoc($result))
{
$post_id = $row['id'];
$message = $row['message'];
}
}
?>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table width="523" border="0" align="center" cellpadding="0" cellspacing="2">
<input type="hidden" name="update _submit" value="1" />
<input type="hidden" name="post_id" value="<? if(isset($post_id)) echo $post_id; ?>" />
<tr><td width="150"><div align="right">
<label for="events">Message</label>
</div>
</td>
<td colspan="2"><textarea class="input" id="message" name="message" rows="4" cols="40">
<?php
if(isset($message))
{
echo $message;
}
else
{
echo "Type your message here";
}
?>
</textarea></td>
</tr>
<tr>
<td width="150"></td>
<td width="112"><input name="submitButtonName" type="submit" class="submit-btn" value=""></td>
<td width="253">&nbsp;</td>
</tr>
</table>
</form>
I tried my best, but you have a lot of stuff still missing, like the difference between the user's ID and post's ID and how it should be pulling the info. I also took a guess on where things should appear and how the page should work. Like I said above, please just stop coding for now and read some PHP tutorials. You need to wrap your head around the basic concepts before attempting a website like this.

-Shane

RMcLeod
05-13-2008, 03:56 PM
If you are stuck with the best place to start really learning PHP and MySQL I can really recommend this book.

Beginning PHP and MySQL (http://www.amazon.co.uk/Beginning-PHP-MySQL-Novice-Professional/dp/1590598628/ref=sr_1_3?ie=UTF8&s=books&qid=1210686649&sr=8-3)

It will be well worth the money, whilst learning by jumping straight in can work, a book can teach you things like best practices, coding standards etc. Which just can not be self taught.

aedrin
05-13-2008, 04:02 PM
The below code will fix all your errors you're having hopefully, but this is the last time I do this.

Someone else will again.

That is the problem with some of the helping going on here. It's more like spoonfeeding.

I've suggested to several people before that they should start reading a book or taking a class. But they always come back with the same problems having learned nothing.

runnerjp
05-13-2008, 09:51 PM
ok i have progressed alot so far ... yes guys the books on its way but i have got some where with this now and its an error thats not small like synthax or anything

but for some reaosn my code will not add the users username.. it leaves the field blank

Code:


<html>
<head>
<title>Shoutbox!</title>
<style type="text/css">
<!--
.message {
color: #000000;
font-family: Verdana;
font-size: 10px;}

.username {
color: #FF9900
font-family: Verdana;
font-size: 10px;
font-weight: bold}

.date {
color: #707070;
font-family: Verdana;
font-size: 9px;}

.forms {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10 px;
color: #6CA05A;
text-decoration: none;
background-color: #CCCCCC;
border-color: #6CA05A;
border-style: solid;
border: 1px}

.submit {
background-color: #CCCCCC;
border-color: #6CA05A;
color: #2A343C;
font-family: Verdana;
font-size: 10px;
border-style: solid;
border 1 px;}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="padding: 2px">
<?php

// If submitted
if($_POST['submit']) {

// Verify if the fields were filled.
if(!$_POST['message']) {
echo 'Error, You need to post a Message!';
die;
}

// Date format
$date = date("d/m/y"); // http://www.php.net/date

// Assign variables of the forms

$id = $_SESSION['user_id'];
$username = $id;
$message = $_POST['message'];
$ip = $_SERVER['REMOTE_ADDR'];

// Connect to the database
include('../../settings.php');

// Insert the info in the shoutbox table.
$query = "INSERT INTO shoutbox ( username, message, date, ip)
VALUES ('$username','$message','$date','$ip')";
mysql_query($query);
// close connection


// Show message to let them return to the shoutbox
?>
<div align="center">Thank you for submitting.<br>
Return to the <a href="shoutbox.php">shoutbox</a>!
<?php
// If NOT submitted
} else {




$query = "SELECT * FROM shoutbox ORDER BY id DESC LIMIT 10";
$result = mysql_query($query);
// Create a table
?>

<table width="100%" cellpadding="0" cellspacing="0" border="0">

<?
// Run a While loop for the rows
while($c = mysql_fetch_array($result))
{
?>
<tr>
<td>
<? echo $c[author] ?></a> says:
<div align="justify"><? echo $c[message] ?></div>
</td>
</tr>
<tr><td>on <? echo $c[date] ?>
<hr noshade="noshade" size="1" style="border-style: dashed" color="#000000" /></td></tr>
<? } ?>

</table>

<form method="post" action="box.php">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Message :</td>
<td><input type="text" name="message" class="forms"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Speak!" class="subtmit"></td>
</tr>
</table>
</form>

<?php } ?>

</body>
</html>


also i was wondering.. whats th best way to go now with assigning each user their own chatbox ??

so on profile 1 it has chatbox 1 come up
on profile 2 it has chatbox 2 ect ect

runnerjp
05-14-2008, 12:35 AM
ok i have found the problem... but i dont understand why its not working


<? $id = $_SESSION['user_id'];
$username = get_username($id);

$message = $_POST['message'];
$ip = $_SERVER['REMOTE_ADDR'];



// Insert the info in the shoutbox table.
$query = "INSERT INTO shoutbox ( username, message, date, ip)
VALUES ('$username','$message','$date','$ip')";
mysql_query($query);?>

its inserting the message date and ip... but not the username...

if there something wrong with the way i have done $username = get_username($id);

runnerjp
05-14-2008, 12:37 AM
:O:O omg iv just relised....session_start();

runnerjp
05-14-2008, 01:04 AM
sorry jumped forward again but now 100% stuck in a rut lol

sorry i had to re open because i found anouther little thing....


include('../../settings.php');
$id = $_SESSION['user_id'];
$username = get_username($id);
$user = $_GET['user'];
$message = $_POST['message'];
$ip = $_SERVER['REMOTE_ADDR'];



// Insert the info in the shoutbox table.
$query = "INSERT INTO shoutbox ( user, username, message, date, ip)
VALUES ('{$_GET[user]}','$username','$message','$date','$ip')"or die(mysql_error());
mysql_query($query);

ok so im using $_GET['user']; to get the username out of the url soo members/bob
i have used it before to set friends to be friends,,, but it does not seem to be working in this case ??

here is my htaccess to show you that user is in there...

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([^/.]+)/?$ members/index.php?page=profile&username=$1

TheShaner
05-14-2008, 04:15 AM
Try putting quotes around 'user' in your query.

runnerjp
05-14-2008, 11:41 AM
ok i have fround the problem is not it inputting the data into the table but by not getting the users name from the url....

is there any reason this si not working as i have used this part of the script before to get user users name from the url ??

runnerjp
05-14-2008, 11:47 AM
i have tried both $_GET['username'] and $_GET['user']... in my firends script i used this and it worked
<?php
session_start();

include "../settings.php";

if ( !empty($_GET['user']) ) {
if ( ctype_alnum($_GET['user']) && strlen($_GET['user']) <= 10 ) {
// further test and escape data
}
$username =($_GET['user']);
$id = $_SESSION['user_id'];

$get_username_value = get_username($id);
$query = "INSERT INTO friend_requests (username ,by_user) VALUES('{$_GET[user]}', '$get_username_value')";
$result= mysql_query($query)
or die("QUERY ERROR:<br />{$query}<br />" . mysql_error() );

echo "$username has been sent a request you must now wait for it to be accepted";
// useful in troubleshooting the SQL statement


} else {
echo "No request was made";
}
?>

but why its not working in my other script i dont know :S

runnerjp
05-14-2008, 02:52 PM
ok something not right is happening lol... when i run <? $user = $_GET['username'];
echo $user;?>
on its own it displays the users name on url

BUT when i do this


<?php session_start();?>
<style type="text/css">
<!--
.message {
color: #000000;
font-family: Verdana;
font-size: 10px;}

.username {
color: #FF9900
font-family: Verdana;
font-size: 10px;
font-weight: bold}

.date {
color: #707070;
font-family: Verdana;
font-size: 9px;}

.forms {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10 px;
color: #6CA05A;
text-decoration: none;
background-color: #CCCCCC;
border-color: #6CA05A;
border-style: solid;
border: 1px}

.submit {
background-color: #CCCCCC;
border-color: #6CA05A;
color: #2A343C;
font-family: Verdana;
font-size: 10px;
border-style: solid;
border 1 px;}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="padding: 2px">
<?php

// If submitted
if($_POST['submit']) {

// Verify if the fields were filled.
if(!$_POST['message']) {
echo 'Error, You need to post a Message!';
die;
}

// Date format

$date = date("d/m/y"); // http://www.php.net/date

// Assign variables of the forms
// Connect to the database
include('../../settings.php');
$id = $_SESSION['user_id'];
$username = get_username($id);
$user = $_GET['username'];
$message = $_POST['message'];
$ip = $_SERVER['REMOTE_ADDR'];





// Insert the info in the shoutbox table.
$query = "INSERT INTO shoutbox (`user`, username, message, date, ip)
VALUES ('$user','$username','$message','$date','$ip')"or die(mysql_error());
mysql_query($query);
// close connection


// Show message to let them return to the shoutbox
?>
<div align="center">Thank you for submitting.<br>
Return to the <a href="shoutbox.php">shoutbox</a>!
<?php
// If NOT submitted
} else {




$query = "SELECT * FROM shoutbox ORDER BY id DESC LIMIT 10";
$result = mysql_query($query);
// Create a table
?>

<table width="100%" cellpadding="0" cellspacing="0" border="0">

<?
// Run a While loop for the rows
while($c = mysql_fetch_array($result))
{
?>
<tr>
<td>
<? echo $c[username] ?> says:
<div align="justify"><? echo $c[message] ?></div>
</td>
</tr>
<tr><td>on <? echo $c[date] ?>
<hr noshade="noshade" size="1" style="border-style: dashed" color="#000000" /></td></tr>
<? } ?>

</table>

<form method="post" action="box.php">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Message :</td>
<td><input type="text" name="message" class="forms"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Speak!" class="subtmit"></td>
</tr>
</table>
</form>

<?php } ?>

</body>
</html> it does not display the username within the url :S even if i echo $user... strange

aedrin
05-14-2008, 05:52 PM
When posting code, please only post the relevant code.

You are wasting everyone's time by just pasting your entire script. If you don't want to put in a little effort, why should we?

You really need to learn some more basic PHP, this is incorrect code:



echo $c[username]

The username part should be enclosed in single quotes. Check your server's error log and you should see why.



$query = "INSERT INTO shoutbox (`user`, username, message, date, ip)
VALUES ('$user','$username','$message','$date','$ip')"or die(mysql_error());

Pick up any PHP/MySQL book (as you have been told many times) and you will see instantly that the code is wrong. The or die() feature of PHP should be attached to the mysql_query() line. It doesn't even make sense to use it the way you do.


it does not display the username within the url

What URL? $user is only used once (within the query).

Fix the obvious stuff first. Then worry about functionality.

runnerjp
05-14-2008, 06:10 PM
lol but echo $c[username] returns the username from the table so does echo $c[message]

also chnaged my code of query to
$query = "INSERT INTO shoutbox (`user`, username, message, date, ip)
VALUES ('$user','$username','$message','$date','$ip')";
$result= mysql_query($query)
or die("QUERY ERROR:<br />{$query}<br />" . mysql_error() );
mysql_query($query); but getting no error report

my url is done by htaccess
RewriteRule ^([^/.]+)/?$ members/index.php?page=profile&username=$1 so by using
$user = $_GET['username']; it should assign the $user with the username in the link... but it does not within this code... unless i do it on its own on a blank page where it does :S

abduraooft
05-14-2008, 06:20 PM
Sorry, off topic, but what's/why this lol here, allover the page?

runnerjp
05-14-2008, 06:24 PM
laughing out loud... thought it adds some friendlyness to the talk :P

abduraooft
05-14-2008, 06:29 PM
laughing out loud... thought it adds some friendlyness to the talk :P
LOL :D

runnerjp
05-14-2008, 07:37 PM
haha see much better :P but really back to my case... how can i solve it.. im stumped

runnerjp
05-14-2008, 07:51 PM
ok above if($_POST['submit']) i can crap the name via $_GET['username'] but anything below then i cannot echo it...how comes??
<?php
$user = isset($_GET['username'])? $_GET['username'] : "";
//echo $user; this displays the user name but anything below it does not
if($_POST['submit']) {

// Verify if the fields were filled.
if(!$_POST['message']) {
echo 'Error, You need to post a Message!';
die;
}

// Date format

$date = date("d/m/y"); // http://www.php.net/date

// Assign variables of the forms
// Connect to the database

include('../settings.php');

$id = $_SESSION['user_id'];
$username = get_username($id);
$message = $_POST['message'];
$ip = $_SERVER['REMOTE_ADDR'];





// Insert the info in the shoutbox table.
$query = "INSERT INTO shoutbox (`user`, username, message, date, ip)
VALUES ('$user','$username','$message','$date','$ip')";
$result= mysql_query($query)
or die("QUERY ERROR:<br />{$query}<br />" . mysql_error() );
mysql_query($query);
// close connection


// Show message to let them return to the shoutbox
?>

aedrin
05-14-2008, 08:00 PM
other wise i will never learn

You have already shown that even with multiple explanations/links/examples, you still do not learn.

runnerjp
05-14-2008, 08:07 PM
You have already shown that even with multiple explanations/links/examples, you still do not learn.

but i must be learning or i would be still doing <? echo 'hello world'; ?> surly that im figuring out whats areas are wrong in my code is also a start... i asked whats the best way of learning and i keep geting told by doing... yes i still makes sum errors over and over but it takes time to buffer them out surly?


but still my problem is still unfixed and im still confused at why its wrong

runnerjp
05-14-2008, 09:30 PM
ok i have been thinkin... should my post look something liek this
<form method="post" action="box.php?$user=<?php $_GET['username'] ?> ">

runnerjp
05-14-2008, 11:16 PM
ok i tried it and it will not display the user name at al i dont get whats going on so for 1 last attempt lol im going to fully expalin whats going on

ok above if($_POST['submit']) i can grab the name via $_GET['username'] but anything below then i cannot echo it...how comes??
PHP Code:

get username gets the name of the profile form the url due to this


RewriteRule ^([^/.]+)/?$ members/index.php?page=profile&username=$1

<?php session_start();



?>
<?php
$user = isset($_GET['username'])? $_GET['username'] : "";
//echo $user; this displays the user name but anything below it does not
if($_POST['submit']) {

// Verify if the fields were filled.
if(!$_POST['message']) {
echo 'Error, You need to post a Message!';
die;
}

// Date format

$date = date("d/m/y"); // http://www.php.net/date

// Assign variables of the forms
// Connect to the database

include('../settings.php');
$user1 = $_POST['usersaccount'];
$id = $_SESSION['user_id'];
$username = get_username($id);
$message = $_POST['message'];
$ip = $_SERVER['REMOTE_ADDR'];





// Insert the info in the shoutbox table.
$query = "INSERT INTO shoutbox (`user`, username, message, date, ip)
VALUES ('$user1','$username','$message','$date','$ip')";
mysql_query($query);
// close connection


// Show message to let them return to the shoutbox
?>
<div align="center">Thank you for submitting.<br>
Return to the <a href="shoutbox.php">shoutbox</a>!
<?php
// If NOT submitted
} else {




$query = "SELECT * FROM shoutbox ORDER BY id DESC LIMIT 3";
$result = mysql_query($query);
// Create a table
?>

<table width="100%" cellpadding="0" cellspacing="0" border="0">

<?
// Run a While loop for the rows
while($c = mysql_fetch_array($result))
{
?>
<tr>
<td>
<? echo $c[username] ?> says:
<div align="justify"><? echo $c[message] ?></div>
</td>
</tr>
<tr><td>on <? echo $c[date] ?>
<hr noshade="noshade" size="1" style="border-style: dashed" color="#000000" /></td></tr>
<? } ?>

</table>

<form method="post" action="box.php">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Message :</td>
<td><input type="text" name="message" class="forms"><input type="hidden" id="usersaccount" name="usersaccount" value="<?php $user ;?>" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Speak!" class="subtmit"></td>
</tr>
</table>
</form>

<?php } ?>

</body>
</html> is it because i need to do somethingwith action="box.php" .... this page is actually box.php itself so allits really doing is sending it back to this page....

the page i have included this script on has the name in the url... if i went to just mywebsite.com/box.php it would look like that so i included it on http://www.mywebsite.com/username i thought i best tell you all this as it might be very improtant lol

runnerjp
05-15-2008, 10:07 AM
btw i have tried
<form method="post" action="box.php?$user="<?php echo $_GET['username']; ?>> and this also will not acho the username but out of the script it will :S

aedrin
05-15-2008, 03:53 PM
yes i still makes sum errors over and over but it takes time to buffer them out surly?

Yes, one does not instantly learn a new thing.

However, all the mistakes you are making are even below newbie mistakes. And they are covered by the PHP manual and any PHP book out there.

You are not educating yourself. You are just trying things and waiting for someone to either do it for you, or to figure it out for you.

It will never amount to anything unless you start learning. Because that is what programming is.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum