Hello guys
Its afternoon this side of Africa.
I have a school project where a user register and they earns points. When the points are 10, the first user is either deleted from the database and/or retained in the system, either way the second person gets their points... and the list goes on.
here's what i've done.

<html>
<head>
<title>insert</title>
</head>
<body>
<?php
include "config.php";

global $Names,$Counter;
$selected_id = addslashes('$id');
$new_name = addslashes('$Names');
$new_counter = addslashes('$Counter');
//inserting into the memberchild and the members tables repectively.
$mcquery = "insert into memberchild(Counter) values ('$Counter')";

$user_id = mysql_insert_id($conn);
$mquery = "insert into members(id,Names) values('$user_id', '$Names')";
$m_query = mysql_query($mquery);
$mc_query = mysql_query($mcquery);

//update points at the members table
$upoints = mysql_query("UPDATE members SET MPoints = MPoints+1 where id =".$m_query);
//record number
$query = "select names, mpoints from members";
$result = mysql_query($query);
$recordcount = mysql_num_rows($result);
echo "There are $recordcount record(s)";


?>
</body>
</html>


the problem lies in the members table where only the first row is incremented, I would like to see something like ,
name: points
omesa: 2
clement: 1
ongera: 0
on the same table, after the record(s) have been inserted.
I use the Names field only for inserting the record(s).
For further clarification, I can provide more information.
Thanks alot
Any help will be appreciated.

Didn't you post this before? How far have you gotten with the assignment and what are you having touble with?

Please put your code in [ code ] and [ /code ] tags. It makes things so much easier to read, especially for multiple files.

I solved my earlier problem, thanks for asking. As for the codes, let me do that now.

Hello guys
Its afternoon this side of Africa.
I have a school project where a user register and they earns points. When the points are 10, the first user is either deleted from the database and/or retained in the system, either way the second person gets their points... and the list goes on.
here's what i've done.

<html>
<head>
<title>insert</title>
</head>
<body>
<?php
include "config.php";
 
global $Names,$Counter;
$selected_id = addslashes('$id');
$new_name = addslashes('$Names');
$new_counter = addslashes('$Counter');
//inserting into the memberchild and the members tables repectively.
$mcquery = "insert into memberchild(Counter) values ('$Counter')";
 
$user_id = mysql_insert_id($conn);
$mquery = "insert into members(id,Names) values('$user_id', '$Names')";
$m_query = mysql_query($mquery);
$mc_query = mysql_query($mcquery);
 
//update points at the members table
$upoints = mysql_query("UPDATE members SET MPoints = MPoints+1 where id =".$m_query);
//record number
$query = "select names, mpoints from members";
$result = mysql_query($query);
$recordcount = mysql_num_rows($result);
echo "There are $recordcount record(s)";
 
 
?>
</body>
</html>

the problem lies in the members table where only the first row is incremented, I would like to see something like ,
name: points
omesa: 2
clement: 1
ongera: 0
on the same table, after the record(s) have been inserted.
I use the Names field only for inserting the record(s).
For further clarification, I can provide more information.
Thanks alot
Have I done the bset with the <code></code> thing?
Any help will be appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.