# Inserting data into a specific row of a mySql Database using PHP

**URL:** <https://forum.kirupa.com/t/inserting-data-into-a-specific-row-of-a-mysql-database-using-php/185836>\
**Category:** programming\
**Created:** [April 17, 2006, 12:18am UTC](https://forum.kirupa.com/t/inserting-data-into-a-specific-row-of-a-mysql-database-using-php/185836 "2006-04-17T00:18:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![devinstar](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@devinstar](https://forum.kirupa.com/u/devinstar)\
**Post date:** [April 17, 2006, 12:18am UTC](https://forum.kirupa.com/t/inserting-data-into-a-specific-row-of-a-mysql-database-using-php/185836/1 "2006-04-17T00:18:49Z")

</div>

Hi,

I want to send a username from flash to a php file, which then finds the row with that username and then inserts a data value into a column of that row.

How do I do this.

This is what I have so far, but it is not working!

\<?php

//this line connects to the database  
include\_once(“connectDB.php”);

$username = $\_GET[“username”];  
$currcell = $\_GET[“currcell”];

$query = “SELECT \* FROM table WHERE username = ‘$username’”;  
$result = mysql\_query($query);

$num\_rows = mysql\_num\_rows($result);

while($row = mysql\_fetch\_array($result))  
{

mysql\_query (“INSERT INTO users($row[7]) VALUES (’$currcell’)”) or die(mysql\_error()); ;

}  
echo “info=done”;  
?\>

Thanks!

---

<div class="post-metadata">

**Author:** ![devinstar](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@devinstar](https://forum.kirupa.com/u/devinstar)\
**Post date:** [April 17, 2006, 12:26am UTC](https://forum.kirupa.com/t/inserting-data-into-a-specific-row-of-a-mysql-database-using-php/185836/2 "2006-04-17T00:26:53Z")

</div>

to slow!

This is it solved:

$username = $\_GET[“username”];  
$currcell = $\_GET[“currcell”];

mysql\_query(“UPDATE users SET cellid=$currcell WHERE username=’$username’”);

---

<div class="post-metadata">

**Author:** ![mathew\_er](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mathew\_er](https://forum.kirupa.com/u/mathew_er)\
**Post date:** [April 17, 2006, 12:30am UTC](https://forum.kirupa.com/t/inserting-data-into-a-specific-row-of-a-mysql-database-using-php/185836/3 "2006-04-17T00:30:46Z")

</div>

UPDATE users SET val1 = ‘$val1’, val2 = ‘$val2’ WHERE username = ‘$username’

---

<div class="post-metadata">

**Author:** ![Ankou](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ankou/32/1351_2.png) [@Ankou](https://forum.kirupa.com/u/Ankou)\
**Post date:** [April 17, 2006, 5:11am UTC](https://forum.kirupa.com/t/inserting-data-into-a-specific-row-of-a-mysql-database-using-php/185836/4 "2006-04-17T05:11:38Z")

</div>

> [@devinstar](#):
>
> to slow!

8 minutes between posts… Either we’re too slow to answer or your to quick to post. 😏
