Show DevBest PHP Script help.

Status
Not open for further replies.

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Hey,

I've not yet started on this but, what I've found in r35 is that we have 2 tables catalogue_items and dynamic_items I'm trying to put them both into one, so it's so much more easier + faster.

Would it be possible for me to make a script to move everything from dynamic_items to catalouge_items by using name_cct (which is a column in both tables).

- Cheers.
 

Kryptos

prjRev.com
Jul 21, 2010
2,205
1,252
I think you could, first you would make a table with all those rows.

then some PHP code...
PHP:
while($row = mysql_fetch_array(mysql_query("SELECT * FROM table1"), MYSQL_ASSOC)) 
{
      $table1 = $row;
}
while($row = mysql_fetch_array(mysql_query("SELECT * FROM table2"), MYSQL_ASSOC)) 
{
      $table2 = $row;
}
 
$tables = array_merge($table1, $table2); //Yay we got these two shits together. Now we just have one big array.
 
//Insert array into database, too tired to think.... SHUT DOWN

Maybe it works, maybe it won't. Excuse me I'm sleepy.
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
I think you could, first you would make a table with all those rows.

then some PHP code...
PHP:
while($row = mysql_fetch_array(mysql_query("SELECT * FROM table1"), MYSQL_ASSOC))
{
      $table1 = $row;
}
while($row = mysql_fetch_array(mysql_query("SELECT * FROM table2"), MYSQL_ASSOC))
{
      $table2 = $row;
}
 
$tables = array_merge($table1, $table2); //Yay we got these two shits together. Now we just have one big array.
 
//Insert array into database, too tired to think.... SHUT DOWN

Maybe it works, maybe it won't. Excuse me I'm sleepy.

Alright, cheers for the start up, just trying to think what to do hm.
 

Alam

shietttt
Jul 3, 2011
433
166
Hello Sleddeh,
I Don't know much about this issue but it should look something like this
PHP:
insert into table (col1, col2)
select col1, col2 from table1
union
select col1, col2 from table1
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Hey,

Easier than I thought, didn't need to run through PHP I ran it through the server when it cached the catalogue, I ran 2 querys one for length other for width.

Queries:

dbClient.runQuery("UPDATE catalogue_items SET length = '" + itemLength + "' WHERE name_cct = '" + itemCCTs.Split(' ')[0] + "'");

- Cheers for the help anyway :D.
 
Status
Not open for further replies.

Users who are viewing this thread

Top