Php script question

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
User avatar
freshnet
php-forum Active User
php-forum Active User
Posts: 359
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Sat Mar 24, 2012 3:33 am

Maybe start by posting the code you have for assigning 'image1' to these images for a start, but it's definitely possible. If you have a variable you could just use all or part of that variable as the table name, e.g.

Code: Select all

INSERT INTO '$varforimage1'...
or
//look at the last character of the image variable

Code: Select all

$table = 'Table'.substr($image,-1,1);
or
//look at the last character of the image variable

Code: Select all

if (substr($image,-1,1)==1)
{}
else if (substr($image,-1,1)==2)
{}
etc.
That last one is your best option if the correspondence between $image and $table is not regular (e.g. if you have $image3 -> $table5, $image4 -> $table7 etc.)

Post Reply