Problem adding arrays into a databasic coulm

Codes here !

Moderators: egami, macek, gesf

Post Reply
jemy
New php-forum User
New php-forum User
Posts: 6
Joined: Thu Jan 02, 2003 5:27 am
Location: Munich / Germany

Thu Jan 16, 2003 8:49 am

$test = array("test", "EHEH", "Dad");

mysql_query("INSERT INTO Score_$halo_nickname (score_data) VALUES ($test)");


Hi,

1) if "Score_$halo_nickname" should be a table name you build with the variable $halo, you should procede the following way:
$table = "Score_".$halo."_nickname";
and then: insert into $table ... whatever...

2) do you like to have 3 rows, like:
1. row ---> score_data = "test"
2. row ---> score_data = "EHEH"
3. row ---> score_data = "Dad"
do it like that:
foreach ($test as $value) {
$query = "insert .... values($value)";
$res = mysql_query(......);
}

3) if you wish only 1 row, like:
1. row ---> score_data = array("test", "EHEH", "Dad")
it's not working.
create 3 fields: score_data1 - score_data2 - score_data3
in which you put your score datas separated.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests