Jump to content

[SOLVED] way to work around code


contra10

Recommended Posts

is there a way to work around this code

	<?php
mysql_connect("localhost", "root", "") or die(mysql_error()); 
mysql_select_db("registration") or die(mysql_error()); 

if (isset($_POST['submit'])){

if(is_numeric($_POST['grp'])){
$id = $_POST['grp'];

$query= "SELECT * FROM groups WHERE id = $id";
$result = mysql_query($query) or die(mysql_error());;
$group = mysql_fetch_assoc($result);
$groupname = $group['name'];

$insert = "INSERT INTO groups (user) VALUES ('$username') WHERE name = '$groupname'";

$add_group = mysql_query($insert) or die(mysql_error());   
}
else {
echo $_POST['grp'] . ": Is not numeric...";
}
   
?>

I need to upload information in a specific area but i can't user the where function

Link to comment
Share on other sites

sry

 

k I want to input into a row of one of my tables a value but in a specific row...a row is created before and I want to know if there is a way to upload into that same row a new variable without using the UPDATE syntax

 

<?php

$insert = "INSERT INTO groups (user) VALUES ('$username') WHERE name = '$groupname'";
?>

 

like i want the username to be uploaded in a specific row

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.