# Can I convert a PHP variable to an array for SQL db?

**URL:** <https://forum.kirupa.com/t/can-i-convert-a-php-variable-to-an-array-for-sql-db/239421>\
**Category:** programming\
**Created:** [September 21, 2007, 3:03pm UTC](https://forum.kirupa.com/t/can-i-convert-a-php-variable-to-an-array-for-sql-db/239421 "2007-09-21T15:03:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![charles\_i](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/charles_i/32/2986_2.png) [@charles\_i](https://forum.kirupa.com/u/charles_i)\
**Post date:** [September 21, 2007, 3:03pm UTC](https://forum.kirupa.com/t/can-i-convert-a-php-variable-to-an-array-for-sql-db/239421/1 "2007-09-21T15:03:23Z")

</div>

Hello,

I have a variable named ‘link’ that’s being passed through GET (URL from previous page) that I need to insert into my SQL db. Something like this:

```auto
$ID_workshop = $_GET['link'];

$form_vars = array('ID_num','workshop','comment','ID_workshop');

```

How do I get the value of $ID\_workshop into the field ‘ID\_workshop’ in the db? I’ve tried every combination of single and double quotes that I can think of.

$form\_vars is being used to insert into the db. That’s why I can’t use the $ID\_workshop directly - I need whatever value it’s holding so I can insert ‘ID\_workshop’.

Or is there another way to to do this?

Thanks
