creating a create group and add users to group etc

hey im trying to make a code that allows a user to create a group, join it, leave it and simlar basics like that however im having some trying making the leave it part would be nice if someone can check my code and point out the error and send me on the right path ^^

[php]<?php // the login I have database connection in here as I don’t include the header in this case till after the php
session_start();
require(“config.php”);
require(“header.php”);
?>

<?php $db = mysql_connect($dbhost, $dbuser, $dbpassword); mysql_select_db($dbdatabase, $db); // this needs to work not sure what I did wrong "v" if($_POST['submit']) { $sql="INSERT INTO groups (idgroup, group_name) VALUES ('4','$_POST[name]')"; } ?>
Group Name

Or join a group:

<?php $sql = "SELECT * FROM groups ORDER BY idgroups ASC LIMIT 1,2";

$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
if(isset($_SESSION[‘USERNAME’]) == true) {

$name = $_SESSION[‘ID’]; //Need a way for this to know what name is logged on the withdraw function is just this reseting to 0 so when this works that will work as well.

echo "<a href=Group1.php?id= $name ";

}

$sql = “SELECT * FROM groups
ORDER BY idgroups ASC LIMIT 2,3”;

$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);

echo “

” . $row[‘group_name’] . “

”;

$sql = “SELECT * FROM groups
ORDER BY idgroups ASC LIMIT 3,4”;

$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);

echo “

” . $row[‘group_name’] . “

”;
?> <?php require("footer.php"); ?>[/php]

hello thagrimreaper,

if idgroup define as integer in database table than remove single quote from 4
see below code
$sql=“INSERT INTO groups (idgroup, group_name) VALUES (4,’$_POST[name]’)”;

you are missing to place semi colon see below line.

i hope this will helpful for you.
SR

Sponsor our Newsletter | Privacy Policy | Terms of Service