Jump to content

Recommended Posts

Hi there,

 

using select * sql I have created a list of products on a page, I print this list and store it into arrays as well, the prob I am having is accessing the arrays on another script (process order script):

 

The arrays on the first script look like this:

 

while

{

extract($variable);

$array[$num] = $variable;

}

 

Can anyone help me? thanks.

Hi there,

I understand what you mean , but I wish just to get to the arrays only not include the whole script.

 

part of first script:

 

$sqlqry_getwsi = "select * from tbl_wsi";

$sqlres_getwsi = mysql_query($sqlqry_getwsi) or die ("Could not execute getwsi query");

 

$num = 0;

$wsi_tn_arr= ""; $wsi_id_arr= ""; $wsi_desc_arr= ""; $wsi_dim_arr= "";

$wsi_cm_arr= ""; $wsi_price_arr= ""; $wsi_qty_arr= ""; $wsi_nxtshiparr_arr= ""; $wsi_img_arr= "";

 

while($row_getwsi = mysql_fetch_array($sqlres_getwsi))

{

extract($row_getwsi);

 

$wsi_id_arr[$num] = $wsi_id; $wsi_desc_arr[$num] = $wsi_desc; $wsi_dim_arr[$num] = $wsi_dim;

$wsi_cm_arr[$num] = $wsi_cm; $wsi_price_arr[$num] = $wsi_price; $wsi_qty_arr[$num] = $wsi_qty;

$wsi_tn_arr[$num] = $wsi_tn; $wsi_img_arr[$num] = $wsi_img; $wsi_nxtshiparr_arr[$num] = $wsi_nxtshiparr;

 

echo "<tr><td>$wsi_tn_arr[$num]</td><td>$wsi_id_arr[$num]</td><td>$wsi_desc_arr[$num]</td>

<td>$wsi_dim_arr[$num]</td><td>$wsi_cm_arr[$num]</td><td>$wsi_price_arr[$num]</td>

<td>$wsi_qty_arr[$num]</td><td>$wsi_nxtshiparr_arr[$num]</td>

<td><select name='$wsi_id_arr[$num]'>";

 

for($selectcnt=0;$selectcnt<=$wsi_qty_arr[$num];$selectcnt++)

{

echo"<option value='$selectcnt'";

if(isset($remember_qty[$num])) { echo"selected='selected'"; }

else if($selectcnt==0){ echo"selected='selected'"; }

else{}

 

echo">$selectcnt</option>";

}

echo "</select></td><tr>";

i don't understand. You need to run the script to fill the array.

 

Why bother with the array anyway?

 

Just query the database every time you want the data. You can configure MySQL to cache your results, so it won't even do any look ups, it'll just pass the cache back to you.

 

monk.e.boy

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.